wil6210: use after free in wil_netif_rx_any()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 21 Sep 2019 06:01:45 +0000 (09:01 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 25 Sep 2019 06:12:20 +0000 (09:12 +0300)
The debug code dereferences "skb" to print "skb->len" so we have to
print the message before we free "skb".

Fixes: f99fe49ff372 ("wil6210: add wil_netif_rx() helper function")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wil6210/txrx.c

index cb13652491ad5546e766f6887798ff6cedefc9fc..598c1fba9dac41150f206dc1a3a5ad5d7fe27644 100644 (file)
@@ -1012,11 +1012,11 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
        skb_orphan(skb);
 
        if (security && (wil->txrx_ops.rx_crypto_check(wil, skb) != 0)) {
+               wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len);
                dev_kfree_skb(skb);
                ndev->stats.rx_dropped++;
                stats->rx_replay++;
                stats->rx_dropped++;
-               wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len);
                return;
        }