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  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]
Date:   Sun, 5 Jul 2020 09:30:18 +0800
From:   <qiang.zhang@...driver.com>
To:     <ben.dooks@...ethink.co.uk>, <bfields@...hat.com>,
        <cl@...k-chips.com>, <peterz@...radead.org>, <pmladek@...e.com>,
        <tj@...nel.org>
CC:     <akpm@...ux-foundation.org>, <mm-commits@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH v3] kthread: Work could not be queued when worker being destroyed

From: Zhang Qiang <qiang.zhang@...driver.com>

Before the work is put into the queue of the worker thread,
the state of the worker thread needs to be detected,because
the worker thread may be in the destruction state at this time.

Signed-off-by: Zhang Qiang <qiang.zhang@...driver.com>
Suggested-by: Petr Mladek <pmladek@...e.com>
Reviewed-by: Petr Mladek <pmladek@...e.com>
---
 v1->v2:
 Add warning information for condition "!worker->task".
 v2->v3:
 Modify submission information and add "Reviewed-by" tags. 

 kernel/kthread.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index bfbfa481be3a..cac5184ffd86 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -791,6 +791,9 @@ static inline bool queuing_blocked(struct kthread_worker *worker,
 {
 	lockdep_assert_held(&worker->lock);
 
+	if (WARN_ON(!worker->task))
+		return true;
+
 	return !list_empty(&work->node) || work->canceling;
 }
 
-- 
2.24.1

Powered by blists - more mailing lists