linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] b43legacy: Fix possible NULL pointer dereference in DMA code
@ 2008-06-20  9:40 Michael Buesch
  0 siblings, 0 replies; only message in thread
From: Michael Buesch @ 2008-06-20  9:40 UTC (permalink / raw)
  To: John Linville; +Cc: bcm43xx-dev, linux-wireless, Stefano Brivio

This fixes a possible NULL pointer dereference in an error path of the
DMA allocation error checking code. This is also necessary for a future
DMA API change that is on its way into the mainline kernel that adds
an additional dev parameter to dma_mapping_error().

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---

John, please apply to 2.6.26



Index: wireless-testing/drivers/net/wireless/b43legacy/dma.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/b43legacy/dma.c	2008-06-20 02:04:56.000000000 +0200
+++ wireless-testing/drivers/net/wireless/b43legacy/dma.c	2008-06-20 02:06:45.000000000 +0200
@@ -873,12 +873,13 @@ struct b43legacy_dmaring *b43legacy_setu
 	dma_addr_t dma_test;
 
 	ring = kzalloc(sizeof(*ring), GFP_KERNEL);
 	if (!ring)
 		goto out;
 	ring->type = type;
+	ring->dev = dev;
 
 	nr_slots = B43legacy_RXRING_SLOTS;
 	if (for_tx)
 		nr_slots = B43legacy_TXRING_SLOTS;
 
 	ring->meta = kcalloc(nr_slots, sizeof(struct b43legacy_dmadesc_meta),
@@ -919,13 +920,12 @@ struct b43legacy_dmaring *b43legacy_setu
 
 		dma_unmap_single(dev->dev->dma_dev,
 				 dma_test, sizeof(struct b43legacy_txhdr_fw3),
 				 DMA_TO_DEVICE);
 	}
 
-	ring->dev = dev;
 	ring->nr_slots = nr_slots;
 	ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index);
 	ring->index = controller_index;
 	if (type == B43legacy_DMA_64BIT)
 		ring->ops = &dma64_ops;
 	else

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-20  9:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20  9:40 [PATCH] b43legacy: Fix possible NULL pointer dereference in DMA code Michael Buesch

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).