Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8dc22d2b authored by Ralf Baechle's avatar Ralf Baechle Committed by David S. Miller
Browse files

[ROSE]: Fix dereference of skb pointer after free.



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: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 518d1c96
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -59,6 +59,7 @@ static int rose_rebuild_header(struct sk_buff *skb)
	struct net_device_stats *stats = netdev_priv(dev);
	struct net_device_stats *stats = netdev_priv(dev);
	unsigned char *bp = (unsigned char *)skb->data;
	unsigned char *bp = (unsigned char *)skb->data;
	struct sk_buff *skbn;
	struct sk_buff *skbn;
	unsigned int len;


#ifdef CONFIG_INET
#ifdef CONFIG_INET
	if (arp_find(bp + 7, skb)) {
	if (arp_find(bp + 7, skb)) {
@@ -75,6 +76,8 @@ static int rose_rebuild_header(struct sk_buff *skb)


	kfree_skb(skb);
	kfree_skb(skb);


	len = skbn->len;

	if (!rose_route_frame(skbn, NULL)) {
	if (!rose_route_frame(skbn, NULL)) {
		kfree_skb(skbn);
		kfree_skb(skbn);
		stats->tx_errors++;
		stats->tx_errors++;
@@ -82,7 +85,7 @@ static int rose_rebuild_header(struct sk_buff *skb)
	}
	}


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