Message ID | 20210120125202.2187358-2-mkl@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 03f16c5075b22c8902d2af739969e878b0879c94 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,1/3] can: dev: can_restart: fix use after free bug | expand |
Context | Check | Description |
---|---|---|
netdev/apply | success | Patch already applied to net |
netdev/tree_selection | success | Clearly marked for net |
Hello: This series was applied to netdev/net-next.git (refs/heads/master): On Wed, 20 Jan 2021 13:52:00 +0100 you wrote: > From: Vincent Mailhol <mailhol.vincent@wanadoo.fr> > > After calling netif_rx_ni(skb), dereferencing skb is unsafe. > Especially, the can_frame cf which aliases skb memory is accessed > after the netif_rx_ni() in: > stats->rx_bytes += cf->len; > > [...] Here is the summary with links: - [net,1/3] can: dev: can_restart: fix use after free bug https://git.kernel.org/netdev/net-next/c/03f16c5075b2 - [net,2/3] can: vxcan: vxcan_xmit: fix use after free bug https://git.kernel.org/netdev/net-next/c/75854cad5d80 - [net,3/3] can: peak_usb: fix use after free bugs https://git.kernel.org/netdev/net-next/c/50aca891d7a5 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 3486704c8a95..8b1ae023cb21 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -592,11 +592,11 @@ static void can_restart(struct net_device *dev) cf->can_id |= CAN_ERR_RESTARTED; - netif_rx_ni(skb); - stats->rx_packets++; stats->rx_bytes += cf->len; + netif_rx_ni(skb); + restart: netdev_dbg(dev, "restarted\n"); priv->can_stats.restarts++;