]> err.no Git - linux-2.6/commitdiff
[ROSE]: Fix dereference of skb pointer after free.
authorRalf Baechle <ralf@linux-mips.org>
Tue, 4 Jul 2006 02:29:15 +0000 (19:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jul 2006 02:29:15 +0000 (19:29 -0700)
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.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rose/rose_dev.c

index 9d0bf2a1ea3f37e9d362d4ff6546f2d4c215a2cf..7c279e2659eca174aefaee1e8d942516ac5e6427 100644 (file)
@@ -59,6 +59,7 @@ static int rose_rebuild_header(struct sk_buff *skb)
        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)) {
@@ -75,6 +76,8 @@ static int rose_rebuild_header(struct sk_buff *skb)
 
        kfree_skb(skb);
 
+       len = skbn->len;
+
        if (!rose_route_frame(skbn, NULL)) {
                kfree_skb(skbn);
                stats->tx_errors++;
@@ -82,7 +85,7 @@ static int rose_rebuild_header(struct sk_buff *skb)
        }
 
        stats->tx_packets++;
-       stats->tx_bytes += skbn->len;
+       stats->tx_bytes += len;
 #endif
        return 1;
 }