diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index 3fbcf2021a2e..00df735fb509 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2387,7 +2387,12 @@ asmlinkage long sys_symlinkat(const char __user *oldname, | |||
2387 | if (IS_ERR(dentry)) | 2387 | if (IS_ERR(dentry)) |
2388 | goto out_unlock; | 2388 | goto out_unlock; |
2389 | 2389 | ||
2390 | error = mnt_want_write(nd.path.mnt); | ||
2391 | if (error) | ||
2392 | goto out_dput; | ||
2390 | error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO); | 2393 | error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO); |
2394 | mnt_drop_write(nd.path.mnt); | ||
2395 | out_dput: | ||
2391 | dput(dentry); | 2396 | dput(dentry); |
2392 | out_unlock: | 2397 | out_unlock: |
2393 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 2398 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); |
@@ -2482,7 +2487,12 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname, | |||
2482 | error = PTR_ERR(new_dentry); | 2487 | error = PTR_ERR(new_dentry); |
2483 | if (IS_ERR(new_dentry)) | 2488 | if (IS_ERR(new_dentry)) |
2484 | goto out_unlock; | 2489 | goto out_unlock; |
2490 | error = mnt_want_write(nd.path.mnt); | ||
2491 | if (error) | ||
2492 | goto out_dput; | ||
2485 | error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode, new_dentry); | 2493 | error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode, new_dentry); |
2494 | mnt_drop_write(nd.path.mnt); | ||
2495 | out_dput: | ||
2486 | dput(new_dentry); | 2496 | dput(new_dentry); |
2487 | out_unlock: | 2497 | out_unlock: |
2488 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 2498 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); |