aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTom Marshall <tdm.code@gmail.com>2017-05-19 18:24:49 +0000
committerMoyster <oysterized@gmail.com>2017-05-22 11:07:15 +0200
commit6a9e759bc3668b3a52d596b2b02e8fc45a6c809c (patch)
treef8648f3dd28e98bbb8d5b62db32a4b00a3bc549e /fs
parent59bc76e7102d397fbe72e93e7fca2fa572df0bb8 (diff)
kernel: Fix potential refcount leak in su check
Change-Id: I3d241ae805ba708c18bccfd5e5d6cdcc8a5bc1c8 Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 7a862237b..aaf0b0260 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2029,8 +2029,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;
+ }
}
}