diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index a1f8bbbd58e5..89ef3178eaaa 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2190,7 +2190,12 @@ static long do_rmdir(int dfd, const char __user *pathname) | |||
2190 | error = PTR_ERR(dentry); | 2190 | error = PTR_ERR(dentry); |
2191 | if (IS_ERR(dentry)) | 2191 | if (IS_ERR(dentry)) |
2192 | goto exit2; | 2192 | goto exit2; |
2193 | error = mnt_want_write(nd.path.mnt); | ||
2194 | if (error) | ||
2195 | goto exit3; | ||
2193 | error = vfs_rmdir(nd.path.dentry->d_inode, dentry); | 2196 | error = vfs_rmdir(nd.path.dentry->d_inode, dentry); |
2197 | mnt_drop_write(nd.path.mnt); | ||
2198 | exit3: | ||
2194 | dput(dentry); | 2199 | dput(dentry); |
2195 | exit2: | 2200 | exit2: |
2196 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 2201 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); |
@@ -2271,7 +2276,11 @@ static long do_unlinkat(int dfd, const char __user *pathname) | |||
2271 | inode = dentry->d_inode; | 2276 | inode = dentry->d_inode; |
2272 | if (inode) | 2277 | if (inode) |
2273 | atomic_inc(&inode->i_count); | 2278 | atomic_inc(&inode->i_count); |
2279 | error = mnt_want_write(nd.path.mnt); | ||
2280 | if (error) | ||
2281 | goto exit2; | ||
2274 | error = vfs_unlink(nd.path.dentry->d_inode, dentry); | 2282 | error = vfs_unlink(nd.path.dentry->d_inode, dentry); |
2283 | mnt_drop_write(nd.path.mnt); | ||
2275 | exit2: | 2284 | exit2: |
2276 | dput(dentry); | 2285 | dput(dentry); |
2277 | } | 2286 | } |