Commit bffa9b1c authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Greg Kroah-Hartman

staging: dgnc: Fix a sleep-in-atomic-context bug in cls_assert_modem_signals()

The driver may sleep with holding a spinlock.
The function call path (from bottom to top) in Linux-4.17 is:

[FUNC] usleep_range
drivers/staging/dgnc/dgnc_cls.c, 391:
	usleep_range in cls_assert_modem_signals
drivers/staging/dgnc/dgnc_cls.c, 449:
	cls_assert_modem_signals in cls_copy_data_from_queue_to_uart
drivers/staging/dgnc/dgnc_cls.c, 406:
	_raw_spin_lock_irqsave in cls_copy_data_from_queue_to_uart

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

This bug is found by my static analysis tool DSAC.
Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2051c6ae
......@@ -388,7 +388,7 @@ static void cls_assert_modem_signals(struct channel_t *ch)
writeb(out, &ch->ch_cls_uart->mcr);
/* Give time for the UART to actually drop the signals */
usleep_range(10, 20);
udelay(20);
}
static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment