From nobody Mon Jun 15 21:41:14 2026 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 ED6E725EF9C for ; Tue, 14 Apr 2026 01:13:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776129192; cv=none; b=LNKzt9Qq6kI0AMKrX5151c2sN+2JFF2eq8iqiLjYR6Qf68nTj6tYsydwldLzLqKgUa6yY2j0WO1+Dnpbe4SqJKgbFaGvveyW1hUQCaL2hjXskzPW82jS9mvwVxUDnRwDKtQqd5CKWVMGl4KUSYe3vjWSKiQgSUg8nvFZeeCI2pI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776129192; c=relaxed/simple; bh=/YNbRbuUn0se/eOxh9EWYDr7/E/hoK/hBbsC2Ksi4s0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OpsU/uH6Gw6f7/K71nCawHwCYfjGpbCSEpNMXZ8zNTZRU+0wasdL134/bNeUcgY6Yac3TJuakJHeIq3fVr4lnLbW/B+y8v4tNUO0Qe2blp3iM7jcPb467JM6gOVlzV0OfYPCeUC4qBNEDunr7pN+7p+IvX1/JCGEU8EefNj7BiY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=pmAxUGF+; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pmAxUGF+" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-3590042fa8eso3693061a91.1 for ; Mon, 13 Apr 2026 18:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776129190; x=1776733990; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=K2UbA4pmTQcH00NyW6Az7G0FxPyEU3JCK2aV1c8PuUI=; b=pmAxUGF+SEFeXZlvIdYJ7WRv9ZpLK2BN0woJPBdKx/vXbhNyY60p5+HdjeiAyFb3Ta gignrqSy7lsQoMPBLiSPttWd+U31LNn9dDI4jRgybn8z+zTtyry9ZycgGa07DslYayWs UCiwqNQ4X+si8TYBdpYroM8vvav3rdpa340RrQo/V8XSJU52o5wuUydo625TpWq+6y5M rg33yjZpBgqcQyVAe4gRUI66YySyWMqbGdDlW58cQuTaQMlecO4EAIxoMQt0jYzqnyJj KJiPk068F55YU6ixuSi7hCRTUc45Egt0G4OVq2p/iIxy+TXnX2zu199fqlDw2Qs2R50H 0jCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776129190; x=1776733990; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=K2UbA4pmTQcH00NyW6Az7G0FxPyEU3JCK2aV1c8PuUI=; b=H6299IFlkEpR/omRvBVx7pZ0aRuH93K62Q8tVxHhGI3JwDj1hdmG3D7ewvRX9ikWb4 8aGSLQuHI9sXvcudOSQDH15mNznKPtwYGoh/CugFavsG3tbQ1vDTN++bIr5PwkOMJiUg cQ5r7pdpaQTxO7OJhv+2asGOt6dL523y5mxgivM+OM0Hi/FXGqwbzc0vTohy5btlUn1F DWlCSlfJgNGlLQLlSRQ7aZyL5w3alPyLDHNvKcxhjKAU45CnVufsBkUHHlCinRCIqac4 0JehKjf9DzWDCkoi3ZuQ/kyfzpL1eKIRAPBxNuWs/EgtiDDqO622Mufrb8A1cN5GDRha A/6g== X-Forwarded-Encrypted: i=1; AFNElJ8UEt6ay+/NXjRtb3jG/P1k9TQln12BdOu3PE5MZ89+sNxTGy0Dvml3wDc8/46DFMpFpNyDZNnjBPQprU8=@vger.kernel.org X-Gm-Message-State: AOJu0YztDEI13CH49Zcl+GIO9DmpIhClWC3VGy2Rq8LsKmvIWKV/qb5m 0vzCuEDWhW8cb9YPEFWchTSqHw90bTBcRzdWEq/yZpJGJ/XERUhVdUY9 X-Gm-Gg: AeBDies1JAKxcHB1dGJj+DcCNwX3C2uVWHamGls+PWM+OMaTgF7CwIOZxYDYQsoCFgU C22eDzqxuttWmosjFOiskB4WShjSntuC6rB859CxeJkB+BIMUVaN1+fqsVKrtFHL2tc6UKSKUfS fgjWMb0eVFCigeg+RkoKOE9+LI5f0MVeYXgT7pvIGG3ARDron6VfRUbCawr6FUi/S29lCD0y/tF CG/bHCAeQEKq86WwLOdOluHvJQogLMrL05yx9COYYiFnf7KegxdqpDimW5EpJajWBJG2FPCN6Gq R1Q+9byyiN7l/JPBG31bYZMjCJ07DmsOz6mAtzn0DjwfVXJiMFtUUheClXgmqRavmgHBRVMKqE/ 4Nd8zDoeHj866PBMkXySUL/RWWdp+jZvLNbR2evu8bc081nGVKlLQTsvtOf5g7CKZEC6+kBmFPa 7UtK7dWqa0sNSLk/Sp+Bt2DwIVunx5aJEKMr55Osf7Q2kHh2qtEzZDCd+wQ12N9GJqLazCxamLP osj3BIYzsOuESIlCw== X-Received: by 2002:a17:90b:1e08:b0:35f:bfdd:f5a1 with SMTP id 98e67ed59e1d1-35fbfddfb16mr3220626a91.13.1776129190256; Mon, 13 Apr 2026 18:13:10 -0700 (PDT) Received: from deepanshu-kernel-hacker.. ([2405:201:682f:383f:445c:f4a3:a803:e3c6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35fc6e8ca0fsm251344a91.14.2026.04.13.18.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2026 18:13:09 -0700 (PDT) From: Deepanshu Kartikey To: slava@dubeyko.com, glaubitz@physik.fu-berlin.de, frank.li@vivo.com Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Deepanshu Kartikey , syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com Subject: [PATCH] hfsplus: fix ignored error return in hfsplus_delete_cat Date: Tue, 14 Apr 2026 06:43:03 +0530 Message-ID: <20260414011303.61374-1-kartikey406@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Fixes: 324ef39a8a4f ("hfsplus: add support of manipulation by attributes fi= le") Reported-by: syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Dc0ba772a362e70937dfb Tested-by: syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com 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,15 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, co= nst struct qstr *str) hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); =20 if (type =3D=3D HFSPLUS_FILE || type =3D=3D HFSPLUS_FOLDER) { - if (HFSPLUS_SB(sb)->attr_tree) - hfsplus_delete_all_attrs(dir, cnid); + if (HFSPLUS_SB(sb)->attr_tree) { + int attr_err =3D hfsplus_delete_all_attrs(dir, cnid); + + if (attr_err && attr_err !=3D -ENOENT) { + pr_err("hfsplus: failed to delete xattrs for cnid %u: %d\n", + cnid, attr_err); + err =3D attr_err; + } + } } =20 out: --=20 2.43.0