From: Michael Buesch <mb@bu3sch.de>
To: Christian Casteyde <casteyde.christian@free.fr>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com
Subject: Re: [PATCH 2.6.25-rc6] b43/dma.c: fix DMA unmapping in DMA ring error path
Date: Sat, 22 Mar 2008 21:59:08 +0100 [thread overview]
Message-ID: <200803222159.08293.mb@bu3sch.de> (raw)
In-Reply-To: <200803221832.18285.casteyde.christian@free.fr>
On Saturday 22 March 2008 18:32:18 Christian Casteyde wrote:
> This fixes a DMA mapping leak in error path of the b43_setup_dmaring function.
> When DMA mapping fails because of device mask preventing the allocated DMA
> zone from being used, the mapping should be reversed before the second try with GFP_DMA.
This doesn't fix all occurences of the bug.
I'll send a fixed patch later.
> Signed-off-by: Christian Casteyde <casteyde.christian@free.fr>
>
> ---
> --- linux-2.6.25.old/drivers/net/wireless/b43/dma.c 2008-03-22 17:28:52.000000000 +0100
> +++ linux-2.6.25/drivers/net/wireless/b43/dma.c 2008-03-22 17:57:44.000000000 +0100
> @@ -854,6 +854,10 @@
>
> if (b43_dma_mapping_error(ring, dma_test, b43_txhdr_size(dev))) {
> /* ugh realloc */
> + if (!dma_mapping_error(dma_test))
> + dma_unmap_single(dev->dev->dev,
> + dma_test, b43_txhdr_size(dev),
> + DMA_TO_DEVICE);
> kfree(ring->txhdr_cache);
> ring->txhdr_cache = kcalloc(nr_slots,
> b43_txhdr_size(dev),
> @@ -867,8 +871,13 @@
> DMA_TO_DEVICE);
>
> if (b43_dma_mapping_error(ring, dma_test,
> - b43_txhdr_size(dev)))
> + b43_txhdr_size(dev))) {
> + if (!dma_mapping_error(dma_test))
> + dma_unmap_single(dev->dev->dev,
> + dma_test, b43_txhdr_size(dev),
> + DMA_TO_DEVICE);
> goto err_kfree_txhdr_cache;
> + }
> }
>
> dma_unmap_single(dev->dev->dev,
>
>
--
Greetings Michael.
prev parent reply other threads:[~2008-03-22 20:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-22 17:32 [PATCH 2.6.25-rc6] b43/dma.c: fix DMA unmapping in DMA ring error path Christian Casteyde
2008-03-22 20:59 ` Michael Buesch [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=200803222159.08293.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=casteyde.christian@free.fr \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).