diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 6509ec3cb373..073be36b0686 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -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: