lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20180915031303.5302-1-baijiaju1990@gmail.com>
Date:   Sat, 15 Sep 2018 11:13:03 +0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     lidza.louina@...il.com, markh@...pro.net,
        gregkh@...uxfoundation.org
Cc:     driverdev-devel@...uxdriverproject.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] 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: Jia-Ju Bai <baijiaju1990@...il.com>
---
 drivers/staging/dgnc/dgnc_cls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 7e6cbfe4e4ee..a1e98ee7f9e0 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -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)
-- 
2.17.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ