Skip to contentSkip to conversation

ovl: fix error handling in ovl_verify_set_fh()

PATCH New Amir Goldstein 1 participant 1 message Oct 10, 2018 Overlay filesystem

lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH 1/1 ovl: fix error handling in ovl_verify_set_fh()

We hit a BUG on kfree of an ERR_PTR()...

Reported-by [email protected]
Fixes 8b88a2e64036 ("ovl: verify upper root dir matches lower root dir")
Cc <[email protected]> # v4.13
---
 fs/overlayfs/namei.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/overlayfs/namei.c +3 -1
index 9c0ca6a7becf..efd372312ef1 100644
@@ -422,8 +422,10 @@ int ovl_verify_set_fh(struct dentry *dentry, const char *name,
 
 	fh = ovl_encode_real_fh(real, is_upper);
 	err = PTR_ERR(fh);
-	if (IS_ERR(fh))
+	if (IS_ERR(fh)) {
+		fh = NULL;
 		goto fail;
+	}
 
 	err = ovl_verify_fh(dentry, name, fh);
 	if (set && err == -ENODATA)
Signature · 1 line
2.17.1