lkml.org 
[lkml]   [2021]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 281/306] ovl: fix BUG_ON() in may_delete() when called from ovl_cleanup()
    Date
    From: chenying <chenying.kernel@bytedance.com>

    commit 52d5a0c6bd8a89f460243ed937856354f8f253a3 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: 01b39dcc9568 ("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>
    ---
    fs/overlayfs/dir.c | 6 ++++--
    1 file changed, 4 insertions(+), 2 deletions(-)

    --- a/fs/overlayfs/dir.c
    +++ b/fs/overlayfs/dir.c
    @@ -542,8 +542,10 @@ static int ovl_create_over_whiteout(stru
    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:

    \
     
     \ /
      Last update: 2021-09-16 18:35    [W:4.067 / U:0.104 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site