From: Tom Marshall <tdm.code@gmail.com>
Date: Fri, 19 May 2017 18:24:04 +0000 (+0000)
Subject: kernel: Fix potential refcount leak in su check
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=05e290dfc996b8a139ee66730330afcba635c6ed;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git

kernel: Fix potential refcount leak in su check

Change-Id: I7e1ecb78bfc951bf645a1462988dcd93c4247a9b
---

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;
+			}
 		}
 	}