]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
rapidio/rionet: do not free skb before reading its length
authorPan Bian <bianpan2016@163.com>
Wed, 28 Nov 2018 06:53:19 +0000 (14:53 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Nov 2018 18:38:48 +0000 (10:38 -0800)
skb is freed via dev_kfree_skb_any, however, skb->len is read then. This
may result in a use-after-free bug.

Fixes: e6161d64263 ("rapidio/rionet: rework driver initialization and removal")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/rionet.c

index e9f101c9bae2ce1d9bde5dbe0d473119ead760e6..bfbb39f935545794c151c18de29655a574fd8bcd 100644 (file)
@@ -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);
                }
        }