lkml.org 
[lkml]   [2020]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 34/39] gfs2: check for empty rgrp tree in gfs2_ri_update
    Date
    From: Bob Peterson <rpeterso@redhat.com>

    commit 778721510e84209f78e31e2ccb296ae36d623f5e upstream.

    If gfs2 tries to mount a (corrupt) file system that has no resource
    groups it still tries to set preferences on the first one, which causes
    a kernel null pointer dereference. This patch adds a check to function
    gfs2_ri_update so this condition is detected and reported back as an
    error.

    Reported-by: syzbot+e3f23ce40269a4c9053a@syzkaller.appspotmail.com
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/gfs2/rgrp.c | 4 ++++
    1 file changed, 4 insertions(+)

    --- a/fs/gfs2/rgrp.c
    +++ b/fs/gfs2/rgrp.c
    @@ -1009,6 +1009,10 @@ static int gfs2_ri_update(struct gfs2_in
    if (error < 0)
    return error;

    + if (RB_EMPTY_ROOT(&sdp->sd_rindex_tree)) {
    + fs_err(sdp, "no resource groups found in the file system.\n");
    + return -ENOENT;
    + }
    set_rgrp_preferences(sdp);

    sdp->sd_rindex_uptodate = 1;

    \
     
     \ /
      Last update: 2020-12-10 17:57    [W:3.131 / U:0.528 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site