From nobody Mon Apr 6 09:08:16 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 E1B00BA45 for ; Sun, 22 Mar 2026 12:51:16 +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=1774183878; cv=none; b=u3HMulDdHmVYRJf/OuA4l5P5hDtT1XURBgfNqpypN8yBvA/HIlRIyX143m1pg+Tlv+6oTo+omVZKTBSPPyd3AVnQg6dfG4jnZ2agyaQ2TwD0siT1Ew6el32AekZj0N97RjNPcFf0TKQBM7TyyLvDh6QFZMxvoHCIJncZR7QzYHE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774183878; c=relaxed/simple; bh=ECyfM0PCkRVfbmmTPe6NxcCybQG/O/715ZNRLs6XVhs=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=kPFuhtNi1Rv/8TWxiE6C/So+DZz9fvrMytxig0vs+t9Hgkmo+lfvQzpZvUIu1GDVoo5mUt7k3PkfWSrSmBZmw4WvE130vKB/Htoq8FYNYCDaWV7WEEyUWTz+/8uPrFTvP8zcih27h4jA9j76A2hNFeZYISLhAIU79hKgPn52Yig= 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-67de3f8988cso17139877eaf.1 for ; Sun, 22 Mar 2026 05:51:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774183876; x=1774788676; 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=QiDVnar4GlDW7HaMVvEQ5YDF9RzQHH00RHpD9Xe+6MV1L09EZCXsLLACWTGxjiI+Nm fPKM0St1N01c/FN+u4FXAlBjAHvu9WVoDWXrEE+UpBU179KtRyS3sQ5Bb2wX0Hd4akr4 YvkaeiQCP+yT0C3EShnDknp/u1pvWlh/hMcYsspsavyyNPnGqF9kF5QeA7iVj2/SKqNH Ix+nhc5/KVvT/uX3ctSf+nXMb24Oe5UaQZ6/irMntExAncLk747uCuN67Z0rAsgKXWS9 yrOdoSAmXq/27s9DJOCoxNpMuabPIQqSpRwu9u3sMieRZHSWDB8iagO2KRcnMbH4lJF9 davA== X-Gm-Message-State: AOJu0YzyBh0bxg1zeeDVj7Qk7cO2tCtZgy/R37HjLhRiSYyOKlz/d//l bbKRzti2RKzCB7K1YeFPUKcvrQuYafIG49iPaZEOg/rTYZ9IEX4AyTuxtwCs0DTkEpk4c+H5s75 LIDeJxr1yKE029MUcc/7vgpk1A2atzr+B11x8F85qRSPJidXgiC5Zk9mOctk= 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:83d1:10b0:67c:24de:b374 with SMTP id 006d021491bc7-67c24deb542mr4768086eaf.25.1774183875959; Sun, 22 Mar 2026 05:51:15 -0700 (PDT) Date: Sun, 22 Mar 2026 05:51:15 -0700 In-Reply-To: <00000000000042f5d90618054116@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69bfe5c3.050a0220.3bf4de.007f.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