From: Fedor Pchelkin <pchelkin@ispras.ru>
To: Ping-Ke Shih <pkshih@realtek.com>,
Bitterblue Smith <rtl8821cerfe2@gmail.com>
Cc: Fedor Pchelkin <pchelkin@ispras.ru>,
Zong-Zhe Yang <kevin_yang@realtek.com>,
Po-Hao Huang <phhuang@realtek.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: [PATCH rtw-next v3 1/9] wifi: rtw89: usb: use common error path for skbs in rtw89_usb_rx_handler()
Date: Fri, 17 Oct 2025 13:03:03 +0300 [thread overview]
Message-ID: <20251017100658.66581-2-pchelkin@ispras.ru> (raw)
In-Reply-To: <20251017100658.66581-1-pchelkin@ispras.ru>
Allow adding rx_skb to rx_free_queue for later reuse on the common error
handling path, otherwise free it.
Found by Linux Verification Center (linuxtesting.org).
Fixes: 2135c28be6a8 ("wifi: rtw89: Add usb.{c,h}")
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
---
v2: - do goto 'free_or_reuse' (Ping-Ke)
drivers/net/wireless/realtek/rtw89/usb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
index 6cf89aee252e..e8e064cf7e0a 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.c
+++ b/drivers/net/wireless/realtek/rtw89/usb.c
@@ -410,8 +410,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)
if (skb_queue_len(&rtwusb->rx_queue) >= RTW89_USB_MAX_RXQ_LEN) {
rtw89_warn(rtwdev, "rx_queue overflow\n");
- dev_kfree_skb_any(rx_skb);
- continue;
+ goto free_or_reuse;
}
memset(&desc_info, 0, sizeof(desc_info));
@@ -422,7 +421,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)
rtw89_debug(rtwdev, RTW89_DBG_HCI,
"failed to allocate RX skb of size %u\n",
desc_info.pkt_size);
- continue;
+ goto free_or_reuse;
}
pkt_offset = desc_info.offset + desc_info.rxd_len;
@@ -432,6 +431,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)
rtw89_core_rx(rtwdev, &desc_info, skb);
+free_or_reuse:
if (skb_queue_len(&rtwusb->rx_free_queue) >= RTW89_USB_RX_SKB_NUM)
dev_kfree_skb_any(rx_skb);
else
--
2.51.0
next prev parent reply other threads:[~2025-10-17 10:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 10:03 [PATCH rtw-next v3 0/9] wifi: rtw89: improvements for USB part Fedor Pchelkin
2025-10-17 10:03 ` Fedor Pchelkin [this message]
2025-10-17 10:03 ` [PATCH rtw-next v3 2/9] wifi: rtw89: usb: fix leak in rtw89_usb_write_port() Fedor Pchelkin
2025-10-17 10:03 ` [PATCH rtw-next v3 3/9] wifi: rtw89: usb: use ieee80211_free_txskb() where appropriate Fedor Pchelkin
2025-10-17 10:03 ` [PATCH rtw-next v3 4/9] wifi: rtw89: refine rtw89_core_tx_wait_complete() Fedor Pchelkin
2025-10-17 10:03 ` [PATCH rtw-next v3 5/9] wifi: rtw89: implement C2H TX report handler Fedor Pchelkin
2025-10-22 6:21 ` Ping-Ke Shih
2025-10-25 10:12 ` Fedor Pchelkin
2025-10-17 10:03 ` [PATCH rtw-next v3 6/9] wifi: rtw89: fill TX descriptor of FWCMD in shortcut Fedor Pchelkin
2025-10-17 10:03 ` [PATCH rtw-next v3 7/9] wifi: rtw89: handle IEEE80211_TX_CTL_REQ_TX_STATUS frames for USB Fedor Pchelkin
2025-10-22 7:16 ` Ping-Ke Shih
2025-10-25 12:10 ` Fedor Pchelkin
2025-10-27 1:14 ` Ping-Ke Shih
2025-10-29 17:09 ` Fedor Pchelkin
2025-10-22 9:16 ` Ping-Ke Shih
2025-10-17 10:03 ` [PATCH rtw-next v3 8/9] wifi: rtw89: provide TX reports for management frames Fedor Pchelkin
2025-10-22 8:54 ` Ping-Ke Shih
2025-10-17 10:03 ` [PATCH rtw-next v3 9/9] wifi: rtw89: process TX wait skbs for USB via C2H handler Fedor Pchelkin
2025-10-22 9:03 ` Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251017100658.66581-2-pchelkin@ispras.ru \
--to=pchelkin@ispras.ru \
--cc=kevin_yang@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=phhuang@realtek.com \
--cc=pkshih@realtek.com \
--cc=rtl8821cerfe2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®