From mboxrd@z Thu Jan 1 00:00:00 1970 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 6B1983AF654 for ; Fri, 17 Apr 2026 10:12:13 +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=1776420734; cv=none; b=hhTW30kBEZahLvzImehfImi+5QTN22ytdHVeh0t9PR24cpU7tY6ACeQxq0GZLcOujEBbClUskns4w6dBXMwqZUnfxaMzIXxKmnzkohSq+pyliYqZyPLGMgWOBuxBi8Jdw6R5qJJ4tjnT8oK1nELrRsSlEl+/gZd1qIIbKpa8uuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776420734; c=relaxed/simple; bh=MmQqYfIRXowOOgQ8t6zonVggPZkw2f7v/yqAk4I6aNg=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=e9hKFy9ONqz2lrgYkakZO5ielhPeeCEfqi64WQdZh4P/WW//+xvs/AGmoyHwH22ps5KeMW9C9xuI5LATts6zzeqtBIemyl/Ha8FPLX3rLoy7c1MCVDRpp5sWLgeVwHdbY+KQBEs3jVBPQsIwVFYPXNf36SwPsSO3sfiFVhBYPfk= 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-68d7d187379so934816eaf.1 for ; Fri, 17 Apr 2026 03:12:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776420732; x=1777025532; 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=E0gfyD4NdSi0yJkJIbcJArX+WA5x4tfgYMA9K5UO8O0=; b=qVBoAp4Y/457sjPP/d+HQTD8KdvjOJ5vbCOLo23QzRb/wnjQkUy2bTgUwj+3HBzXCq uQGRLMRNPJ+5Wh5RmnMhg0uPdzxAF6md4+Fd+FFTLSxAMzgM3sQTOuzcL18RL9uVOUHN nH3RzddPA9ckDT0zapX9+RxlA8QivwwQplLTgwDis/yi9M8dj9pu/sMtCLCb1bogJJjL Ui7BJUIg7ONhIEY1qnjnffADnp31kz2510oe2RZsWN+WSDfYQZTUzhEAQoukanKTZRsr GUZBepxvanLQZRsuo+RRYXZZncZd1e0PqY9GbF0agwZGa4F7xmeDCjtv6i9nWKYEE7D5 Hr9g== X-Gm-Message-State: AOJu0YxX9DSC9HcboceZXwJ/3WIjs07JeZpdGAWPdOlMqbZeUkY3vJk0 Zf4fONiAbwQr2XQsCsdLsWFfsMZYBr/rKDIW/VpDPzJklDf9u2GFL31xOvCKMWIEniDjjOd3yZP s00CZUOkpC5eM91tLiLek5QU686dwBxeKU+6yUAQj6AhIVRcNwJkuuwQJq74= 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:1988:b0:68d:66a2:4bf5 with SMTP id 006d021491bc7-69462e81940mr1289947eaf.27.1776420732508; Fri, 17 Apr 2026 03:12:12 -0700 (PDT) Date: Fri, 17 Apr 2026 03:12:12 -0700 In-Reply-To: <0000000000001db56d06076f6861@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69e2077c.a00a0220.1cdc.000a.GAE@google.com> Subject: Forwarded: [PATCH] hfsplus: initialize subfolders field when HAS_FOLDER_COUNT is 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 subfolders field when HAS_FOLDER_COUNT is Author: tristmd@gmail.com From: Tristan Madani #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master not set When reading a folder inode from disk, the subfolders field is only initialized if the on-disk entry has the HFSPLUS_HAS_FOLDER_COUNT flag set: if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { HFSPLUS_I(inode)->subfolders = be32_to_cpu(folder->subfolders); } If the flag is not set, subfolders is left with stale data from the slab allocator. The slab constructor (hfsplus_init_once) does set subfolders = 0, but slab constructors only run on first allocation from a fresh page -- they do not run on slab object reuse. This uninitialized field is later read by hfsplus_subfolders_inc() and hfsplus_subfolders_dec() during directory operations, which KMSAN flags as a use of uninitialized memory. Fix this by explicitly setting subfolders to 0 when the folder count flag is not present on the on-disk entry. Reported-by: syzbot+93f4402297a457fc6895@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=93f4402297a457fc6895 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani --- fs/hfsplus/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index XXXXXXX..XXXXXXX 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -530,6 +530,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd) if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { HFSPLUS_I(inode)->subfolders = be32_to_cpu(folder->subfolders); + } else { + HFSPLUS_I(inode)->subfolders = 0; } inode->i_op = &hfsplus_dir_inode_operations; inode->i_fop = &hfsplus_dir_operations; -- 2.43.0