gfs2: Fix kernel NULL pointer dereference in gfs2_rgrp_dump
authorOsama Muhammad <osmtendev@gmail.com>
Mon, 6 Nov 2023 16:21:29 +0000 (21:21 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:17 +0000 (15:35 -0800)
commit067a7c48c2c70f05f9460d6f0e8423e234729f05
treea057d704e35c1182ce2faf33b95a3c9afc035fd6
parent5248b445a57972507222e0803d2353c39c7c2b65
gfs2: Fix kernel NULL pointer dereference in gfs2_rgrp_dump

[ Upstream commit 8877243beafa7c6bfc42022cbfdf9e39b25bd4fa ]

Syzkaller has reported a NULL pointer dereference when accessing
rgd->rd_rgl in gfs2_rgrp_dump().  This can happen when creating
rgd->rd_gl fails in read_rindex_entry().  Add a NULL pointer check in
gfs2_rgrp_dump() to prevent that.

Reported-and-tested-by: syzbot+da0fc229cc1ff4bb2e6d@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=da0fc229cc1ff4bb2e6d
Fixes: 72244b6bc752 ("gfs2: improve debug information when lvb mismatches are found")
Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/gfs2/rgrp.c