[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1513161974-15610-1-git-send-email-baijiaju1990@gmail.com>
Date: Wed, 13 Dec 2017 18:46:14 +0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: nicolas.ferre@...rochip.com, rafalo@...ence.com, bfolta@...ence.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] macb: Fix a possible sleep-in-atomic bug in macb_tx_error_task
The driver may sleep under a spinlock.
The function call path is:
macb_tx_error_task (acquire the spinlock)
macb_halt_tx
usleep_range --> may sleep
To fix it, usleep_range is replaced with udelay.
This bug is found by my static analysis tool(DSAC) and checked by my code review.
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
drivers/net/ethernet/cadence/macb_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 72a67f7..b02c806 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -645,7 +645,7 @@ static int macb_halt_tx(struct macb *bp)
if (!(status & MACB_BIT(TGO)))
return 0;
- usleep_range(10, 250);
+ udelay(250);
} while (time_before(halt_time, timeout));
return -ETIMEDOUT;
--
1.7.9.5
Powered by blists - more mailing lists