gfs2: Fix NULL pointer dereference in gfs2_log_flush
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 11 Mar 2024 14:51:59 +0000 (15:51 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Apr 2024 16:35:57 +0000 (18:35 +0200)
commit35264909e9d1973ab9aaa2a1b07cda70f12bb828
tree0b9c4378d590d4ba11cf3efb42d3f75676047b82
parentb01189333ee91c1ae6cd96dfd1e3a3c2e69202f0
gfs2: Fix NULL pointer dereference in gfs2_log_flush

In gfs2_jindex_free(), set sdp->sd_jdesc to NULL under the log flush
lock to provide exclusion against gfs2_log_flush().

In gfs2_log_flush(), check if sdp->sd_jdesc is non-NULL before
dereferencing it.  Otherwise, we could run into a NULL pointer
dereference when outstanding glock work races with an unmount
(glock_work_func -> run_queue -> do_xmote -> inode_go_sync ->
gfs2_log_flush).

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/log.c
fs/gfs2/super.c