From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f77.google.com (mail-oo1-f77.google.com [209.85.161.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A84063876BF for ; Mon, 4 May 2026 22:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.77 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777934577; cv=none; b=FSPcan3o++40FXsIvc1Rg2xFMKGI4ckwg7qmxUFvLwHWesbdOFS13PMuq9GXOzMMNetYMNbHiE8vr1hMcPUDbEMBcHlUg8CIRJN3Zw2X84aqMRt1tI3t+RZm3dEscqcPJUfI+8Z2UZY45dr0eIGG8cwht787kuksgPbi5+8zaxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777934577; c=relaxed/simple; bh=U98SGfr0Pe0t1PiKClIKWeFcskFN6rmMDZ56N/fJAws=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=m+m5mBAWzgniRsdm68JQg0opEZTd9My9+KGnWsdt121rJyG1qVGGMG2Ti1zW8J1uvrE/YLEMb2JMtybRyIJEN6ujVPvzFHI7qwsNPQHBptAcB24ol9Ay2ziFQOd1mpHj2UwIRF0YRnb6kwVf2FQqeoj6fl//mYk2nE7ljZErkfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f77.google.com with SMTP id 006d021491bc7-6948eac3522so7557732eaf.3 for ; Mon, 04 May 2026 15:42:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777934574; x=1778539374; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mMSKjykCVT5Qs+AdGYmFfMgP4tFg32A467oHkt21FOo=; b=mxCJvaa64QFfrS+KKn8EPZa9pkqsd/kvQ8CQ814VDrQnw482juaeBpb+PdDC8pZosF e1ncZoCXM0gGmF5OcaHT8aGMShku39qLoAKT0w7DGd+Ksa9xTW1faN2ho0OVWBV3QvNc cbx++7UoJJTE1f0YObiUT1f4A7yAYAffVJNRvvzxiQhp5UJpc+yyuRP3/msvy27FSF+u C8AhWjjNdsp6L+ti6lip5VPd0ly73d1sHeUkRz81o8sT1N3Uzg42Ql7fYbM7tCFJintG Bc96kHJ5AqHsfZIhce1yYuFAYImGWZxuhKw7I96wZzOLxq0xdQOHFXOZ9NcMfvTYExDX eb5g== X-Gm-Message-State: AOJu0YyQTJqDOw3b0p3rnEJb8zzTarCY7UNrHDMwBpjMb26cl0P/mFWJ 1/uFIu2K1YHdlJgIqElAw3tAJjiQbPT3LQPwXfKwYUolADGTGh8tpt+mEWftobFUsHQ3EzCzApL lSosaT3V0We7WSAlf5wdxSu1DmCv7T623F3RBRJ4nHqwUf0Iy2fhcalTL5gkjhw== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:f034:b0:68a:116a:a5e5 with SMTP id 006d021491bc7-69697d6a4bdmr6550552eaf.44.1777934574695; Mon, 04 May 2026 15:42:54 -0700 (PDT) Date: Mon, 04 May 2026 15:42:54 -0700 In-Reply-To: <00000000000034ae0f05e9f94c79@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69f920ee.170a0220.bb392.000c.GAE@google.com> Subject: Forwarded: Re: [syzbot] [jfs?] KASAN: use-after-free Read in jfs_lazycommit From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: Re: [syzbot] [jfs?] KASAN: use-after-free Read in jfs_lazycommit 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 306165e61438c..855d58210b12a 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -1806,6 +1806,7 @@ static int lbmLogInit(struct jfs_log * log) init_waitqueue_head(&log->free_wait); log->lbuf_free = NULL; + atomic_set(&log->pending_io, 0); for (i = 0; i < LOGPAGES;) { char *buffer; @@ -1855,6 +1856,8 @@ static void lbmLogShutdown(struct jfs_log * log) jfs_info("lbmLogShutdown: log:0x%p", log); + wait_event(log->free_wait, atomic_read(&log->pending_io) == 0); + lbuf = log->lbuf_free; while (lbuf) { struct lbuf *next = lbuf->l_freelist; @@ -1976,6 +1979,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) bio->bi_end_io = lbmIODone; bio->bi_private = bp; + atomic_inc(&log->pending_io); /*check if journaling to disk has been disabled*/ if (log->no_integrity) { bio->bi_iter.bi_size = 0; @@ -2122,6 +2126,7 @@ static void lbmStartIO(struct lbuf * bp) bio->bi_end_io = lbmIODone; bio->bi_private = bp; + atomic_inc(&log->pending_io); /* check if journaling to disk has been disabled */ if (log->no_integrity) { @@ -2186,6 +2191,8 @@ static void lbmIODone(struct bio *bio) bio_put(bio); + log = bp->l_log; + /* * pagein completion */ @@ -2214,7 +2221,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) { @@ -2297,6 +2303,8 @@ static void lbmIODone(struct bio *bio) } out: + if (atomic_dec_and_test(&log->pending_io)) + wake_up(&log->free_wait); bp->l_flag |= lbmDONE; LCACHE_UNLOCK(flags); } diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h index 09e0ef6aeccef..df0375ce572f8 100644 --- a/fs/jfs/jfs_logmgr.h +++ b/fs/jfs/jfs_logmgr.h @@ -400,6 +400,7 @@ 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 pending_io; /* count of in-flight log I/Os */ }; /*