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] [day] [month] [year] [list]
Message-Id: <1345809097-854-2-git-send-email-clouds.yan@gmail.com>
Date:	Fri, 24 Aug 2012 19:51:37 +0800
From:	yan <clouds.yan@...il.com>
To:	viro@...iv.linux.org.uk
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] fs/namei.c: only check mountpoint on non-negative dentry


Signed-off-by: yan <clouds.yan@...il.com>
---
 fs/namei.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index dd1ed1b..028f5c8 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3628,11 +3628,15 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
 		return error;
 
 	dget(new_dentry);
-	if (target)
-		mutex_lock(&target->i_mutex);
 
 	error = -EBUSY;
-	if (d_mountpoint(old_dentry) || d_mountpoint(new_dentry))
+	if (target){
+		mutex_lock(&target->i_mutex);
+		if (d_mountpoint(new_dentry))
+			goto out;
+	}
+
+	if (d_mountpoint(old_dentry))
 		goto out;
 
 	error = -EMLINK;
@@ -3671,11 +3675,15 @@ static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
 		return error;
 
 	dget(new_dentry);
-	if (target)
-		mutex_lock(&target->i_mutex);
 
 	error = -EBUSY;
-	if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
+	if (target){
+		mutex_lock(&target->i_mutex);
+		if (d_mountpoint(new_dentry))
+			goto out;
+	}
+
+	if (d_mountpoint(old_dentry))
 		goto out;
 
 	error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
-- 
1.7.9.5

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