Skip to contentSkip to conversation

gf2: Do not dereference sdp->sd_jdesc in status_show

PATCH New Andreas Gruenbacher 1 participant 1 message Aug 27 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 gf2: Do not dereference sdp->sd_jdesc in status_show

Do not dereference sdp->sd_jdesc->jd_jid in status_show() to prevent a potential NULL pointer dereference during filesystem shutdown. Instead, get the journal ID from sdp->sd_lockstruct.ls_jid.

---
 fs/gfs2/sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/sys.c +1 -1
index ea2c7b9e4a77..eecd4e7b12f4 100644
@@ -99,7 +99,7 @@ static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
 		     "sd_log_thresh2:           %d\n",
 		     test_bit(SDF_JOURNAL_CHECKED, &f),
 		     test_bit(SDF_JOURNAL_LIVE, &f),
-		     (sdp->sd_jdesc ? sdp->sd_jdesc->jd_jid : 0),
+		     sdp->sd_lockstruct.ls_jid,
 		     (sdp->sd_args.ar_spectator ? 1 : 0),
 		     test_bit(SDF_WITHDRAWN, &f),
 		     test_bit(SDF_NOBARRIERS, &f),
Signature · 1 line
2.55.0