public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+ecf51a7ccb6b1394e90c@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: Re: [syzbot] [jfs?] KASAN: slab-use-after-free Read in lbmIODone
Date: Fri, 17 Apr 2026 12:26:54 -0700	[thread overview]
Message-ID: <69e2897e.a00a0220.1bd0ca.0020.GAE@google.com> (raw)
In-Reply-To: <68da879e.050a0220.1696c6.0016.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: [syzbot] [jfs?] KASAN: slab-use-after-free Read in lbmIODone
Author: tristmd@gmail.com

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index XXXXXXX..XXXXXXX 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -1805,6 +1805,8 @@ static int lbmLogInit(struct jfs_log * log)
 	 */
 	init_waitqueue_head(&log->free_wait);
 
+	atomic_set(&log->io_count, 0);
+
 	log->lbuf_free = NULL;
 
 	for (i = 0; i < LOGPAGES;) {
@@ -1855,6 +1857,8 @@ static void lbmLogShutdown(struct jfs_log * log)
 
 	jfs_info("lbmLogShutdown: log:0x%p", log);
 
+	wait_var_event(&log->io_count, atomic_read(&log->io_count) == 0);
+
 	lbuf = log->lbuf_free;
 	while (lbuf) {
 		struct lbuf *next = lbuf->l_freelist;
@@ -2128,6 +2132,7 @@ static void lbmStartIO(struct lbuf * bp)
 		bio->bi_iter.bi_size = 0;
 		lbmIODone(bio);
 	} else {
+		atomic_inc(&log->io_count);
 		submit_bio(bio);
 		INCREMENT(lmStat.submitted);
 	}
@@ -2170,12 +2175,16 @@ static void lbmIODone(struct bio *bio)
 	struct lbuf *nextbp, *tail;
 	struct jfs_log *log;
 	unsigned long flags;
+	int is_write;
 
 	/*
 	 * get back jfs buffer bound to the i/o buffer
 	 */
 	jfs_info("lbmIODone: bp:0x%p flag:0x%x", bp, bp->l_flag);
 
+	log = bp->l_log;
+	is_write = !(bp->l_flag & lbmREAD);
+
 	LCACHE_LOCK(flags);		/* disable+lock */
 
 	if (bio->bi_status) {
@@ -2214,7 +2223,6 @@ static void lbmIODone(struct bio *bio)
 	INCREMENT(lmStat.pagedone);
 
 	/* update committed lsn */
-	log = bp->l_log;
 	log->clsn = (bp->l_pn << L2LOGPSIZE) + bp->l_ceor;
 
 	if (bp->l_flag & lbmDIRECT) {
@@ -2299,6 +2307,10 @@ static void lbmIODone(struct bio *bio)
 out:
 	bp->l_flag |= lbmDONE;
 	LCACHE_UNLOCK(flags);
+
+	if (is_write && !log->no_integrity)
+		if (atomic_dec_and_test(&log->io_count))
+			wake_up_var(&log->io_count);
 }
 
 int jfsIOWait(void *arg)
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h
index XXXXXXX..XXXXXXX 100644
--- a/fs/jfs/jfs_logmgr.h
+++ b/fs/jfs/jfs_logmgr.h
@@ -400,6 +400,8 @@ struct jfs_log {
 	uuid_t uuid;		/* 16: 128-bit uuid of log device */
 
 	int no_integrity;	/* 3: flag to disable journaling to disk */
+
+	atomic_t io_count;	/* outstanding I/O count for shutdown drain */
 };
 
 /*

      parent reply	other threads:[~2026-04-17 19:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 13:20 [syzbot] [jfs?] KASAN: slab-use-after-free Read in lbmIODone syzbot
2026-04-15  6:59 ` syzbot
2026-04-15  9:06 ` syzbot
2026-04-17 12:41   ` Edward Adam Davis
2026-04-17 12:59     ` syzbot
2026-04-18  3:56   ` Edward Adam Davis
2026-04-18  5:37     ` syzbot
2026-04-18  4:35   ` Edward Adam Davis
2026-04-18  5:43     ` syzbot
2026-04-18  5:42   ` Edward Adam Davis
2026-04-18  5:50     ` syzbot
2026-04-18  5:49   ` Edward Adam Davis
2026-04-18  5:56     ` syzbot
2026-04-18  5:55   ` Edward Adam Davis
2026-04-18  6:10     ` syzbot
2026-04-18  6:07   ` Edward Adam Davis
2026-04-18  6:37     ` syzbot
2026-04-18  6:39   ` Edward Adam Davis
2026-04-17 14:20 ` Forwarded: [PATCH] jfs: fix use-after-free in lbmIODone by waiting for in-flight I/O syzbot
2026-04-17 16:22 ` Forwarded: Re: [syzbot] KASAN: slab-use-after-free Read in lbmIODone syzbot
2026-04-17 19:26 ` syzbot [this message]

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=69e2897e.a00a0220.1bd0ca.0020.GAE@google.com \
    --to=syzbot+ecf51a7ccb6b1394e90c@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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