Skip to content

Commit

Permalink
[ROSE]: Fix dereference of skb pointer after free.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ralfbaechle authored and davem330 committed Jul 4, 2006
1 parent 518d1c9 commit 8dc22d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/rose/rose_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -75,14 +76,16 @@ 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++;
return 1;
}

stats->tx_packets++;
stats->tx_bytes += skbn->len;
stats->tx_bytes += len;
#endif
return 1;
}
Expand Down

0 comments on commit 8dc22d2

Please sign in to comment.