From nobody Sat Feb 7 20:58:00 2026 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 24DAE30C378 for ; Sat, 17 Jan 2026 05:05:18 +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=1768626320; cv=none; b=LjN2zvwf+SF8SDkh7LHaaHDI3zXIbsNVgMtNrSE0N/KtvcxWLN4q9bpPaDVfs0EpjYosGdJaU9EL5hehMJ2gKBrR0+AKLd6F65UOZMRylrW7b9fOJ5Zj49V4ZoSNR/ZcVWeZYxW44xLLvibhtkleV9ve2GPruhLOlUMu1JUY6vA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768626320; c=relaxed/simple; bh=49jIzTHYKwGkB20EV9pQJKr01T5qe/gTz2TI2JV54bE=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=DQdrDrvn+A8Ma2K8ch+vDT87hGGKaCJYAviD+DBNMm9t0mhwaw6NkjqsF/VSXczYG284e8JmGPch6hRpHiqEJ3Gcttn0nCAWaNhfpCE35hAy0srTJwv8fNqjcTIQks7ZoDO5e7WXH275tVpWCEfYCCMWlUUXzRXkd1KTxn3560E= 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-6610e4c7e46so8611325eaf.0 for ; Fri, 16 Jan 2026 21:05:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768626318; x=1769231118; 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=XH+UGE+raTSWBYnM49dZuyEMt2weTOBYuJyZOwLnVK8=; b=woWjH5dAVhbWflWQuOof662sXVgqJ6TNs/6RDXB7/WwzSoMfRyVLvbQVZSnyLkQrrc EK/VNDQQa6HzaZ6JqXEaBqQOUWw+W00HSZ4TDiJHvylftx5AT2FjNYEhL5MD66h9JZUI UFvelFCGUxDMHfh9+PhmDeaEoTRzghDA4mfu8U7LIBIsmavW83WOCyEFv5Ee4ctE2cyG yYBRzQ++tDrS+MlUiQ99e+s3JvU4O2Tg5oI8jmeaMmzYt00nbnmyJn3RPpOI35rW3QVz Ps+H+EmHC/t5BGZAct1EMQqUWvBwvgAr4JtqpAJq/PKAFwgfTwzAGpBrcldqvkLqgIZS IVuA== X-Gm-Message-State: AOJu0YxA2zpQB0w1hTGfjafv5GVxJuESiZQTYeWpLiFvNEKeoElsk0lZ /i9Er6ICIPqhjwmNS27mM5cJZOcXGkNTi4lebnDOGYjNwuhgiIDm6O5QoLsaMAbUgPj/waa81fv wvtirVmF1vlgzt2JXs0VdJs8xzKprE4Bx6/vAvHwZ4CMKDQcjs4/KZoK7XdA= 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:1789:b0:659:9a49:9067 with SMTP id 006d021491bc7-661179b6a3cmr2339685eaf.50.1768626318160; Fri, 16 Jan 2026 21:05:18 -0800 (PST) Date: Fri, 16 Jan 2026 21:05:18 -0800 In-Reply-To: <696aa7da.a70a0220.31956c.001a.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <696b188e.a70a0220.34546f.00a5.GAE@google.com> Subject: Forwarded: [PATCH] hpfs: add array bounds validation in hpfs_bplus_lookup From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com 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, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] hpfs: add array bounds validation in hpfs_bplus_lookup Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master When traversing a corrupted HPFS filesystem, the n_used_nodes field in the btree header can contain a value larger than what fits in the allocated buffer. This causes out-of-bounds array access when iterating through btree->u.internal[] or btree->u.external[] arrays, leading to a KASAN-detected use-after-free. Validate that n_used_nodes does not exceed the maximum number of nodes that can fit in the buffer before accessing the arrays. Reported-by: syzbot+8debf4b3f7c7391cd8eb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D8debf4b3f7c7391cd8eb Signed-off-by: Deepanshu Kartikey --- fs/hpfs/anode.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/fs/hpfs/anode.c b/fs/hpfs/anode.c index a4f5321eafae..6e1b43f5c9cf 100644 --- a/fs/hpfs/anode.c +++ b/fs/hpfs/anode.c @@ -21,6 +22,31 @@ secno hpfs_bplus_lookup(struct super_block *s, struct in= ode *inode, int c1, c2 =3D 0; go_down: if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_= lookup")) return -1; + + if (bp_internal(btree)) { + unsigned int max_internal_nodes; + + max_internal_nodes =3D (bh->b_size - ((char *)btree->u.internal - (char = *)bh->b_data)) + / sizeof(btree->u.internal[0]); + if (btree->n_used_nodes > max_internal_nodes) { + hpfs_error(s, "btree->n_used_nodes =3D %u, but max for internal node is= %u", + btree->n_used_nodes, max_internal_nodes); + brelse(bh); + return -1; + } + } else { + unsigned int max_external_nodes; + + max_external_nodes =3D (bh->b_size - ((char *)btree->u.external - (char = *)bh->b_data)) + / sizeof(btree->u.external[0]); + if (btree->n_used_nodes > max_external_nodes) { + hpfs_error(s, "btree->n_used_nodes =3D %u, but max for external node is= %u", + btree->n_used_nodes, max_external_nodes); + brelse(bh); + return -1; + } + } + if (bp_internal(btree)) { for (i =3D 0; i < btree->n_used_nodes; i++) if (le32_to_cpu(btree->u.internal[i].file_secno) > sec) { --=20 2.43.0