From 05e290dfc996b8a139ee66730330afcba635c6ed Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Fri, 19 May 2017 18:24:04 +0000 Subject: [PATCH] kernel: Fix potential refcount leak in su check Change-Id: I7e1ecb78bfc951bf645a1462988dcd93c4247a9b --- fs/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 36d4b29459ec..67d8ee787f01 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2012,8 +2012,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; + } } } -- 2.20.1