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:	Sat, 23 May 2009 13:13:11 -0700
From:	"Eric W. Biederman" <ebiederm@...ssion.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Greg Kroah-Hartman <gregkh@...e.de>
Cc:	<linux-kernel@...r.kernel.org>, Tejun Heo <tj@...nel.org>,
	Cornelia Huck <cornelia.huck@...ibm.com>,
	<linux-fsdevel@...r.kernel.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	"Eric W. Biederman" <ebiederm@...stanetworks.com>
Subject: [PATCH 25/20] sysfs:  Only support removing emtpy sysfs directories.

From: Eric W. Biederman <ebiederm@...ssion.com>

I have looked and I have not found a single legitimate case today where
we remove sysfs directories with anything in them.  The only case I have
found to date was a bug.  It was a problem of ownership.  The files in
the directory where not owned by the directory itself.   Leaving open
the potential for double deletion of the directory contents.

Signed-off-by: Eric W. Biederman <ebiederm@...stanetworks.com>
---
 fs/sysfs/dir.c |   24 ++++--------------------
 1 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index b3058f5..6b3e038 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -617,30 +617,14 @@ const struct inode_operations sysfs_dir_inode_operations = {
 	.permission	= sysfs_permission,
 };
 
-static struct sysfs_dirent *sysfs_get_one(struct sysfs_dirent *dir_sd)
-{
-	struct sysfs_dirent *sd = dir_sd;
-	mutex_lock(&sysfs_mutex);
-	while ((sysfs_type(sd) == SYSFS_DIR) && sd->s_dir.children)
-		sd = sd->s_dir.children;
-	if (sd != dir_sd)
-		sysfs_get(sd);
-	else
-		sd = NULL;
-	mutex_unlock(&sysfs_mutex);
-	return sd;
-}
-
 static void remove_dir(struct sysfs_dirent *dir_sd)
 {
-	struct sysfs_dirent *sd;
-
 	pr_debug("sysfs %s: removing dir\n", dir_sd->s_name);
 
-	while ((sd = sysfs_get_one(dir_sd))) {
-		sysfs_remove_one(sd);
-		sysfs_put(sd);
-	}
+	WARN(dir_sd->s_dir.children,
+		KERN_WARNING "sysfs: removing non-empty dir: %s\n",
+		dir_sd->s_name);
+
 	sysfs_remove_one(dir_sd);
 }
 
-- 
1.6.3.1.54.g99dd.dirty

--
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