kernel: Fix potential refcount leak in su check
authorTom Marshall <tdm.code@gmail.com>
Fri, 19 May 2017 18:24:04 +0000 (18:24 +0000)
committerStricted <info@stricted.net>
Thu, 3 May 2018 16:46:03 +0000 (18:46 +0200)
Change-Id: I7e1ecb78bfc951bf645a1462988dcd93c4247a9b

fs/namei.c

index 36d4b29459ecb52a713c1cc3565e426a36e43c77..67d8ee787f0135acdaf4b509519e693858dec01a 100644 (file)
@@ -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;
+                       }
                }
        }