All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis R. Rodriguez <lrodriguez@atheros.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH v2] ath9k: fix dma mapping leak of rx buffer upon rmmod
Date: Mon, 23 Mar 2009 16:31:49 -0700	[thread overview]
Message-ID: <20090323233149.GL5740@tesla> (raw)
In-Reply-To: <20090324092128A.fujita.tomonori@lab.ntt.co.jp>

On Mon, Mar 23, 2009 at 05:21:28PM -0700, FUJITA Tomonori wrote:
> On Mon, 23 Mar 2009 18:25:01 -0400
> "Luis R. Rodriguez" <lrodriguez@atheros.com> wrote:
> 
> > We were claiming DMA buffers on the RX tasklet but never
> > upon a simple module removal.
> >
> > Cc: stable at kernel.org
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> > Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> > ---
> >
> > Sorry, forgot to CC stable
> >
> >  drivers/net/wireless/ath9k/recv.c |    7 ++++++-
> >  1 files changed, 6 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
> > index 917bac7..71cb18d 100644
> > --- a/drivers/net/wireless/ath9k/recv.c
> > +++ b/drivers/net/wireless/ath9k/recv.c
> > @@ -344,8 +344,13 @@ void ath_rx_cleanup(struct ath_softc *sc)
> >
> >       list_for_each_entry(bf, &sc->rx.rxbuf, list) {
> >               skb = bf->bf_mpdu;
> > -             if (skb)
> > +             if (skb) {
> > +                     dma_unmap_single(sc->dev,
> > +                                      bf->bf_buf_addr,
> > +                                      sc->rx.bufsize,
> > +                                      DMA_FROM_DEVICE);
> >                       dev_kfree_skb(skb);
> > +             }
> >       }
> 
> ath9k uses pci_map/unmap_* families so using dma_map/unmap looks
> inconsistent. It works though.
> 
> I think that my original patch is fine:
> 
> http://marc.info/?l=linux-kernel&m=123725029228065&w=2

Noted -- the ported patch for 2.6.29 will use pci_unmap_single() however
this patch was for 2.6.30 where we now have bus-agnostic routines. To
get a better idea of how this looks feel free to check out ath9k from
the wireless-testing git tree.

git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git

  Luis

WARNING: multiple messages have this Message-ID (diff)
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Luis Rodriguez <Luis.Rodriguez@Atheros.com>,
	"linville@tuxdriver.com" <linville@tuxdriver.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"ath9k-devel@lists.ath9k.org" <ath9k-devel@lists.ath9k.org>,
	"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH v2] ath9k: fix dma mapping leak of rx buffer upon rmmod
Date: Mon, 23 Mar 2009 16:31:49 -0700	[thread overview]
Message-ID: <20090323233149.GL5740@tesla> (raw)
In-Reply-To: <20090324092128A.fujita.tomonori@lab.ntt.co.jp>

On Mon, Mar 23, 2009 at 05:21:28PM -0700, FUJITA Tomonori wrote:
> On Mon, 23 Mar 2009 18:25:01 -0400
> "Luis R. Rodriguez" <lrodriguez@atheros.com> wrote:
> 
> > We were claiming DMA buffers on the RX tasklet but never
> > upon a simple module removal.
> >
> > Cc: stable@kernel.org
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> > Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> > ---
> >
> > Sorry, forgot to CC stable
> >
> >  drivers/net/wireless/ath9k/recv.c |    7 ++++++-
> >  1 files changed, 6 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
> > index 917bac7..71cb18d 100644
> > --- a/drivers/net/wireless/ath9k/recv.c
> > +++ b/drivers/net/wireless/ath9k/recv.c
> > @@ -344,8 +344,13 @@ void ath_rx_cleanup(struct ath_softc *sc)
> >
> >       list_for_each_entry(bf, &sc->rx.rxbuf, list) {
> >               skb = bf->bf_mpdu;
> > -             if (skb)
> > +             if (skb) {
> > +                     dma_unmap_single(sc->dev,
> > +                                      bf->bf_buf_addr,
> > +                                      sc->rx.bufsize,
> > +                                      DMA_FROM_DEVICE);
> >                       dev_kfree_skb(skb);
> > +             }
> >       }
> 
> ath9k uses pci_map/unmap_* families so using dma_map/unmap looks
> inconsistent. It works though.
> 
> I think that my original patch is fine:
> 
> http://marc.info/?l=linux-kernel&m=123725029228065&w=2

Noted -- the ported patch for 2.6.29 will use pci_unmap_single() however
this patch was for 2.6.30 where we now have bus-agnostic routines. To
get a better idea of how this looks feel free to check out ath9k from
the wireless-testing git tree.

git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git

  Luis

  reply	other threads:[~2009-03-23 23:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 22:25 [ath9k-devel] [PATCH v2] ath9k: fix dma mapping leak of rx buffer upon rmmod Luis R. Rodriguez
2009-03-23 22:25 ` Luis R. Rodriguez
2009-03-24  0:21 ` [ath9k-devel] " FUJITA Tomonori
2009-03-24  0:21   ` FUJITA Tomonori
2009-03-23 23:31   ` Luis R. Rodriguez [this message]
2009-03-23 23:31     ` Luis R. Rodriguez

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=20090323233149.GL5740@tesla \
    --to=lrodriguez@atheros.com \
    --cc=ath9k-devel@lists.ath9k.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.