Skip to content

Commit

Permalink
rapidio/rionet: do not free skb before reading its length
Browse files Browse the repository at this point in the history
[ Upstream commit cfc4351 ]

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

Fixes: e6161d6 ("rapidio/rionet: rework driver initialization and removal")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
SinkFinder authored and gregkh committed Dec 5, 2018
1 parent d39ebd1 commit 13a3d89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/rionet.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
* it just report sending a packet to the target
* (without actual packet transfer).
*/
dev_kfree_skb_any(skb);
ndev->stats.tx_packets++;
ndev->stats.tx_bytes += skb->len;
dev_kfree_skb_any(skb);
}
}

Expand Down

0 comments on commit 13a3d89

Please sign in to comment.