net: ethernet: dnet: don't call dev_kfree_skb() under spin_lock_irqsave()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 8 Dec 2022 14:21:45 +0000 (22:21 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Dec 2022 09:56:17 +0000 (09:56 +0000)
It is not allowed to call kfree_skb() or consume_skb() from hardware
interrupt context or with hardware interrupts being disabled.

In this case, the lock is used to protected 'bp', so we can move
dev_kfree_skb() after the spin_unlock_irqrestore().

Fixes: 4796417417a6 ("dnet: Dave DNET ethernet controller driver (updated)")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/dnet.c

index 08184f2..151ca95 100644 (file)
@@ -550,11 +550,11 @@ static netdev_tx_t dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        skb_tx_timestamp(skb);
 
+       spin_unlock_irqrestore(&bp->lock, flags);
+
        /* free the buffer */
        dev_kfree_skb(skb);
 
-       spin_unlock_irqrestore(&bp->lock, flags);
-
        return NETDEV_TX_OK;
 }