diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c index b7cd65224d60..18894fdf048a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2170,16 +2170,19 @@ static long do_rmdir(int dfd, const char __user *pathname) | |||
2170 | return error; | 2170 | return error; |
2171 | 2171 | ||
2172 | switch(nd.last_type) { | 2172 | switch(nd.last_type) { |
2173 | case LAST_DOTDOT: | 2173 | case LAST_DOTDOT: |
2174 | error = -ENOTEMPTY; | 2174 | error = -ENOTEMPTY; |
2175 | goto exit1; | 2175 | goto exit1; |
2176 | case LAST_DOT: | 2176 | case LAST_DOT: |
2177 | error = -EINVAL; | 2177 | error = -EINVAL; |
2178 | goto exit1; | 2178 | goto exit1; |
2179 | case LAST_ROOT: | 2179 | case LAST_ROOT: |
2180 | error = -EBUSY; | 2180 | error = -EBUSY; |
2181 | goto exit1; | 2181 | goto exit1; |
2182 | } | 2182 | } |
2183 | |||
2184 | nd.flags &= ~LOOKUP_PARENT; | ||
2185 | |||
2183 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); | 2186 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); |
2184 | dentry = lookup_hash(&nd); | 2187 | dentry = lookup_hash(&nd); |
2185 | error = PTR_ERR(dentry); | 2188 | error = PTR_ERR(dentry); |
@@ -2257,6 +2260,9 @@ static long do_unlinkat(int dfd, const char __user *pathname) | |||
2257 | error = -EISDIR; | 2260 | error = -EISDIR; |
2258 | if (nd.last_type != LAST_NORM) | 2261 | if (nd.last_type != LAST_NORM) |
2259 | goto exit1; | 2262 | goto exit1; |
2263 | |||
2264 | nd.flags &= ~LOOKUP_PARENT; | ||
2265 | |||
2260 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); | 2266 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); |
2261 | dentry = lookup_hash(&nd); | 2267 | dentry = lookup_hash(&nd); |
2262 | error = PTR_ERR(dentry); | 2268 | error = PTR_ERR(dentry); |
@@ -2646,6 +2652,9 @@ asmlinkage long sys_renameat(int olddfd, const char __user *oldname, | |||
2646 | if (newnd.last_type != LAST_NORM) | 2652 | if (newnd.last_type != LAST_NORM) |
2647 | goto exit2; | 2653 | goto exit2; |
2648 | 2654 | ||
2655 | oldnd.flags &= ~LOOKUP_PARENT; | ||
2656 | newnd.flags &= ~LOOKUP_PARENT; | ||
2657 | |||
2649 | trap = lock_rename(new_dir, old_dir); | 2658 | trap = lock_rename(new_dir, old_dir); |
2650 | 2659 | ||
2651 | old_dentry = lookup_hash(&oldnd); | 2660 | old_dentry = lookup_hash(&oldnd); |