mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] drive/realtek/rtlwifi: fix possible memory leak
Date: Fri, 13 Jun 2025 00:41:33 +0000	[thread overview]
Message-ID: <9800869271a34ca3835743207c0a4109@realtek.com> (raw)
In-Reply-To: <20250612090724.17777-1-fourier.thomas@gmail.com>

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@gmail.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@gmail.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


  parent reply	other threads:[~2025-06-13  0:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12  9:07 Thomas Fourier
2025-06-12 22:45 ` kernel test robot
2025-06-13  0:41 ` Ping-Ke Shih [this message]
2025-06-13  7:38   ` [PATCH rtw-next] wifi: rtlwifi: fix possible skb memory leak in _rtl_pci_init_one_rxdesc() Thomas Fourier
2025-06-16  3:56     ` 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=9800869271a34ca3835743207c0a4109@realtek.com \
    --to=pkshih@realtek.com \
    --cc=fourier.thomas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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®