Skip to contentSkip to conversation

Use after free in net/tulip/de2104x.c

PATCH New Eric Sesterhenn 1 participant 1 message Mar 22, 2006 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use after free in net/tulip/de2104x.c

hi,

this fixes coverity bug #912, where skb is freed first, and dereferenced a few lines later with skb->len.

drivers/net/tulip/de2104x.c renamed from drivers/net/tulip/de2104x.c.orig +1 -1
@@ -1332,11 +1332,11 @@ static void de_clean_rings (struct de_pr
 		struct sk_buff *skb = de->tx_skb[i].skb;
 		if ((skb) && (skb != DE_DUMMY_SKB)) {
 			if (skb != DE_SETUP_SKB) {
-				dev_kfree_skb(skb);
 				de->net_stats.tx_dropped++;
 				pci_unmap_single(de->pdev,
 					de->tx_skb[i].mapping,
 					skb->len, PCI_DMA_TODEVICE);
+				dev_kfree_skb(skb);
 			} else {
 				pci_unmap_single(de->pdev,
 					de->tx_skb[i].mapping,