diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-07-11 21:16:08 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-07-15 09:04:27 +0200 |
commit | 20926d79244de4e9c698ae429fdc1e7e5832b081 (patch) | |
tree | 536a8e5fe2db4355bc141b339618f41f8b957487 /drivers/net/can/bfin_can.c | |
parent | a18ec1b6c72eb87fe00e8e09c3a3f3cfbec3435b (diff) | |
download | op-kernel-dev-20926d79244de4e9c698ae429fdc1e7e5832b081.zip op-kernel-dev-20926d79244de4e9c698ae429fdc1e7e5832b081.tar.gz |
can: bfin_can: don't touch skb after netif_rx()
There is no guarantee that the skb is in the same state after calling
net_receive_skb() or netif_rx(). It might be freed or reused. Not really
harmful as its a read access, except you turn on the proper debugging options
which catch a use after free.
Cc: Aaron Wu <Aaron.wu@analog.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/bfin_can.c')
-rw-r--r-- | drivers/net/can/bfin_can.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c index 27ad312..57dadd5 100644 --- a/drivers/net/can/bfin_can.c +++ b/drivers/net/can/bfin_can.c @@ -424,10 +424,9 @@ static void bfin_can_rx(struct net_device *dev, u16 isrc) cf->data[6 - i] = (6 - i) < cf->can_dlc ? (val >> 8) : 0; } - netif_rx(skb); - stats->rx_packets++; stats->rx_bytes += cf->can_dlc; + netif_rx(skb); } static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) @@ -508,10 +507,9 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) priv->can.state = state; - netif_rx(skb); - stats->rx_packets++; stats->rx_bytes += cf->can_dlc; + netif_rx(skb); return 0; } |