From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) (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 F05F837266C for ; Fri, 17 Apr 2026 10:12:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420741; cv=none; b=d1TkjrnDPPA1RFJCOBDwe6XRa3RYIBD7TVymCD9rT3tXX7EI6H4JGaPdlORiZdWgVGMo+NzaWdvAdNmTocRIzhORZP7PXNLkcFb2gCOuGINhSJ/h4JTr4Le9QoiYBsMlgT3louseQaOI6JQnxEKkQ3uxMYn8FFHmexOPTCNFq8s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420741; c=relaxed/simple; bh=6m9XcfEC0wSjoOmNVDk3qQUc+96y01Dlia/rwtBNb7E=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=ttNc2C5dAdPNEJGGhcDJm0wHJVXr7brjVTWNYmq1Iq0a47kb0mtlsQh2smfAosv2uxGwBdNL4gVFSul57Je1G5y+A+9mwRJUyc0uxax6rzVfe1AG+MgG8vVnqLFB7olgIX97zt1onOFBqBVUO/eSUbSp0rLlsluxpBUBEocubGI= 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.71 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-f71.google.com with SMTP id 006d021491bc7-68bf09fdb30so363727eaf.3 for ; Fri, 17 Apr 2026 03:12:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776420739; x=1777025539; 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=Kz5Bu0BeG/txOCPikbWqzdVN3e6YMSFPX3T7RJDwt8k=; b=GZJ5S/l7HdbH9tzx7m0Dmg6cKQwXbA6bSOQj3t3FX7deaW3Rm9hlk51YdPjHiqFB33 Vn3vt1cZ14K3sPm8RWLFk+I6UNNqMmmFk+qhcXwOyKp2nLHFYKE1SxgEJ4SV0CX9ugFj F75JVmCU9yeT6lhN+sBiaLAUKy+Gxz/9evsEo4i3cizr4uBzKNbTFk7AUxLarVUZROma 701wp5HnMl5YGL+JJyJI7wCLYiasFhbvZPtLWGnLMMk/C1FMvUIUVYiZQAlsU2NKuPRI vlBwk0beyWfVmIBOQnQ/F9s9tc8gA09pvsxQ3kPbvBQoObovPnY9UosxT1/Kq/vx2w6Y DddA== X-Gm-Message-State: AOJu0YzJz4XmySlqkkfH74h5uu/Uted+HMfU7A6BS3Ql8uS/nCmQgtX0 yxKVljpT/Sh7Ye1pEYS5Rtadrxxef8BOAlZbAvygW4TVT73VgNkohCwt9ssNdvUbfeFQKEH0TJj Gr2ArpWLHoXhqZQ9PigBT9/eqgbJkIRpX9XvvQ/TjcZpJr12RZttXRqB69Ig= 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:220d:b0:685:a433:bcc9 with SMTP id 006d021491bc7-69462f25cc0mr1077210eaf.45.1776420739027; Fri, 17 Apr 2026 03:12:19 -0700 (PDT) Date: Fri, 17 Apr 2026 03:12:19 -0700 In-Reply-To: <69decbd0.a00a0220.468cb.006b.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69e20783.a00a0220.1cdc.000b.GAE@google.com> Subject: Forwarded: [PATCH] hfsplus: initialize data in hfs_bnode_read_u16 and 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] hfsplus: initialize data in hfs_bnode_read_u16 and Author: tristmd@gmail.com From: Tristan Madani #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master hfs_bnode_read_u8 hfs_bnode_read_u16() and hfs_bnode_read_u8() declare a local variable on the stack and pass it to hfs_bnode_read() to be filled. However, when the requested offset is invalid (e.g. from a corrupted filesystem image), hfs_bnode_read() returns early via the is_bnode_offset_valid() check without writing to the buffer, leaving the local variable uninitialized. The callers then use the uninitialized value via be16_to_cpu() or directly, which KMSAN flags as a use of uninitialized memory. This is triggered during hfsplus_bnode_find() when mounting a crafted HFS+ image with node_size=1 and invalid offsets. Fix this by zero-initializing the local variables so that an invalid read returns 0 rather than stack garbage. Reported-by: syzbot+217eb327242d08197efb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=217eb327242d08197efb Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani --- fs/hfsplus/bnode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c index XXXXXXX..XXXXXXX 100644 --- a/fs/hfsplus/bnode.c +++ b/fs/hfsplus/bnode.c @@ -98,14 +98,14 @@ void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len) u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off) { - __be16 data; + __be16 data = 0; /* TODO: optimize later... */ hfs_bnode_read(node, &data, off, 2); return be16_to_cpu(data); } u8 hfs_bnode_read_u8(struct hfs_bnode *node, int off) { - u8 data; + u8 data = 0; /* TODO: optimize later... */ hfs_bnode_read(node, &data, off, 1); return data; -- 2.43.0