From nobody Fri Apr 3 22:30:20 2026 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (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 05FD532D0E3 for ; Sun, 22 Mar 2026 13:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774186371; cv=none; b=F0/OWRXhl5jBUsCI8ZTjDKPziUzz4JFeOkEuIdtqMCfv+0hpiHZRDy7Y7MQwexwqqh/O7eOeAo7tdASDhoZ3rAQRHAGL2kv79nMkTWs2d9ZHqxGOtg3qCf0+qN5agt7pqUFkcTvptpb6vVla1Jl7JLwrJci1neumNwbjPkizxDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774186371; c=relaxed/simple; bh=8zVz59xWXt9Rmw2MZ4zUUsl7UcNtRtbnwzIk5FJM5vA=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=Gx6IOju5UOpaQSme7depOgXIm+IEP5Cd8L5CURReBpcnsS9TryUantzLd0FrkaLKvDwXCHz1elw+U2jqv7Oo8dJK3GSOA+mkpk56BaJlkuqRRmVPyHTcN2ztNEkJ/LndRa+EPbCGRrni0dCnIe7c8llw8jktaKur178PsEv3tYA= 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.70 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-f70.google.com with SMTP id 006d021491bc7-67de8a9292cso5351757eaf.3 for ; Sun, 22 Mar 2026 06:32:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774186369; x=1774791169; 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=OvvnSiLWwg3Q3HYTv3TFQpLEPAmtzDTuIbqNOpWatVg=; b=rbNKcyURPvfnMe9+w4LZfw10b9k0EXGMKZmRPMv48yf/33+5PSmkIkySmeLGeWV+AN qsNy4w+vRGJvLoOtwXv+0QK8NjgbOq2WN7bQpMJPkqmupE9mNX2RdwMhZDiyUn8azfHl y8V3fIioFWfJmbrBG5kU6JZjErFQuG8jk+2uNOvPPi/9o2DN5GEhVBZsKai1hdB3s/ne uABLC9bqXNH5YRRlSgSe0EEzpBuyMZ902PcMakCG3RJmDh48/OBumit48L4Ofubiwsnq 6P2hKMyFa5O+O/91Vxe/llyZ5WtA3Y5N/VJMSRPWthF1tpxdgDxFZVUKrZE2a4ujJ57m o4Og== X-Gm-Message-State: AOJu0YxjnDSLHz2zjOy5gNIoyPeCsGZ0PKDy4vi8fSsh9nGcoYvuqIgn Q9d5/T6/RF7aP+xkfVAYiLM8ohwJmK2lkr69YUVmf8jOf1GK6CmsXrImAbLqNkhq129x1pMs/ex hMS1vP8Jqmd8SzMoLz1MDgomp07rrJNMQFbaJLlz2wvxEBEB8lGxaLBaqkuc= 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:4b08:b0:67c:1953:d184 with SMTP id 006d021491bc7-67c22fd09a5mr6614554eaf.67.1774186368980; Sun, 22 Mar 2026 06:32:48 -0700 (PDT) Date: Sun, 22 Mar 2026 06:32:48 -0700 In-Reply-To: <00000000000042f5d90618054116@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69bfef80.050a0220.3bf4de.0084.GAE@google.com> Subject: Forwarded: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBits From: syzbot To: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org. *** Subject: [PATCH v2] jfs: fix slab-out-of-bounds in dbAllocBits and dbFreeBi= ts Author: junyeonggim5@gmail.com When the underlying loop device backend storage is dynamically changed (e.g., via LOOP_SET_FD), JFS fails to update its internal block allocation metadata. This causes dbAllocBits and dbFreeBits to use stale db_agl2size, producing an out-of-range agno value that leads to an out-of-bounds access on mp->db_agfree[agno]. Add bounds checks for agno in both dbAllocBits and dbFreeBits. If agno is negative or exceeds MAXAG, report the error via jfs_error() and return early to prevent the OOB access. Reported-by: syzbot+0be47376a6acbcba7f0d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D0be47376a6acbcba7f0d Signed-off-by: Jun Yeong Kim --- fs/jfs/jfs_dmap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index cb3cda1390ad..c67ff5df0340 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -2142,6 +2142,12 @@ static void dbAllocBits(struct bmap * bmp, struct dm= ap * dp, s64 blkno, int size; s8 *leaf; =20 + agno =3D blkno >> bmp->db_agl2size; + if (agno < 0 || agno >=3D MAXAG) { + jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, = agno); + return; + } + /* pick up a pointer to the leaves of the dmap tree */ leaf =3D dp->tree.stree + LEAFIND; =20 @@ -2289,6 +2295,12 @@ static int dbFreeBits(struct bmap * bmp, struct dmap= * dp, s64 blkno, int rc =3D 0; int size; =20 + agno =3D blkno >> bmp->db_agl2size; + if (agno < 0 || agno >=3D MAXAG) { + jfs_error(bmp->db_ipbmap->i_sb, "%s: agno %d out of range\n", __func__, = agno); + return -EIO; + } + /* determine the bit number and word within the dmap of the * starting block. */ --=20 2.47.3 #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= 7367539ad4b0f8f9b396baf02110962333719a48