From fd494b5a4da5dc2e332b8b7480960509046c7b2e 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 --- diff --git a/fs/namei.c b/fs/namei.c index a52456c..404b61c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2003,8 +2003,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; + } } }