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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1435324873-18318-6-git-send-email-abbotti@mev.co.uk>
Date:	Fri, 26 Jun 2015 14:21:13 +0100
From:	Ian Abbott <abbotti@....co.uk>
To:	linux-watchdog@...r.kernel.org
Cc:	Wim Van Sebroeck <wim@...ana.be>, linux-kernel@...r.kernel.org,
	Ian Abbott <abbotti@....co.uk>
Subject: [PATCH 5/5] watchdog: dw_wdt: unqueue timer synchronously on unexpected close

The driver normally calls the timer function `dw_wdt_ping()` every half
a second to pat the dog while it is not in use, and while waiting for
the next heartbeat from the user that opened the device.  If the
watchdog device's "release" file operation determines that the watchdog
device is being closed unexpectedly, it calls `del_timer()` to remove
the timer from the queue and thus stop patting the dog.  However, since
the timer function re-queues the timer, there is a race condition on SMP
systems which could leave the timer re-queueing itself when it
shouldn't.  To prevent that, call `del_timer_sync()` instead of
`del_timer()`.

Signed-off-by: Ian Abbott <abbotti@....co.uk>
---
 drivers/watchdog/dw_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index daab90b..bf617e3 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -281,7 +281,7 @@ static int dw_wdt_release(struct inode *inode, struct file *filp)
 	clear_bit(DW_WDT_IN_USE, &dw_wdt.state);
 
 	if (!dw_wdt.expect_close) {
-		del_timer(&dw_wdt.timer);
+		del_timer_sync(&dw_wdt.timer);
 
 		if (!nowayout)
 			pr_crit("unexpected close, system will reboot soon\n");
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ