aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index b753192d8c3..7d77f24d32a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1272,8 +1272,10 @@ done:
path->mnt = mnt;
path->dentry = dentry;
err = follow_managed(path, nd->flags);
- if (unlikely(err < 0))
+ if (unlikely(err < 0)) {
+ path_put_conditional(path, nd);
return err;
+ }
*inode = path->dentry->d_inode;
return 0;