can: at91_can: don't touch skb after netif_receive_skb()/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. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
50c2e4dd67
commit
6ae3673deb
@ -577,10 +577,10 @@ static void at91_rx_overflow_err(struct net_device *dev)
|
||||
|
||||
cf->can_id |= CAN_ERR_CRTL;
|
||||
cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
|
||||
netif_receive_skb(skb);
|
||||
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes += cf->can_dlc;
|
||||
netif_receive_skb(skb);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -642,10 +642,10 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb)
|
||||
}
|
||||
|
||||
at91_read_mb(dev, mb, 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);
|
||||
}
|
||||
@ -802,10 +802,10 @@ static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr)
|
||||
return 0;
|
||||
|
||||
at91_poll_err_frame(dev, cf, reg_sr);
|
||||
netif_receive_skb(skb);
|
||||
|
||||
dev->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += cf->can_dlc;
|
||||
netif_receive_skb(skb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1067,10 +1067,10 @@ static void at91_irq_err(struct net_device *dev)
|
||||
return;
|
||||
|
||||
at91_irq_err_state(dev, cf, new_state);
|
||||
netif_rx(skb);
|
||||
|
||||
dev->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += cf->can_dlc;
|
||||
netif_rx(skb);
|
||||
|
||||
priv->can.state = new_state;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user