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

Commit f65d1f08 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

hamradio: avoid null deref v3



This should address the problems in version 1 (lazy) and version 2 (ugly).

Bump the stats on orig_dev not on the newly assigned NULL dev variable.

Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c064efca
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
{
	unsigned char *ptr;
	struct bpqdev *bpq;
	struct net_device *orig_dev;
	int size;

	/*
@@ -282,8 +283,9 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)

	bpq = netdev_priv(dev);

	orig_dev = dev;
	if ((dev = bpq_get_ether_dev(dev)) == NULL) {
		dev->stats.tx_dropped++;
		orig_dev->stats.tx_dropped++;
		kfree_skb(skb);
		return NETDEV_TX_OK;
	}