From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.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 514A03A9D8C for ; Tue, 14 Apr 2026 23:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776209788; cv=none; b=EF3qk/ZJor+WOdpb4t9J2NI3WooRMcH8KQj1LfNVLw1DtfmD2e+X4M1zIKSmfQny0a+wEBJA+j/t9VSSAYBPKtZStCFm/ZQ11B/0zPIiRbHcaawUV0FI1yy6vaCT+QMv7Xj2eZYm5FTwsAxTg6ft6v069kELWT3G/CrKNPZG8GE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776209788; c=relaxed/simple; bh=RYsffdnAGtL1x5a544jvPr5pACN9BnJF4NU+PfUWL0o=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=Zikcyii8vuZuW+D+4ssGXJFwE/i5Sp5OpIL7iP7bI29iokXQWz5yRQl6sEydnv6r60tLmQEydYe9dka7sgjDWe5P+9PyYU3GfmP9ju8MVWuv7wYq9458q9XQdzg4aoYsQ7N8ToLEbPDfvDA09/K203dOa2XlrWyp2WQxm/Kz/AM= 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.210.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-ot1-f71.google.com with SMTP id 46e09a7af769-7d4d4db1523so7353012a34.1 for ; Tue, 14 Apr 2026 16:36:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776209786; x=1776814586; 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=Oybc7VYx8R7pQlFXQUYCebm4hEA7PskMwL0jah8RRiE=; b=mNZ8NXmlFnSkaQM90Wc9CUmThJa/cBk/hjGliL10rJmhN10GCtDn9Hu4d37Utk3Teu e5GD5OKiFjFj8kPZ4lPU/MRaWqB77kBjZ2GTySoW1ePdk5Zrmai+6MZmP9fyihdJaELL /4aLx4ptXpkKM5TBd4bNd2xgLz976tuPEVD1mcovMWE3f3fTesB6344ztjJiUyp9yf50 s8bAdI/UqQcikDPGhs4wQhTJVmJ69fupflyMMYE+xpEzzl64w8v2xZqnu5hkTcTIdQjs 2AAkhgZ13C9UHQlaoofdSf+Phwubst8zP6+VhrXGXUyd5SAqrEs4ceMDLL51hTrujetP 4XZg== X-Gm-Message-State: AOJu0YwgWvrM1xWBsem6wqM+bBZTDNVY5vedLG+WkTvDKQZ9ItJgROGQ 2nEwhMoqn26GfblD+JOs7Aswivj5lEk82W8DgU9qt5RI3sNmI9wFDNOdUc9YfYKqLh0vN75gLYf g1voNNV3eO50L7D3LgQrIaeBFDKeALC3wVi+Iv8sElpFO6Dvtv9TDIdzOfYg= 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:6ae3:b0:68e:d9b7:7a2e with SMTP id 006d021491bc7-68ed9b78f0dmr5969443eaf.24.1776209786255; Tue, 14 Apr 2026 16:36:26 -0700 (PDT) Date: Tue, 14 Apr 2026 16:36:26 -0700 In-Reply-To: <69dd652c.a00a0220.475f0.002d.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69decf7a.a00a0220.475f0.0046.GAE@google.com> Subject: Forwarded: [PATCH] hfsplus: fix null-ptr-deref in hfsplus_cat_write_inode 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: fix null-ptr-deref in hfsplus_cat_write_inode Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master When a corrupt HFS+ image is mounted where the hidden directory is absent, hfsplus_fill_super() handles -ENOENT from hfsplus_get_hidden_dir_entry() silently and continues with sbi->hidden_dir left as NULL. hfsplus_link() and hfsplus_unlink() call hfsplus_cat_write_inode(sbi->hidden_dir) unconditionally without checking whether hidden_dir is NULL, triggering a general protection fault caught by KASAN as a null-ptr-deref at offset 0x28. Other call sites in dir.c already guard against this by checking hidden_dir for NULL before use. Apply the same guard to the two unprotected call sites in hfsplus_link() and hfsplus_unlink(). Reported-by: syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=c0ba772a362e70937dfb Signed-off-by: Deepanshu Kartikey --- fs/hfsplus/dir.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index d559bf8625f8..a7feef53d8cb 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -362,9 +362,11 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, if (res) goto out; - res = hfsplus_cat_write_inode(sbi->hidden_dir); - if (res) - goto out; + if (sbi->hidden_dir) { + res = hfsplus_cat_write_inode(sbi->hidden_dir); + if (res) + goto out; + } res = hfsplus_cat_write_inode(inode); @@ -431,11 +433,10 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) out: if (!res) { res = hfsplus_cat_write_inode(dir); - if (!res) { + if (!res && sbi->hidden_dir) res = hfsplus_cat_write_inode(sbi->hidden_dir); - if (!res) - res = hfsplus_cat_write_inode(inode); - } + if (!res) + res = hfsplus_cat_write_inode(inode); } mutex_unlock(&sbi->vh_mutex); -- 2.43.0