mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
ovl: fix BUG_ON() in may_delete() when called from ovl_cleanup()
commit52d5a0c6bd
upstream. 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 <chenying.kernel@bytedance.com> Fixes:01b39dcc95
("ovl: use inode_insert5() to hash a newly created inode") Link: https://lore.kernel.org/linux-unionfs/e6496a94-a161-dc04-c38a-d2544633acb4@bytedance.com/ Cc: <stable@vger.kernel.org> # v4.18 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1a2f728b03
commit
a701ae9a0d
1 changed files with 4 additions and 2 deletions
|
@ -513,8 +513,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:
|
||||
|
|
Loading…
Reference in a new issue