Skip to content

Commit 52d5a0c

Browse files
chenyingkMiklos Szeredi
authored andcommitted
ovl: fix BUG_ON() in may_delete() when called from ovl_cleanup()
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: 01b39dc ("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]>
1 parent f945ca1 commit 52d5a0c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/overlayfs/dir.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
545545
goto out_cleanup;
546546
}
547547
err = ovl_instantiate(dentry, inode, newdentry, hardlink);
548-
if (err)
549-
goto out_cleanup;
548+
if (err) {
549+
ovl_cleanup(udir, newdentry);
550+
dput(newdentry);
551+
}
550552
out_dput:
551553
dput(upper);
552554
out_unlock:

0 commit comments

Comments
 (0)