Skip to contentSkip to conversation

b43legacy: Fix possible NULL pointer dereference in DMA code

PATCH In review Michael Buesch 2 participants 3 messages Jun 20, 2008 – Jun 22, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43legacy: Fix possible NULL pointer dereference in DMA code

This fixes a possible NULL pointer dereference in an error path of the DMA allocation error checking code.

---

This patch is not merged to an upstream tree, yet, but is sent to John.

drivers/net/wireless/b43legacy/dma.c +1 -1
Index: linux-2.6.25.6/drivers/net/wireless/b43legacy/dma.c
===================================================================
@@ -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
#1 lore raw
Quoted 8 lines · Michael Buesch

This fixes a possible NULL pointer dereference in an error path of the DMA allocation error checking code.

---

This patch is not merged to an upstream tree, yet, but is sent to John.

In the future, if you want patches to get automatically added to stable when they go into Linus's tree, just add:
Cc: stable <[email protected]>

to the "Signed-off-by:" area and we will get notified of it at merge time, so you don't have to resend it after it gets applied.

thanks,

greg k-h

#2 lore raw
Quoted 8 lines · On Sunday 22 June 2008 18:59:59 Greg KH wrote:
Quoted 7 lines · Michael Buesch

This fixes a possible NULL pointer dereference in an error path of the DMA allocation error checking code.

---

Quoted 8 lines
Quoted 1 line

This patch is not merged to an upstream tree, yet, but is sent to John.

In the future, if you want patches to get automatically added to stable when they go into Linus's tree, just add:
Cc: stable <[email protected]>

to the "Signed-off-by:" area and we will get notified of it at merge time, so you don't have to resend it after it gets applied.

Ok, however often enough it is not trivial to port patches from head to stable. A bug introduced by a stable port isn't something we really want to risk, I think. So I'd like to test all stable patches in their final state before they get submitted to stable.
So for this trivial patch I could probably have used the CC magic, however.

Signature · 1 line
Greetings Michael.