From cf8656e992e8c1f9417fae91ed389628e8686046 Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Thu, 18 May 2017 23:50:22 +0000 Subject: kernel: Fix potential refcount leak in su check Change-Id: I8d2c8bed65a01eb0928308df638a04449a5bd881 --- fs/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index c202c8d..e0957f2 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1626,8 +1626,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; + } } } -- cgit v1.1