diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-05-08 11:30:29 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-07-15 09:04:27 +0200 |
commit | a18ec1b6c72eb87fe00e8e09c3a3f3cfbec3435b (patch) | |
tree | 9e06b70d3cf148f14db851d26a6acf529dc4447c /drivers/net/can | |
parent | 6ae3673debfbf2cfa1972b6d00b974d0e10ad3c6 (diff) | |
download | linux-a18ec1b6c72eb87fe00e8e09c3a3f3cfbec3435b.tar.gz linux-a18ec1b6c72eb87fe00e8e09c3a3f3cfbec3435b.tar.bz2 linux-a18ec1b6c72eb87fe00e8e09c3a3f3cfbec3435b.zip |
can: flexcan: don't touch skb after netif_receive_skb()
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.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/flexcan.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 6201c5a1a884..b1e8d729851c 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -577,10 +577,10 @@ static int flexcan_poll_bus_err(struct net_device *dev, u32 reg_esr) return 0; do_bus_err(dev, cf, reg_esr); - netif_receive_skb(skb); dev->stats.rx_packets++; dev->stats.rx_bytes += cf->can_dlc; + netif_receive_skb(skb); return 1; } @@ -622,10 +622,9 @@ static int flexcan_poll_state(struct net_device *dev, u32 reg_esr) if (unlikely(new_state == CAN_STATE_BUS_OFF)) can_bus_off(dev); - netif_receive_skb(skb); - dev->stats.rx_packets++; dev->stats.rx_bytes += cf->can_dlc; + netif_receive_skb(skb); return 1; } @@ -670,10 +669,10 @@ static int flexcan_read_frame(struct net_device *dev) } flexcan_read_fifo(dev, cf); - netif_receive_skb(skb); stats->rx_packets++; stats->rx_bytes += cf->can_dlc; + netif_receive_skb(skb); can_led_event(dev, CAN_LED_EVENT_RX); |