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: <1265002505-8387-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Date:	Mon,  1 Feb 2010 11:04:44 +0530
From:	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To:	sfrench@...ibm.com, ffilz@...ibm.com, agruen@...e.de,
	adilger@....com, sandeen@...hat.com, tytso@....edu,
	staubach@...hat.com, bfields@...i.umich.edu, jlayton@...hat.com
Cc:	aneesh.kumar@...ux.vnet.ibm.com, linux-fsdevel@...r.kernel.org,
	nfsv4@...ux-nfs.org, linux-ext4@...r.kernel.org
Subject: [PATCH 02/23] vfs: Check for create permission during rename

If the new dentry is already present we were just checking
for the delete permission. We also need to check after
deletion whether we are allowed to create new name. This
is needed in case of a acl model that differentiate between
delete and create permission like NFSv4acl

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
---
 fs/namei.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 3e842ac..2a1a1d6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1380,12 +1380,11 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
  *  3. We should have write and exec permissions on dir
  *  4. We can't do it if dir is immutable (done in permission())
  */
-static inline int may_create(struct inode *dir, struct dentry *child, int isdir)
+static inline int _do_may_create(struct inode *dir,
+				struct dentry *child, int isdir)
 {
 	int error;
 
-	if (child->d_inode)
-		return -EEXIST;
 	if (IS_DEADDIR(dir))
 		return -ENOENT;
 	if (dir->i_op->may_create) {
@@ -1403,6 +1402,13 @@ static inline int may_create(struct inode *dir, struct dentry *child, int isdir)
 	return error;
 }
 
+static inline int may_create(struct inode *dir, struct dentry *child, int isdir)
+{
+	if (child->d_inode)
+		return -EEXIST;
+	return _do_may_create(dir, child, isdir);
+}
+
 /* 
  * O_DIRECTORY translates into forcing a directory lookup.
  */
@@ -2673,8 +2679,12 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 	if (!new_dentry->d_inode)
 		error = may_create(new_dir, new_dentry, is_dir);
-	else
+	else {
 		error = may_delete(new_dir, new_dentry, is_dir);
+		if (error)
+			return error;
+		error = _do_may_create(new_dir, new_dentry, is_dir);
+	}
 	if (error)
 		return error;
 
-- 
1.7.0.rc0.48.gdace5

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ