kernel: Fix potential refcount leak in su check

Change-Id: I8d2c8bed65a01eb0928308df638a04449a5bd881
This commit is contained in:
Tom Marshall 2017-05-18 23:50:22 +00:00 committed by codeworkx
parent e76227950e
commit 030f585c4e

View file

@ -2168,8 +2168,10 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path
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;
}
}
}