From nobody Sat Apr 4 00:05:30 2026 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (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 EE7452E2665 for ; Sun, 22 Mar 2026 13:12:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774185126; cv=none; b=XbHz3m3L8CuC5KUrgqUNegfKdcVo+8bgcmp1h/8ArNJ66I8lJsHxW0O8slf1XGIdFIsZnfMD/aifCSfVj6OxuCjc+WvVUCz64U4q9Tl9bNMEoq8S45gJOp0BpmAEX2YnPpzQv+lUyBn8ZbpvxwGyQN11OA20UOF9fpnTHJzqTOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774185126; c=relaxed/simple; bh=ECyfM0PCkRVfbmmTPe6NxcCybQG/O/715ZNRLs6XVhs=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=bWia0dTnmvreU6ROP2Mh/NzpT+ewRqz+nekyxWmp99O03de7RtX4paU6GZzPQFfVmZJ2kOntR0irXOUMjzxKwyrtmCnETXrW64bDv51IxhNv0z/s/s7842hze83dPYKwVhTZkr9IdR6Oy8I/J8fy3492rYYlFmr7C6LB6OUz4z4= 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.72 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-f72.google.com with SMTP id 006d021491bc7-67de8a9292cso5095102eaf.3 for ; Sun, 22 Mar 2026 06:12:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774185124; x=1774789924; 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=S06jLR6n+SVH3CtIo6mOt6AAzMNVtcO7eiKXgnc3xkU=; b=SRPLF6YzdBNCcrH8X3BJ471HcvnrzMN35AxY641LrVgRT/EH1ngQQ6tDOI4ViMgLkg U1Tn9MdUeB3RhDidZNipW68uJipGZdYGatKLOVuJj18lsCxeK0PAdSLgn2xjvMhdtvsl RpJDHCzU9V6CtV8VCmlGnsC1ptrmwWuIboUiS0CA5n4hBtpnJtfZz7y3q0dKrVUD+2sW HFiEK1pFbIY1CSw28reCxp0TMGqgGmR44aWkUGjoWUFMdZPuga0ZJhOI/rrdqUitfoV5 AWm5tzW8O4DJfrHotsUkJHXRGU8DXHAYUaMvHHfGuUfQW3FKAK8of/O+7XXThz46fiSh xvsg== X-Gm-Message-State: AOJu0Yzf8bWWexfUiPMbJG6W6YyfycnwQqE/JsblmHvhtlwSv7AmPcB+ bvS7GCsYi+XbWoHmNtcpCERJMmDR8Kw6LtnHEpqo2DX6XZ94GdzTo8k63+4tE2d4k50SWPG5gwd qL8Kega9W0w+/QoR1phnlALtkWUZPxoroduCsikQ+goctU+3apXIKaL8EN24= 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:174e:b0:67b:ab68:b5e2 with SMTP id 006d021491bc7-67c22ece4f5mr6942798eaf.18.1774185124104; Sun, 22 Mar 2026 06:12:04 -0700 (PDT) Date: Sun, 22 Mar 2026 06:12:04 -0700 In-Reply-To: <00000000000042f5d90618054116@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69bfeaa4.050a0220.3bf4de.0082.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= master