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: <1452170339-26748-4-git-send-email-wanghaibin.wang@huawei.com>
Date:	Thu, 7 Jan 2016 20:38:58 +0800
From:	wanghaibin <wanghaibin.wang@...wei.com>
To:	<linux-kernel@...r.kernel.org>
CC:	<tj@...nel.org>, <jiangshanlai@...il.com>,
	<peter.huangpeng@...wei.com>,
	wanghaibin <wanghaibin.wang@...wei.com>
Subject: [RFC PATCH 3/4] workqueue: remove the unbind workqueue attr sys_file before unregister the workqueue device

for workqueue's flag with the WQ_SYSFS | WQ_UNBOUND, the wq_dev will create some sys_files for
unbound attrs, so, remove the unbind workqueue attrs sys_files before unregister the
workqueue device.

Signed-off-by: wanghaibin <wanghaibin.wang@...wei.com>
---
 kernel/workqueue.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 60e192c..d6527dc 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5131,10 +5131,13 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
 
 	if (wq->flags & WQ_UNBOUND) {
 		struct device_attribute *attr;
+		int cnt = 0, i;
 
-		for (attr = wq_sysfs_unbound_attrs; attr->attr.name; attr++) {
+		for (attr = wq_sysfs_unbound_attrs; attr->attr.name; attr++, cnt++) {
 			ret = device_create_file(&wq_dev->dev, attr);
 			if (ret) {
+				for (attr = wq_sysfs_unbound_attrs, i = 0; i < cnt; attr++, i++)
+					device_remove_file(&wq_dev->dev, attr);
 				device_unregister(&wq_dev->dev);
 				wq->wq_dev = NULL;
 				return ret;
@@ -5160,6 +5163,11 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq)
 	if (!wq->wq_dev)
 		return;
 
+	if (wq->flags & WQ_UNBOUND) {
+		struct device_attribute *attr;
+		for (attr = wq_sysfs_unbound_attrs; attr->attr.name; attr++)
+			device_remove_file(&wq_dev->dev, attr);
+	}
 	wq->wq_dev = NULL;
 	device_unregister(&wq_dev->dev);
 }
-- 
1.8.3.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