Commit ca6d2baf authored by Pan Bian's avatar Pan Bian Committed by Kleber Sacilotto de Souza

rapidio/rionet: do not free skb before reading its length

BugLink: https://bugs.launchpad.net/bugs/1811077

[ Upstream commit cfc43519 ]

skb is freed via dev_kfree_skb_any, however, skb->len is read then. This
may result in a use-after-free bug.

Fixes: e6161d64 ("rapidio/rionet: rework driver initialization and removal")
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 29444ba6
...@@ -215,9 +215,9 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -215,9 +215,9 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
* it just report sending a packet to the target * it just report sending a packet to the target
* (without actual packet transfer). * (without actual packet transfer).
*/ */
dev_kfree_skb_any(skb);
ndev->stats.tx_packets++; ndev->stats.tx_packets++;
ndev->stats.tx_bytes += skb->len; ndev->stats.tx_bytes += skb->len;
dev_kfree_skb_any(skb);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment