diff options
-rw-r--r-- | fs/namei.c | 2 | ||||
-rw-r--r-- | fs/open.c | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c index f7dbc06857ab..5362af9b7372 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1574,6 +1574,7 @@ static struct file *finish_open(struct nameidata *nd, | |||
1574 | */ | 1574 | */ |
1575 | if (will_truncate) | 1575 | if (will_truncate) |
1576 | mnt_drop_write(nd->path.mnt); | 1576 | mnt_drop_write(nd->path.mnt); |
1577 | path_put(&nd->path); | ||
1577 | return filp; | 1578 | return filp; |
1578 | 1579 | ||
1579 | exit: | 1580 | exit: |
@@ -1675,6 +1676,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1675 | } | 1676 | } |
1676 | filp = nameidata_to_filp(nd); | 1677 | filp = nameidata_to_filp(nd); |
1677 | mnt_drop_write(nd->path.mnt); | 1678 | mnt_drop_write(nd->path.mnt); |
1679 | path_put(&nd->path); | ||
1678 | if (!IS_ERR(filp)) { | 1680 | if (!IS_ERR(filp)) { |
1679 | error = ima_file_check(filp, acc_mode); | 1681 | error = ima_file_check(filp, acc_mode); |
1680 | if (error) { | 1682 | if (error) { |
@@ -786,11 +786,11 @@ struct file *nameidata_to_filp(struct nameidata *nd) | |||
786 | /* Pick up the filp from the open intent */ | 786 | /* Pick up the filp from the open intent */ |
787 | filp = nd->intent.open.file; | 787 | filp = nd->intent.open.file; |
788 | /* Has the filesystem initialised the file for us? */ | 788 | /* Has the filesystem initialised the file for us? */ |
789 | if (filp->f_path.dentry == NULL) | 789 | if (filp->f_path.dentry == NULL) { |
790 | path_get(&nd->path); | ||
790 | filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, | 791 | filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, |
791 | NULL, cred); | 792 | NULL, cred); |
792 | else | 793 | } |
793 | path_put(&nd->path); | ||
794 | return filp; | 794 | return filp; |
795 | } | 795 | } |
796 | 796 | ||