Skip to contentSkip to conversation

fs: move permission check back into __lookup_hash

PATCH New Christoph Hellwig 1 participant 1 message Oct 6, 2010 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: move permission check back into __lookup_hash

The caller that didn't need it is gone.

fs/namei.c +4 -10
Index: linux-2.6/fs/namei.c
===================================================================
@@ -1121,11 +1121,13 @@ int vfs_path_lookup(struct dentry *dentr
 static struct dentry *__lookup_hash(struct qstr *name,
 		struct dentry *base, struct nameidata *nd)
 {
+	struct inode *inode = base->d_inode;
 	struct dentry *dentry;
-	struct inode *inode;
 	int err;
 
-	inode = base->d_inode;
+	err = exec_permission(inode);
+	if (err)
+		return ERR_PTR(err);
 
 	/*
 	 * See if the low-level filesystem might want
@@ -1161,11 +1159,6 @@ out:
  */
 static struct dentry *lookup_hash(struct nameidata *nd)
 {
-	int err;
-
-	err = exec_permission(nd->path.dentry->d_inode);
-	if (err)
-		return ERR_PTR(err);
 	return __lookup_hash(&nd->last, nd->path.dentry, nd);
 }
 
@@ -1213,9 +1206,6 @@ struct dentry *lookup_one_len(const char
 	if (err)
 		return ERR_PTR(err);
 
-	err = exec_permission(base->d_inode);
-	if (err)
-		return ERR_PTR(err);
 	return __lookup_hash(&this, base, NULL);
 }