From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Edward Adam Davis <eadavis@qq.com>,
syzbot+ci1f1a4e9c887bc6ea@syzkaller.appspotmail.com
Cc: axboe@kernel.dk, jfs-discussion@lists.sourceforge.net,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot@lists.linux.dev, syzbot@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH v2] jfs: Extend the done of the window period
Date: Mon, 16 Mar 2026 16:14:19 -0500 [thread overview]
Message-ID: <f6b3746c-4357-4a00-b743-79b1cb0c2d4c@oracle.com> (raw)
In-Reply-To: <tencent_48DDBA00BB1033889E551BDE4B721B042508@qq.com>
Finally tested and applied to jfs-next
Thank you and thank you for your patience,
Shaggy
On 12/16/25 7:57AM, Edward Adam Davis wrote:
> In lbmRead(), the I/O event waited for by wait_event() finishes before
> it goes to sleep, and the lbmIODone() prematurely sets the flag to
> lbmDONE, thus ending the wait. This causes wait_event() to return before
> lbmREAD is cleared (because lbmDONE was set first), the premature return
> of wait_event() leads to the release of lbuf before lbmIODone() returns,
> thus triggering the use-after-free vulnerability reported in [1].
>
> Moving the operation of setting the lbmDONE flag to after clearing lbmREAD
> in lbmIODone() avoids the use-after-free vulnerability reported in [1].
>
> [1]
> BUG: KASAN: slab-use-after-free in rt_spin_lock+0x88/0x3e0 kernel/locking/spinlock_rt.c:56
> Call Trace:
> blk_update_request+0x57e/0xe60 block/blk-mq.c:1007
> blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1169
> blk_complete_reqs block/blk-mq.c:1244 [inline]
> blk_done_softirq+0x10a/0x160 block/blk-mq.c:1249
>
> Allocated by task 6101:
> lbmLogInit fs/jfs/jfs_logmgr.c:1821 [inline]
> lmLogInit+0x3d0/0x19e0 fs/jfs/jfs_logmgr.c:1269
> open_inline_log fs/jfs/jfs_logmgr.c:1175 [inline]
> lmLogOpen+0x4e1/0xfa0 fs/jfs/jfs_logmgr.c:1069
> jfs_mount_rw+0xe9/0x670 fs/jfs/jfs_mount.c:257
> jfs_fill_super+0x754/0xd80 fs/jfs/super.c:532
>
> Freed by task 6101:
> kfree+0x1bd/0x900 mm/slub.c:6876
> lbmLogShutdown fs/jfs/jfs_logmgr.c:1864 [inline]
> lmLogInit+0x1137/0x19e0 fs/jfs/jfs_logmgr.c:1415
> open_inline_log fs/jfs/jfs_logmgr.c:1175 [inline]
> lmLogOpen+0x4e1/0xfa0 fs/jfs/jfs_logmgr.c:1069
> jfs_mount_rw+0xe9/0x670 fs/jfs/jfs_mount.c:257
> jfs_fill_super+0x754/0xd80 fs/jfs/super.c:532
>
> Reported-by: syzbot+1d38eedcb25a3b5686a7@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=1d38eedcb25a3b5686a7
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> v1 -> v2: fix potential deadlock
>
> fs/jfs/jfs_logmgr.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
> index b343c5ea1159..0db4bc9f2d6c 100644
> --- a/fs/jfs/jfs_logmgr.c
> +++ b/fs/jfs/jfs_logmgr.c
> @@ -2180,8 +2180,6 @@ static void lbmIODone(struct bio *bio)
>
> LCACHE_LOCK(flags); /* disable+lock */
>
> - bp->l_flag |= lbmDONE;
> -
> if (bio->bi_status) {
> bp->l_flag |= lbmERROR;
>
> @@ -2196,12 +2194,10 @@ static void lbmIODone(struct bio *bio)
> if (bp->l_flag & lbmREAD) {
> bp->l_flag &= ~lbmREAD;
>
> - LCACHE_UNLOCK(flags); /* unlock+enable */
> -
> /* wakeup I/O initiator */
> LCACHE_WAKEUP(&bp->l_ioevent);
>
> - return;
> + goto out;
> }
>
> /*
> @@ -2225,8 +2221,7 @@ static void lbmIODone(struct bio *bio)
>
> if (bp->l_flag & lbmDIRECT) {
> LCACHE_WAKEUP(&bp->l_ioevent);
> - LCACHE_UNLOCK(flags);
> - return;
> + goto out;
> }
>
> tail = log->wqueue;
> @@ -2278,8 +2273,6 @@ static void lbmIODone(struct bio *bio)
> * leave buffer for i/o initiator to dispose
> */
> if (bp->l_flag & lbmSYNC) {
> - LCACHE_UNLOCK(flags); /* unlock+enable */
> -
> /* wakeup I/O initiator */
> LCACHE_WAKEUP(&bp->l_ioevent);
> }
> @@ -2290,6 +2283,7 @@ static void lbmIODone(struct bio *bio)
> else if (bp->l_flag & lbmGC) {
> LCACHE_UNLOCK(flags);
> lmPostGC(bp);
> + LCACHE_LOCK(flags); /* disable+lock */
> }
>
> /*
> @@ -2302,9 +2296,11 @@ static void lbmIODone(struct bio *bio)
> assert(bp->l_flag & lbmRELEASE);
> assert(bp->l_flag & lbmFREE);
> lbmfree(bp);
> -
> - LCACHE_UNLOCK(flags); /* unlock+enable */
> }
> +
> +out:
> + bp->l_flag |= lbmDONE;
> + LCACHE_UNLOCK(flags);
> }
>
> int jfsIOWait(void *arg)
prev parent reply other threads:[~2026-03-16 21:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-02 0:15 [syzbot] [block?] general protection fault in blk_update_request syzbot
2025-12-08 5:49 ` syzbot
2025-12-09 2:34 ` Jens Axboe
2025-12-14 12:50 ` [syzbot] [jfs] " syzbot
2025-12-16 3:23 ` [PATCH] jfs: Extend the done of the window period Edward Adam Davis
2025-12-16 13:27 ` [syzbot ci] " syzbot ci
2025-12-16 13:57 ` [PATCH v2] " Edward Adam Davis
2026-03-16 21:14 ` Dave Kleikamp [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=f6b3746c-4357-4a00-b743-79b1cb0c2d4c@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=axboe@kernel.dk \
--cc=eadavis@qq.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+ci1f1a4e9c887bc6ea@syzkaller.appspotmail.com \
--cc=syzbot@lists.linux.dev \
--cc=syzbot@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