public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 1/6] wifi: rtw89: usb: fix leak in rtw89_usb_rx_handler()
Date: Wed, 24 Sep 2025 08:49:54 +0000	[thread overview]
Message-ID: <1078ec2bdac24744925d24da9522d8d1@realtek.com> (raw)
In-Reply-To: <20250920132614.277719-2-pchelkin@ispras.ru>

Fedor Pchelkin <pchelkin@ispras.ru> wrote:
> Free allocated skb on the error handling path.
> 
> Found by Linux Verification Center (linuxtesting.org).
> 
> Fixes: 2135c28be6a8 ("wifi: rtw89: Add usb.{c,h}")
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> ---
>  drivers/net/wireless/realtek/rtw89/usb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
> index 6cf89aee252e..3435599f4740 100644
> --- a/drivers/net/wireless/realtek/rtw89/usb.c
> +++ b/drivers/net/wireless/realtek/rtw89/usb.c
> @@ -422,6 +422,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);
> +                       dev_kfree_skb_any(rx_skb);
>                         continue;
>                 }

I feel we should goto free_or_reuse like below:

free_or_reuse:
		if (skb_queue_len(&rtwusb->rx_free_queue) >= RTW89_USB_RX_SKB_NUM)
			dev_kfree_skb_any(rx_skb);
		else
			skb_queue_tail(&rtwusb->rx_free_queue, rx_skb);

If just free skb, rtwusb->rx_free_queue might be starved.


  reply	other threads:[~2025-09-24  8:50 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 [this message]
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
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=1078ec2bdac24744925d24da9522d8d1@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