]> git.baikalelectronics.ru Git - kernel.git/commit
net: cadence: Fix a sleep-in-atomic-context bug in macb_halt_tx()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Sat, 1 Sep 2018 12:11:05 +0000 (20:11 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 2 Sep 2018 23:05:25 +0000 (16:05 -0700)
commit3ab7f19d55f474a477019301839a8748a57f9087
treedc652a85653af60c212ca20262c6d01e092a946d
parent04aed8f4f6b9a26b22605461686c7004f2cb743c
net: cadence: Fix a sleep-in-atomic-context bug in macb_halt_tx()

The kernel module may sleep with holding a spinlock.

The function call paths (from bottom to top) in Linux-4.16 are:

[FUNC] usleep_range
drivers/net/ethernet/cadence/macb_main.c, 648:
usleep_range in macb_halt_tx
drivers/net/ethernet/cadence/macb_main.c, 730:
macb_halt_tx in macb_tx_error_task
drivers/net/ethernet/cadence/macb_main.c, 721:
_raw_spin_lock_irqsave in macb_tx_error_task

To fix this bug, usleep_range() is replaced with udelay().

This bug is found by my static analysis tool DSAC.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb_main.c