From: Ping-Ke Shih <pkshih@realtek.com>
To: Fedor Pchelkin <pchelkin@ispras.ru>,
Bitterblue Smith <rtl8821cerfe2@gmail.com>
Cc: Zong-Zhe Yang <kevin_yang@realtek.com>,
Bernie Huang <phhuang@realtek.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>
Subject: RE: [PATCH rtw-next 2/6] wifi: rtw89: usb: fix leak in rtw89_usb_write_port()
Date: Wed, 24 Sep 2025 09:03:01 +0000 [thread overview]
Message-ID: <fbd7e4192bb8422980a2916489d4961d@realtek.com> (raw)
In-Reply-To: <20250920132614.277719-3-pchelkin@ispras.ru>
Fedor Pchelkin <pchelkin@ispras.ru> wrote:
> When there is an attempt to write data and RTW89_FLAG_UNPLUGGED is set,
> this means device is disconnected and no urb is submitted. Return
> appropriate error code to the caller to properly free the allocated
> resources.
>
> 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>
> ---
> drivers/net/wireless/realtek/rtw89/usb.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
> index 3435599f4740..bc0d5e48d39b 100644
> --- a/drivers/net/wireless/realtek/rtw89/usb.c
> +++ b/drivers/net/wireless/realtek/rtw89/usb.c
> @@ -256,7 +256,7 @@ static int rtw89_usb_write_port(struct rtw89_dev *rtwdev, u8 ch_dma,
> int ret;
>
> if (test_bit(RTW89_FLAG_UNPLUGGED, rtwdev->flags))
> - return 0;
> + return -ENODEV;
>
> urb = usb_alloc_urb(0, GFP_ATOMIC);
> if (!urb)
> @@ -305,8 +305,9 @@ static void rtw89_usb_ops_tx_kick_off(struct rtw89_dev *rtwdev, u8 txch)
> ret = rtw89_usb_write_port(rtwdev, txch, skb->data, skb->len,
> txcb);
> if (ret) {
> - rtw89_err(rtwdev, "write port txch %d failed: %d\n",
> - txch, ret);
> + if (ret != -ENODEV)
> + rtw89_err(rtwdev, "write port txch %d failed: %d\n",
> + txch, ret);
>
> skb_dequeue(&txcb->tx_ack_queue);
By the way, during I review this function, txcb->tx_ack_queue is a
struct sk_buff_head, how about just struct sk_buff *skb?
(I might ask Bitterblue Smith about this).
More, since skb here is from mac80211, so ieee80211_free_txskb() would be
more suitable rather than dev_kfree_skb_any()?
> kfree(txcb);
> --
> 2.51.0
>
next prev parent reply other threads:[~2025-09-24 9:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 13:26 [PATCH rtw-next 0/6] wifi: rtw89: improvements for USB part Fedor Pchelkin
2025-09-20 13:26 ` [PATCH rtw-next 1/6] wifi: rtw89: usb: fix leak in rtw89_usb_rx_handler() Fedor Pchelkin
2025-09-24 8:49 ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 2/6] wifi: rtw89: usb: fix leak in rtw89_usb_write_port() Fedor Pchelkin
2025-09-24 9:03 ` Ping-Ke Shih [this message]
2025-09-29 9:12 ` Fedor Pchelkin
2025-09-30 2:03 ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 3/6] wifi: rtw89: implement C2H TX report handler Fedor Pchelkin
2025-09-23 22:12 ` Bitterblue Smith
2025-09-24 19:16 ` Bitterblue Smith
2025-09-29 9:46 ` Fedor Pchelkin
2025-09-24 9:18 ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 4/6] wifi: rtw89: handle IEEE80211_TX_CTL_REQ_TX_STATUS frames for USB Fedor Pchelkin
2025-09-25 2:05 ` Ping-Ke Shih
2025-09-29 14:16 ` Fedor Pchelkin
2025-09-30 1:55 ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 5/6] wifi: rtw89: process TX wait skbs for USB via C2H handler Fedor Pchelkin
2025-09-25 3:39 ` Ping-Ke Shih
2025-09-20 13:26 ` [PATCH rtw-next 6/6] wifi: rtw89: forcefully clear TX wait list on HCI reset Fedor Pchelkin
2025-09-25 3:50 ` Ping-Ke Shih
2025-09-22 5:45 ` [PATCH rtw-next 0/6] wifi: rtw89: improvements for USB part 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=fbd7e4192bb8422980a2916489d4961d@realtek.com \
--to=pkshih@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=pchelkin@ispras.ru \
--cc=phhuang@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;
as well as URLs for NNTP newsgroup(s).