ovl: fix dput() of ERR_PTR in ovl_cleanup_index()
authorAmir Goldstein <amir73il@gmail.com>
Sun, 24 Sep 2017 14:36:26 +0000 (17:36 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 5 Oct 2017 13:53:18 +0000 (15:53 +0200)
Fixes: caf70cb2ba5d ("ovl: cleanup orphan index entries")
Cc: <stable@vger.kernel.org> # v4.13
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/util.c

index 117794582f9fa597d34d8843aa8bdfb7a99cbe76..7ae33d225a67c74cdffb44ffb5cf824e8ee5ff05 100644 (file)
@@ -430,7 +430,7 @@ void ovl_inuse_unlock(struct dentry *dentry)
        }
 }
 
-/* Called must hold OVL_I(inode)->oi_lock */
+/* Caller must hold OVL_I(inode)->lock */
 static void ovl_cleanup_index(struct dentry *dentry)
 {
        struct inode *dir = ovl_indexdir(dentry->d_sb)->d_inode;
@@ -469,6 +469,9 @@ static void ovl_cleanup_index(struct dentry *dentry)
        err = PTR_ERR(index);
        if (!IS_ERR(index))
                err = ovl_cleanup(dir, index);
+       else
+               index = NULL;
+
        inode_unlock(dir);
        if (err)
                goto fail;