From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) (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 8C6DE3B894D for ; Fri, 17 Apr 2026 10:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420744; cv=none; b=aRsq5HFR7YEj1DYP89uF9Y4aVdBFki3mN8tF8aB+78+v4n2pVoSonIriF2ToRzy3kNZNEnF04q3+cMTdKCsqbeNgK3SNKB6qbYAaAaRO10W/pUoO3ciHm01ohnUYrdDf9iR8jaBXPuf6oQKdQHiL3zZyEaWkLjRZ9sk0agoHSaY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420744; c=relaxed/simple; bh=rKuJxd9srL4LErX57Hv+xi/GvTUxAzXoHj/h+s5kKC4=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=N30Fztg2tuB4rzILlkO5IAZT3Mzv4885Uc7ZQXKx1f4XTjpRiaR5dik3cWPNyzVfXzE2JzFgeNsxfTR/mwFP8lZjJD9q7P5mCqG6oy/q/hZlyWOiTt5J90x2pQHEjo/Z8J+deqh17jGxpAJeZu6R7xl5xailTGDLfF1RIj7vRzQ= 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.69 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-f69.google.com with SMTP id 006d021491bc7-689b18091ebso1103687eaf.1 for ; Fri, 17 Apr 2026 03:12:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776420742; x=1777025542; 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=/+Qb7AfFb4UBYf74JGCHSEUMoUa9PshSTkIo4W7U+MM=; b=STQq4fxHRX1u5dbq5bIG6VSRT4bYh30Y0l02k9SxTw//2pTcR8Ey+Al6FIr3IOdt38 yCjEbqDMLp9IDR7DhLimtchjic952SguLhHjXtxkGWpJRdfRWNTu9x1jQVIPypcaTIGx sAGitCQq8qLz+Aoaocd9/7MZchNM3EqyPatRYV7iL391FD1c2COP13vM7Rt4RXWCHEYT YcQN5fpZIw8cA5VlvJcyfiJWk8FahaIjMnpKhcat4QGQ8ORXkxlc6v1jpshbbRM8721K nFxO5twZGTik/deQuYB5Wo/x7CP2myDlZvm7K3hjiSCdLdrPWg+/jVdLHx+Xo+/fqwcH 5qfg== X-Gm-Message-State: AOJu0YwF8kSACiYU0kuNDq1sV8bclO9uRgVwmX6qdDdhUG3n64f16mk+ cFaBtad0IyDp7W2zxqcd8LIG2D0HCyfHgKIjugPQl79x5r6q22losRiUMpMqI0/t7W+r7h8KHMU xIIzYYFKPU/9uDdc3RDiMMgOGK79r74jlVhohlrBwxzjrbE16f5mCI+y8z2M= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:ef05:0:b0:694:6817:fdee with SMTP id 006d021491bc7-69468183685mr184745eaf.19.1776420742636; Fri, 17 Apr 2026 03:12:22 -0700 (PDT) Date: Fri, 17 Apr 2026 03:12:22 -0700 In-Reply-To: <0000000000002e9eb506178cdd71@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69e20786.050a0220.1de265.000f.GAE@google.com> Subject: Forwarded: [PATCH] jfs: validate db_maxfreebud in extBalloc to prevent 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: [PATCH] jfs: validate db_maxfreebud in extBalloc to prevent Author: tristmd@gmail.com From: Tristan Madani #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master shift-out-of-bounds extBalloc() computes the maximum allocation size using: max = (s64) 1 << bmp->db_maxfreebud; where db_maxfreebud is an s8 read from the on-disk bmap structure. A crafted JFS image can provide a value of 108, which exceeds the maximum valid shift exponent for a 64-bit signed integer (63), triggering a UBSAN shift-out-of-bounds error. The value -1 is already handled as a sentinel for "no free space", but no upper bound check exists. Add a validation check to return -EIO when db_maxfreebud contains an out-of-range value, indicating on-disk corruption. Reported-by: syzbot+13e8cd4926977f8337b6@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=13e8cd4926977f8337b6 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani --- fs/jfs/jfs_extent.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c index XXXXXXX..XXXXXXX 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c @@ -326,6 +326,12 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) if (bmp->db_maxfreebud == -1) return -ENOSPC; + if (bmp->db_maxfreebud < 0 || bmp->db_maxfreebud > 63) { + jfs_error(ip->i_sb, + "invalid db_maxfreebud: %d\n", bmp->db_maxfreebud); + return -EIO; + } + max = (s64) 1 << bmp->db_maxfreebud; if (*nblocks >= max && *nblocks > nbperpage) nb = nblks = (max > nbperpage) ? max : nbperpage; -- 2.43.0