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: <20250324090748.753195-1-ye.liu@linux.dev>
Date: Mon, 24 Mar 2025 17:07:48 +0800
From: Ye Liu <ye.liu@...ux.dev>
To: tj@...nel.org
Cc: jiangshanlai@...il.com,
	linux-kernel@...r.kernel.org,
	Ye Liu <liuye@...inos.cn>
Subject: [PATCH] workqueue: Fix incorrect error return value in apply_workqueue_attrs_locked

From: Ye Liu <liuye@...inos.cn>

Commit 84193c07105c ("workqueue: Generalize unbound CPU pods") introduced
a change that caused apply_workqueue_attrs_locked() to return error
pointers using PTR_ERR() on failure instead of a negative error code.
This caused unexpected behavior in functions that rely on the return value
of apply_workqueue_attrs_locked, such as alloc_and_link_pwqs().

Specifically, alloc_and_link_pwqs() expects apply_workqueue_attrs_locked()
to return 0 on success and a negative error code on failure. However,
returning PTR_ERR(ctx) instead of -ENOMEM led to incorrect error handling
in __alloc_workqueue, potentially causing system instability or crashes.

This patch ensures apply_workqueue_attrs_locked() returns a proper negative
error code (-ENOMEM) in case of failure, restoring expected behavior.

Fixes: 84193c07105c ("workqueue: Generalize unbound CPU pods")
Signed-off-by: Ye Liu <liuye@...inos.cn>
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index bfe030b443e2..8ba679d9b566 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5363,7 +5363,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
 
 	ctx = apply_wqattrs_prepare(wq, attrs, wq_unbound_cpumask);
 	if (IS_ERR(ctx))
-		return PTR_ERR(ctx);
+		return -ENOMEM;
 
 	/* the ctx has been prepared successfully, let's commit it */
 	apply_wqattrs_commit(ctx);
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ