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: <11902770982552-git-send-email-htejun@gmail.com>
Date:	Thu, 20 Sep 2007 17:31:38 +0900
From:	Tejun Heo <htejun@...il.com>
To:	ebiederm@...ssion.com, cornelia.huck@...ibm.com, greg@...ah.com,
	stern@...land.harvard.edu, kay.sievers@...y.org,
	linux-kernel@...r.kernel.org, htejun@...il.com
Cc:	Tejun Heo <htejun@...il.com>
Subject: [PATCH 4/8] sysfs: implement symlink auto-removal

When a sysfs_node is removed, automatically remove all symlinks
pointing to it together.

Note that as links created with kobject based sysfs_create_link()
aren't chained on its target, they aren't removed automatically.  This
is for backward compatibility.

Signed-off-by: Tejun Heo <htejun@...il.com>
---
 fs/sysfs/dir.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index bb9e87e..4a04cb4 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -956,6 +956,12 @@ void __sysfs_remove(struct sysfs_dirent *sd, int recurse)
 		    (sysfs_type(cur) == SYSFS_DIR || cur->s_parent != sd))
 			continue;
 
+		/* kill all symlinks pointing to @cur */
+		if (sysfs_type(cur) == SYSFS_DIR)
+			while (cur->s_dir.links)
+				sysfs_remove_one(&acxt, cur->s_dir.links);
+
+		/* kill @cur */
 		sysfs_remove_one(&acxt, cur);
 	} while ((cur = next));
 
-- 
1.5.0.3


-
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