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-next>] [day] [month] [year] [list]
Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A01C85B55@SHSMSX103.ccr.corp.intel.com>
Date:	Mon, 9 Mar 2015 04:43:11 +0000
From:	"Du, Changbin" <changbin.du@...el.com>
To:	Tejun Heo <tj@...nel.org>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] workqueue: detect uninitated work_struct and BUG() if true

>From cdebb88ac0fb3f900ef28f28ccb4a12159c295db Mon Sep 17 00:00:00 2001
From: "Du, Changbin" <changbin.du@...il.com>
Date: Mon, 9 Mar 2015 12:06:43 +0800
Subject: [PATCH] workqueue: detect uninitated work_struct and BUG() if true

Recently I encounter a driver issue that caused by missing initializing
the work_struct. Then the work never get executed and stay in workqueue
forever. This take me some time to locate the error. This issue can be
seen early if detect it when queuing a work.

Signed-off-by: Du, Changbin <changbin.du@...el.com>
---
 kernel/workqueue.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f288493..5c1a5bc 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1295,6 +1295,9 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
 	 */
 	WARN_ON_ONCE(!irqs_disabled());
 
+	if (!work->func)
+		BUG();
+
 	debug_work_activate(work);
 
 	/* if draining, only works from the same workqueue are allowed */
-- 
1.9.1

--
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