Skip to contentSkip to conversation

Fix dereference of skb pointer after free.

ROSE Applied Ralf Baechle 2 participants 2 messages Jun 30, 2006 – Jul 4, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

If rose_route_frame return success we'll dereference a stale pointer. Likely this is only going to result in bad statistics for the ROSE interface.

This fixes coverity 946.

---
 net/rose/rose_dev.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/rose/rose_dev.c +4 -1
Index: linux-net/net/rose/rose_dev.c
===================================================================
@@ -60,6 +60,7 @@ static int rose_rebuild_header(struct sk
 	struct net_device_stats *stats = netdev_priv(dev);
 	unsigned char *bp = (unsigned char *)skb->data;
 	struct sk_buff *skbn;
+	unsigned int len;
 
 #ifdef CONFIG_INET
 	if (arp_find(bp + 7, skb)) {
@@ -76,6 +77,8 @@ static int rose_rebuild_header(struct sk
 
 	kfree_skb(skb);
 
+	len = skbn->len;
+
 	if (!rose_route_frame(skbn, NULL)) {
 		kfree_skb(skbn);
 		stats->tx_errors++;
@@ -83,7 +86,7 @@ static int rose_rebuild_header(struct sk
 	}
 
 	stats->tx_packets++;
-	stats->tx_bytes += skbn->len;
+	stats->tx_bytes += len;
 #endif
 	return 1;
 }
maintainer Applied
#1 lore raw

From: Ralf Baechle <[email protected]>
Date: Fri, 30 Jun 2006 14:36:14 +0100

Quoted 7 lines

If rose_route_frame return success we'll dereference a stale pointer. Likely this is only going to result in bad statistics for the ROSE interface.

This fixes coverity 946.

Applied, thanks Ralf.