Skip to content

Commit

Permalink
net: ethernet: dnet: don't call dev_kfree_skb() under spin_lock_irqsa…
Browse files Browse the repository at this point in the history
…ve()

[ Upstream commit f07fadc ]

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: 4796417 ("dnet: Dave DNET ethernet controller driver (updated)")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Dec 31, 2022
1 parent 2a979f0 commit 4bc7616
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/dnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 4bc7616

Please sign in to comment.