mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: eadavis@qq.com
Cc: agruenba@redhat.com, gfs2@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	syzbot+6b156e132970e550194c@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com
Subject: [PATCH next V2] gfs2: Add sanity check for sd_jdesc
Date: Wed, 15 Oct 2025 17:59:47 +0800	[thread overview]
Message-ID: <tencent_9FC786C5D2D3067449AEEED16EE6CC8BA706@qq.com> (raw)
In-Reply-To: <tencent_9C66663DC537949618361A4B5E750576B309@qq.com>

Asynchronous withdraw, when sd_withdraw_work is scheduled later than
put_super, will set sd_jdesc to NULL when clearing all journal index
information, triggering the syz report null-ptr-deref.

Reported-by: syzbot+6b156e132970e550194c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6b156e132970e550194c
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
V1 -> V2: Updated the issue reported in the comments

 fs/gfs2/log.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 8312cd2cdae4..433a3a11a2f5 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -427,7 +427,8 @@ static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail)
  */
 
 bool gfs2_log_is_empty(struct gfs2_sbd *sdp) {
-	return atomic_read(&sdp->sd_log_blks_free) == sdp->sd_jdesc->jd_blocks;
+	return sdp->sd_jdesc &&
+	       atomic_read(&sdp->sd_log_blks_free) == sdp->sd_jdesc->jd_blocks;
 }
 
 static bool __gfs2_log_try_reserve_revokes(struct gfs2_sbd *sdp, unsigned int revokes)
-- 
2.43.0


  reply	other threads:[~2025-10-15 10:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  2:12 [syzbot] [gfs2?] general protection fault in gfs2_log_is_empty syzbot
2025-10-15  9:51 ` [PATCH next] gfs2: Add sanity check for sd_jdesc Edward Adam Davis
2025-10-15  9:59   ` Edward Adam Davis [this message]
2025-10-16 16:43   ` Andreas Gruenbacher
2025-10-15 13:47 ` [syzbot] [gfs2?] general protection fault in gfs2_log_is_empty syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_9FC786C5D2D3067449AEEED16EE6CC8BA706@qq.com \
    --to=eadavis@qq.com \
    --cc=agruenba@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+6b156e132970e550194c@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®