aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Marshall <tdm.code@gmail.com>2017-05-19 18:24:49 +0000
committerTom Marshall <tdm.code@gmail.com>2017-05-19 18:24:49 +0000
commit0f29566b5fad388cc4a07402f9651d86f1fe2b45 (patch)
tree8cc2ab1b9fd0ba920e7758bd30f57d0f1f2aaaa7
parent219f6fcfed505aa4bd5cb0d4e6bf781b19de1c86 (diff)
kernel: Fix potential refcount leak in su check
Change-Id: I3d241ae805ba708c18bccfd5e5d6cdcc8a5bc1c8
-rw-r--r--fs/namei.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 414fc517890..689339e3e7e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1803,8 +1803,10 @@ static int path_lookupat(int dfd, const char *name,
if (!err) {
struct super_block *sb = nd->inode->i_sb;
if (sb->s_flags & MS_RDONLY) {
- if (d_is_su(nd->path.dentry) && !su_visible())
+ if (d_is_su(nd->path.dentry) && !su_visible()) {
+ path_put(&nd->path);
err = -ENOENT;
+ }
}
}