[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-unionfs
Subject:    [PATCH 3/4] ovl: fix dput() of ERR_PTR in ovl_cleanup_index()
From:       Amir Goldstein <amir73il () gmail ! com>
Date:       2017-09-25 9:36:20
Message-ID: 1506332181-19319-4-git-send-email-amir73il () gmail ! com
[Download RAW message or body]

Fixes: caf70cb2ba5d ("ovl: cleanup orphan index entries")
Cc: <stable@vger.kernel.org> # v4.13
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/overlayfs/util.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 117794582f9f..a1bf81d352b4 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -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;
@@ -466,9 +466,12 @@ static void ovl_cleanup_index(struct dentry *dentry)
 	inode_lock_nested(dir, I_MUTEX_PARENT);
 	/* TODO: whiteout instead of cleanup to block future open by handle */
 	index = lookup_one_len(name.name, ovl_indexdir(dentry->d_sb), name.len);
-	err = PTR_ERR(index);
-	if (!IS_ERR(index))
+	if (!IS_ERR(index)) {
 		err = ovl_cleanup(dir, index);
+	} else {
+		err = PTR_ERR(index);
+		index = NULL;
+	}
 	inode_unlock(dir);
 	if (err)
 		goto fail;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic