[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1398615293-22931-5-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Date: Sun, 27 Apr 2014 21:44:35 +0530
From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To: agruen@...nel.org, bfields@...ldses.org, akpm@...ux-foundation.org,
viro@...iv.linux.org.uk, dhowells@...hat.com
Cc: aneesh.kumar@...ux.vnet.ibm.com, linux-fsdevel@...r.kernel.org,
linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH -V1 04/22] vfs: check for directory early
From: Andreas Gruenbacher <agruen@...nel.org>
Signed-off-by: Andreas Gruenbacher <agruen@...nel.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
---
fs/namei.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index c7fee619691f..7d93d195f0e5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3868,6 +3868,9 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
if (!inode)
return -ENOENT;
+ if (S_ISDIR(inode->i_mode))
+ return -EPERM;
+
error = may_create(dir, new_dentry);
if (error)
return error;
@@ -3882,8 +3885,6 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
return -EPERM;
if (!dir->i_op->link)
return -EPERM;
- if (S_ISDIR(inode->i_mode))
- return -EPERM;
error = security_inode_link(old_dentry, dir, new_dentry);
if (error)
--
1.9.1
--
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