diff options
author | Dan Carpenter <error27@gmail.com> | 2009-12-28 07:54:55 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-04 06:42:50 +0100 |
commit | f65d1f082c8fb1bfae3f2cb51ec270da9b6366cf (patch) | |
tree | 724e6ecc523064138a3e8037b826852a848ca528 /drivers/net/hamradio | |
parent | usbnet: test off by one (diff) | |
download | linux-f65d1f082c8fb1bfae3f2cb51ec270da9b6366cf.tar.xz linux-f65d1f082c8fb1bfae3f2cb51ec270da9b6366cf.zip |
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: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hamradio')
-rw-r--r-- | drivers/net/hamradio/bpqether.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index ae5f11c8fc13..bdadf3e23c94 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c @@ -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; } |