From 0f29566b5fad388cc4a07402f9651d86f1fe2b45 Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Fri, 19 May 2017 18:24:49 +0000 Subject: [PATCH] kernel: Fix potential refcount leak in su check Change-Id: I3d241ae805ba708c18bccfd5e5d6cdcc8a5bc1c8 --- diff --git a/fs/namei.c b/fs/namei.c index 414fc51..689339e 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1803,8 +1803,10 @@ 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; + } } }