RE: [PATCH] wifi: rtw88: usb: drop RX frames received before the device is started
From: Ping-Ke Shih
Date: Sun Oct 18 2026 - 22:22:01 EST
YuanZhe Liu <25031212351@xxxxxxxxxxxxxxxxx> wrote:
> diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
> index 64e1c3420e0a..12fb669015d1 100644
> --- a/drivers/net/wireless/realtek/rtw88/usb.c
> +++ b/drivers/net/wireless/realtek/rtw88/usb.c
> @@ -664,7 +664,7 @@ static void rtw_usb_rx_handler(struct work_struct *work)
>
> if (pkt_stat.is_c2h) {
> rtw_fw_c2h_cmd_rx_irqsafe(rtwdev, pkt_offset, skb);
> - } else {
> + } else if (test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) {
Patch content is fine to me, but I prefer the style:
if (is_c2h) {
...
} else {
if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) {
dev_kfree_skb_any(skb);
goto skip_packet;
}
...
}
No need additional comment for it.
> skb_pull(skb, pkt_offset);
> rtw_update_rx_freq_for_invalid(rtwdev, skb,
> &rx_status,
> @@ -672,6 +672,14 @@ static void rtw_usb_rx_handler(struct work_struct *work)
> rtw_rx_stats(rtwdev, pkt_stat.vif, skb);
> memcpy(skb->cb, &rx_status, sizeof(rx_status));
> ieee80211_rx_irqsafe(rtwdev->hw, skb);
> + } else {
> + /*
> + * RX URBs are submitted at the end of probe,
> + * so frames can arrive before the device has
> + * been started. mac80211 does not accept
> + * frames in that state, so drop them here.
> + */
> + dev_kfree_skb_any(skb);
> }
>
> skip_packet:
> --
> 2.34.1
>