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]
Date:	Wed, 15 May 2013 14:13:14 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Tejun Heo <tj@...nel.org>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] kernel/workqueue.c: need call device_remove_file() when failure
 occurs after called device_create_file()


In workqueue_sysfs_register(), when failure occurs after called
device_create_file(), need call device_remove_file() to release the
related resources, then call device_unregister().

Or it will cause issue.

For individual 'device_attributs' (just like our case), need call
device_remove_file() explictly and then call device_unregister(),
please reference drivers/base/*.c (e.g node.c or cpu.c).


Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
 kernel/workqueue.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 1ae6028..de11dae 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3323,6 +3323,8 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
 		for (attr = wq_sysfs_unbound_attrs; attr->attr.name; attr++) {
 			ret = device_create_file(&wq_dev->dev, attr);
 			if (ret) {
+				while (--attr >= wq_sysfs_unbound_attrs)
+					device_remove_file(&wq_dev->dev, attr);
 				device_unregister(&wq_dev->dev);
 				wq->wq_dev = NULL;
 				return ret;
-- 
1.7.7.6
--
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