]> Git Repo - linux.git/commitdiff
ovl: fix BUG_ON() in may_delete() when called from ovl_cleanup()
authorchenying <[email protected]>
Mon, 16 Aug 2021 10:02:56 +0000 (18:02 +0800)
committerMiklos Szeredi <[email protected]>
Tue, 17 Aug 2021 15:37:53 +0000 (17:37 +0200)
If function ovl_instantiate() returns an error, ovl_cleanup will be called
and try to remove newdentry from wdir, but the newdentry has been moved to
udir at this time.  This will causes BUG_ON(victim->d_parent->d_inode !=
dir) in fs/namei.c:may_delete.

Signed-off-by: chenying <[email protected]>
Fixes: 01b39dcc9568 ("ovl: use inode_insert5() to hash a newly created inode")
Link: https://lore.kernel.org/linux-unionfs/[email protected]/
Cc: <[email protected]> # v4.18
Signed-off-by: Miklos Szeredi <[email protected]>
fs/overlayfs/dir.c

index 9154222883e6432b61da112dd994d2ba050f8321..1fefb2b8960e94a8c9a7a1b81a5e70b83af4520f 100644 (file)
@@ -545,8 +545,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
                        goto out_cleanup;
        }
        err = ovl_instantiate(dentry, inode, newdentry, hardlink);
-       if (err)
-               goto out_cleanup;
+       if (err) {
+               ovl_cleanup(udir, newdentry);
+               dput(newdentry);
+       }
 out_dput:
        dput(upper);
 out_unlock:
This page took 0.054381 seconds and 4 git commands to generate.