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 3C86135B658 for ; Mon, 13 Apr 2026 23:02:51 +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=1776121372; cv=none; b=e4M4jKSzkBcaL3mCsUK6u890SFQyT8SKhrEun4gV/gueHWoMX4sJuTY3ol7ybhjaSSU2sETGwG8VngKaFAfTxb0opgbj4ryF7QXwka8/kaz3WgINoVc22ugqDOF/khnXmqgBdlyuiWNCK5EwIaXH8Qfi4DT2lHm/efRzUc5spLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776121372; c=relaxed/simple; bh=AvMNhU1iKPD80lfiLKfjqsOsMlPPQY57ERy/RUYoMUQ=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=XTYt11+WYxY45TAoxM+mE9qyAqmQ9X8NeThZYRm005vjgY0uFgbG6p9+qrQoqGRywnpAXnur+V8X93sjEyMlviLTerhncnOG7ijpMRJ3VNuQmIAD89oJgjLApqfTTZxxNXpZxXsbGf5izJo0igqPBdfdiJvMskcyAT0Ciw/fUg8= 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-68d7d2821baso5893940eaf.2 for ; Mon, 13 Apr 2026 16:02:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776121370; x=1776726170; 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=q0sPiGp+lPyNdCHmEOzmNWlRjEZgbkAgZPrUVM2pVJc=; b=QQ7/58liXO7Rjg7l+B6wwoDr6vI8nWtSb9uQXH3B7I6JobD5Dt53LPflnxjFHJpHZd UsPX6YVAcKMxTtivZGXIPUiWUfDnlYNpOTTUuQg9ZhNekuCEPyq4t8BU1RCp1CSUIFk8 4/GcdAR4PAC5SWlmpVRrUjDbEFmdNIGMUy693pQ+27bRrQOtz9ZY2txt8K6tVFsGDcHk F8OGifha/4Z5izMarhRgpf05HdtOpi2PKK4UzRAS4vrPX94a5b+wIi1KR6naHYAd+80i jTwOjZu+pSMG3xwy+UiQUr2eKgaQgmfH+U+m2SqTQ1KBqEpKH6E1BuDGbMzyKKl3AopN nhbg== X-Gm-Message-State: AOJu0Yxdni8qwgdhmitX8KlfDBz8utpot3zO7SKi4Tqn+w5288QGcILc KygRvy2MHsp+Z5W5QgO50X8lahAREp+eipRYngmiLT5Zodcx1uptqKDoxcI5jmWURrb7ug3b8Cz Qo7hnqpSz0cUj5/TPf21xToVpcTSmrEg/UhktVYxjDqEHX37Ov5Rw5btZeyE= 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:4b15:b0:67e:2ff7:2a6e with SMTP id 006d021491bc7-68be6335cf7mr7948760eaf.18.1776121370171; Mon, 13 Apr 2026 16:02:50 -0700 (PDT) Date: Mon, 13 Apr 2026 16:02:50 -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: <69dd761a.a00a0220.475f0.002e.GAE@google.com> Subject: Forwarded: [PATCH] hfsplus: fix ignored error return in hfsplus_delete_cat 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 ignored error return in hfsplus_delete_cat Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master hfsplus_delete_cat() calls hfsplus_delete_all_attrs() to remove all extended attributes associated with a catalog entry, but silently discards its return value. When the xattr deletion fails due to filesystem corruption (as in a crafted image reported by syzbot), hfsplus_delete_cat() returns 0 (success) to hfsplus_unlink(). hfsplus_unlink() then proceeds to call hfsplus_cat_write_inode() on the inode in a corrupt, half-deleted state. Inside that function, if HFSPLUS_IS_RSRC() is true but rsrc_inode was never properly set, main_inode is assigned NULL. The subsequent dereference of main_inode->i_nlink triggers a general protection fault, caught by KASAN as a null-ptr-deref at offset 0x28. Fix this by capturing the return value of hfsplus_delete_all_attrs() and propagating genuine errors back to the caller. -ENOENT is excluded since it signals normal loop termination (no more xattrs left to delete) and is not an error condition. Reported-by: syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=c0ba772a362e70937dfb Signed-off-by: Deepanshu Kartikey --- fs/hfsplus/catalog.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index 02c1eee4a4b8..adbaeabc06ab 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c @@ -421,8 +421,14 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str) hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) { - if (HFSPLUS_SB(sb)->attr_tree) - hfsplus_delete_all_attrs(dir, cnid); + if (HFSPLUS_SB(sb)->attr_tree) { + int attr_err = hfsplus_delete_all_attrs(dir, cnid); + if (attr_err && attr_err != -ENOENT) { + pr_err("hfsplus: failed to delete xattrs for cnid %u: %d\n", + cnid, attr_err); + err = attr_err; + } + } } out: -- 2.43.0