mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luka Gejak" <luka.gejak@linux.dev>
To: "Hungyu Lin" <dennylin0707@gmail.com>, <pkshih@realtek.com>
Cc: <linux-wireless@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<pchelkin@ispras.ru>, <mihaildimoski@gmail.com>,
	<tristan@talencesecurity.com>, <rtl8821cerfe2@gmail.com>,
	<dawei.feng@seu.edu.cn>, <learn.rahul.rai@gmail.com>,
	<branislav.klocok@orava.sk>, <timlee@realtek.com>,
	<kvalo@kernel.org>, <briannorris@chromium.org>,
	<yhchuang@realtek.com>, <sgruszka@redhat.com>
Subject: Re: [PATCH] wifi: rtw88: pci: preserve the RX ring DMA address on cleanup
Date: Fri, 09 Oct 2026 13:50:36 +0200	[thread overview]
Message-ID: <DM0AA2YBXFI2.HD7B6PLDQ8FU@linux.dev> (raw)
In-Reply-To: <20261009032339.31786-1-dennylin0707@gmail.com>

On Fri Oct 9, 2026 at 5:23 AM CEST, Hungyu Lin wrote:
> rtw_pci_init_rx_ring() stores the coherent ring DMA address in dma, but
> reuses it for RX buffer DMA addresses during error cleanup. If
> initialization fails after at least one buffer has been mapped,
> dma_free_coherent() receives the last buffer's DMA address instead of
> the ring's.
>
> Use a separate variable for the buffer DMA addresses so the ring is
> freed with the address returned by dma_alloc_coherent().
>
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtw88/pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
> index 66d2e5f51444..10147375f3b2 100644
> --- a/drivers/net/wireless/realtek/rtw88/pci.c
> +++ b/drivers/net/wireless/realtek/rtw88/pci.c
> @@ -298,11 +298,13 @@ static int rtw_pci_init_rx_ring(struct rtw_dev *rtwdev,
>  
>  err_out:
>  	for (i = 0; i < allocated; i++) {
> +		dma_addr_t buf_dma;
> +
>  		skb = rx_ring->buf[i];
>  		if (!skb)
>  			continue;
> -		dma = *((dma_addr_t *)skb->cb);
> -		dma_unmap_single(&pdev->dev, dma, buf_sz, DMA_FROM_DEVICE);
> +		buf_dma = *((dma_addr_t *)skb->cb);
> +		dma_unmap_single(&pdev->dev, buf_dma, buf_sz, DMA_FROM_DEVICE);
>  		dev_kfree_skb_any(skb);
>  		rx_ring->buf[i] = NULL;
>  	}

This patch should cc stable so it gets backported. Besides that it
looks good to me. Ping-Ke maybe you can add Cc: stable@vger.kernel.org
when applying to your tree?

Reviewed-by: Luka Gejak <luka.gejak@linux.dev>

Best regards,
Luka Gejak

      reply	other threads:[~2026-10-09 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  3:23 Hungyu Lin
2026-10-09 11:50 ` Luka Gejak [this message]

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=DM0AA2YBXFI2.HD7B6PLDQ8FU@linux.dev \
    --to=luka.gejak@linux.dev \
    --cc=branislav.klocok@orava.sk \
    --cc=briannorris@chromium.org \
    --cc=dawei.feng@seu.edu.cn \
    --cc=dennylin0707@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=learn.rahul.rai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mihaildimoski@gmail.com \
    --cc=pchelkin@ispras.ru \
    --cc=pkshih@realtek.com \
    --cc=rtl8821cerfe2@gmail.com \
    --cc=sgruszka@redhat.com \
    --cc=timlee@realtek.com \
    --cc=tristan@talencesecurity.com \
    --cc=yhchuang@realtek.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®