From nobody Sat Feb 7 21:08:22 2026 Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.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 5CE2129D273 for ; Sat, 17 Jan 2026 03:45:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768621534; cv=none; b=dOTNYBcRgjA/DBFRgMcii0H9OgUTIteFLmSRIDEuW0h4IBLiC7ON3rynDkl2RJLtg48+rNPeLRlPQLWDtFklG6mzTcT/gWthbDF10unaj+SitG92rzu1ppFbo7A6dP+dXnoMw3bn3XGHajLeEGgkvgSvxzbhynSIRWmQwBERwQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768621534; c=relaxed/simple; bh=5I5Cn6KdLbUr4xpf0622hlMu9TFeYx42dm9Lpn7WfF8=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=PcwMxGcdJfZHRC06X0mSG908wZvfKln1BXN2EWtAzD7P9gYxM5tBFjV36/kTQNeqE7kFM4LGgnEk8tl963BJ7FXHLJuOgNhsv8QEnfehrtUzBQcAZ/ysWT3v6n1aJlAYCmNVnqTVmh+i31MRuBhzIs/KLwM6sgDo8D5q5zdHtIE= 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.160.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-oa1-f70.google.com with SMTP id 586e51a60fabf-3fecd18ffa0so3161797fac.2 for ; Fri, 16 Jan 2026 19:45:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768621532; x=1769226332; 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=CREFj7Jf4vEgazTj565Jbn+cEQyVI5wlaCbGuyMz52g=; b=MFpuDmCpJDg/7y0KsWFlmcCO41k+PP3pV2duZsvp4fye5bfwv2CEBigXAXqMV3ZX3r l3adQ+0WFs+fHdGLGP25JvH9k3QfosLtoIYfDu1Pw+I0Fg3757pezoUGjKg6PlUUZbJN Y0AmYkoWAbnesHFF0IPVF7Apu1as/bxUWj+kqdDVZC4wAMBQUydFX3qYqa01W/nAKf11 xaAV69KQcDUxQdmQLKGL8M00CsmdhaC4cbUm3m27F19gxziXe0YUdY50qjsa0WrEskMn hVf5O9D+daZRD/ufsSY+KzcRNSX23CZf6GYuWV7+cN2fWDxM0xOzDD7mdHC+u14HKlJW j1Ew== X-Gm-Message-State: AOJu0YxYbwHM4yQL44Zb+0M9O69xSygWoI0qJjH8vswz9TnrNzeNBaGJ QOw+ipTBFHCBI8K0gR2hw7sp5h1ZjUafCIXvKo1XRZn4HBpDP4KGdCBK6GLv/FPjSBGG5wOs4FH xlEscvyxCyjcvQadHNQGHFkBtwdUVRMyCRTHs/eKgZUPhCTmkyjgyaNjZ1N0= 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:3098:b0:65d:e58:503a with SMTP id 006d021491bc7-661188baa43mr1876827eaf.26.1768621532303; Fri, 16 Jan 2026 19:45:32 -0800 (PST) Date: Fri, 16 Jan 2026 19:45:32 -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: <696b05dc.050a0220.3390f1.0002.GAE@google.com> Subject: Forwarded: [PATCH] hpfs: add buffer 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 buffer 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 the B+ tree in a corrupted HPFS filesystem, the btree pointer obtained from GET_BTREE_PTR() may point outside the mapped buffer's bounds if the on-disk data structures are malformed. This leads to a use-after-free when accessing btree->u.external[i] as the memory may have been freed and reallocated. Additionally, a corrupted n_used_nodes value can cause out-of-bounds array access when iterating through btree->u.internal[] or btree->u.external[] arrays. Add validation to ensure: 1. The btree pointer stays within the mapped buffer boundaries 2. The n_used_nodes value is within reasonable limits This prevents KASAN-detected use-after-free when processing malicious HPFS filesystem images. Reported-by: syzbot+8debf4b3f7c7391cd8eb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D8debf4b3f7c7391cd8eb --- fs/hpfs/anode.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/hpfs/anode.c b/fs/hpfs/anode.c index a4f5321eafae..7324ec22941a 100644 --- a/fs/hpfs/anode.c +++ b/fs/hpfs/anode.c @@ -28,6 +28,18 @@ secno hpfs_bplus_lookup(struct super_block *s, struct in= ode *inode, brelse(bh); if (!(anode =3D hpfs_map_anode(s, a, &bh))) return -1; btree =3D GET_BTREE_PTR(&anode->btree); + if ((void *)btree < (void *)bh->b_data || + (void *)btree + sizeof(*btree) > (void *)bh->b_data + bh->b_size) { + hpfs_error(s, "btree pointer out of bounds"); + brelse(bh); + return -1; + } + + if (btree->n_used_nodes > 60) { + hpfs_error(s, "n_used_nodes=3D%u is suspiciously large", btree->n_use= d_nodes); + brelse(bh); + return -1; + } goto go_down; } hpfs_error(s, "sector %08x not found in internal anode %08x", sec, a); --=20 2.43.0