[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9800869271a34ca3835743207c0a4109@realtek.com>
Date: Fri, 13 Jun 2025 00:41:33 +0000
From: Ping-Ke Shih <pkshih@...ltek.com>
To: Thomas Fourier <fourier.thomas@...il.com>
CC: "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] drive/realtek/rtlwifi: fix possible memory leak
The subject should be unique and with rtw-next tag, such as
"[PATCH rtw-next] wifi: rtlwifi: fix possible skb memory leak in
_rtl_pci_init_one_rxdesc()."
Thomas Fourier <fourier.thomas@...il.com> wrote:
> When `dma_mapping_error()` is true, if a new `skb` has been allocated,
> then it must be de-allocated.
Add a "Compile tested only". (I guess you even didn't)
>
> Signed-off-by: Thomas Fourier <fourier.thomas@...il.com>
> ---
> drivers/net/wireless/realtek/rtlwifi/pci.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
> index 898f597f70a9..f754f1c3f783 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
> @@ -572,8 +572,11 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,
> dma_map_single(&rtlpci->pdev->dev, skb_tail_pointer(skb),
> rtlpci->rxbuffersize, DMA_FROM_DEVICE);
> bufferaddress = *((dma_addr_t *)skb->cb);
> - if (dma_mapping_error(&rtlpci->pdev->dev, bufferaddress))
> + if (dma_mapping_error(&rtlpci->pdev->dev, bufferaddress)) {
> + if (!new_skb)
> + kfree_skb(skb)
kernel test robot reported error here.
> return 0;
> + }
> rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb;
> if (rtlpriv->use_new_trx_flow) {
> /* skb->cb may be 64 bit address */
> --
> 2.43.0
Powered by blists - more mailing lists