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

Luka Gejak <luka.gejak@linux.dev> wrote:
> 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")

Cc: stable@vger.kernel.org

> > Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.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?

Sure.

Ping-Ke


      reply	other threads:[~2026-10-12  1:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  3:23 Hungyu Lin
2026-10-09 11:50 ` Luka Gejak
2026-10-12  1:18   ` Ping-Ke Shih [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=b7f24ac9f6714f91a40aa7c4952558a0@realtek.com \
    --to=pkshih@realtek.com \
    --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=luka.gejak@linux.dev \
    --cc=mihaildimoski@gmail.com \
    --cc=pchelkin@ispras.ru \
    --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®