diff options
-rw-r--r-- | fs/namei.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c index b91e9732b24a..4ea63ed5e791 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1431,8 +1431,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir) | |||
1431 | * 3. We should have write and exec permissions on dir | 1431 | * 3. We should have write and exec permissions on dir |
1432 | * 4. We can't do it if dir is immutable (done in permission()) | 1432 | * 4. We can't do it if dir is immutable (done in permission()) |
1433 | */ | 1433 | */ |
1434 | static inline int may_create(struct inode *dir, struct dentry *child, | 1434 | static inline int may_create(struct inode *dir, struct dentry *child) |
1435 | struct nameidata *nd) | ||
1436 | { | 1435 | { |
1437 | if (child->d_inode) | 1436 | if (child->d_inode) |
1438 | return -EEXIST; | 1437 | return -EEXIST; |
@@ -1504,7 +1503,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2) | |||
1504 | int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | 1503 | int vfs_create(struct inode *dir, struct dentry *dentry, int mode, |
1505 | struct nameidata *nd) | 1504 | struct nameidata *nd) |
1506 | { | 1505 | { |
1507 | int error = may_create(dir, dentry, nd); | 1506 | int error = may_create(dir, dentry); |
1508 | 1507 | ||
1509 | if (error) | 1508 | if (error) |
1510 | return error; | 1509 | return error; |
@@ -1948,7 +1947,7 @@ EXPORT_SYMBOL_GPL(lookup_create); | |||
1948 | 1947 | ||
1949 | int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | 1948 | int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) |
1950 | { | 1949 | { |
1951 | int error = may_create(dir, dentry, NULL); | 1950 | int error = may_create(dir, dentry); |
1952 | 1951 | ||
1953 | if (error) | 1952 | if (error) |
1954 | return error; | 1953 | return error; |
@@ -2049,7 +2048,7 @@ asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev) | |||
2049 | 2048 | ||
2050 | int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 2049 | int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
2051 | { | 2050 | { |
2052 | int error = may_create(dir, dentry, NULL); | 2051 | int error = may_create(dir, dentry); |
2053 | 2052 | ||
2054 | if (error) | 2053 | if (error) |
2055 | return error; | 2054 | return error; |
@@ -2316,7 +2315,7 @@ asmlinkage long sys_unlink(const char __user *pathname) | |||
2316 | 2315 | ||
2317 | int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) | 2316 | int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) |
2318 | { | 2317 | { |
2319 | int error = may_create(dir, dentry, NULL); | 2318 | int error = may_create(dir, dentry); |
2320 | 2319 | ||
2321 | if (error) | 2320 | if (error) |
2322 | return error; | 2321 | return error; |
@@ -2386,7 +2385,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
2386 | if (!inode) | 2385 | if (!inode) |
2387 | return -ENOENT; | 2386 | return -ENOENT; |
2388 | 2387 | ||
2389 | error = may_create(dir, new_dentry, NULL); | 2388 | error = may_create(dir, new_dentry); |
2390 | if (error) | 2389 | if (error) |
2391 | return error; | 2390 | return error; |
2392 | 2391 | ||
@@ -2595,7 +2594,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
2595 | return error; | 2594 | return error; |
2596 | 2595 | ||
2597 | if (!new_dentry->d_inode) | 2596 | if (!new_dentry->d_inode) |
2598 | error = may_create(new_dir, new_dentry, NULL); | 2597 | error = may_create(new_dir, new_dentry); |
2599 | else | 2598 | else |
2600 | error = may_delete(new_dir, new_dentry, is_dir); | 2599 | error = may_delete(new_dir, new_dentry, is_dir); |
2601 | if (error) | 2600 | if (error) |