From nobody Mon Jun 15 21:42:37 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 2889E18872A for ; Tue, 14 Apr 2026 01:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776131800; cv=none; b=RU3cECDvXcRzbC4E671PxJltc3RNL/bsui6t0maqoRJ69nkdqEEsVs9qx72b43HY38n/5B/WdFkfpQrdV/J9jmZzpOHlJ20HoaCHQ9joGvnQeOP3NFE13xf8oD8arquQjoydbxuYqGww2LoFsebH1mkkIaeKqex2U3go+8UIMK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776131800; c=relaxed/simple; bh=85pNC5vEdgGMvRTfth1N9wOwvmCOSwVjkZ3eUsZZkl0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=l/OjFI3WEktgJEy28zT/lG1AteKP5oV1hdRy31FQgn0EdTPIk7WR2UA/uEDS8t3mF+7HMEj3lZyoN83M6vUbUU1IIpwRxZml+GvtteMJZGTErVCnF2+O2+7ENBeK8n59KfYTfSNavJCZpv3hqqrAvbNDjjsvF1dsD/n84cc/1uo= 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=s1mMfKZA; arc=none smtp.client-ip=209.85.210.182 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="s1mMfKZA" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-82f431c0ab6so679079b3a.0 for ; Mon, 13 Apr 2026 18:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776131797; x=1776736597; 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=YMfYbXP1FT74ETBselWjg6OStd152nmOJb74V1LxHW8=; b=s1mMfKZAHEFWC7Ulf6GzdtsZqvtA95mgwOTiKuaLJpulZrPEaRONZrMrVaVa3vwFPr zcmEi8aDz91ew+xsZQ7lNOIJkP41EUGRCtJmW01uhu8lmwzLXzhOVEYK+mc8wIs4bOiK NaQDbxnSMnuOlKpYSYu70MrE/NwWVkyTp928fS6L1VtAko4na/VWuRZO/fmgxLOz6jxR SIT0vj/4KmkSfvVLFanRRTYCp3DZExdiw8zoRIJLRatIp9v0qGT7IdhbEME/NLg9WmKB Awl3yE/awq/vifLXbcJB4VCWp9D8MBEI6DVd3G/3aPfo0CPLT/c9HFCaRE5BJ6ZmCbzu y+rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776131797; x=1776736597; 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=YMfYbXP1FT74ETBselWjg6OStd152nmOJb74V1LxHW8=; b=bUR1J4T4G8HbsHCYhYE2r/jWfZWatlKlydLCWQ6Z9evEGHxcyceKVs9MCjMp/uFmBd 3ny0mCY48ktCPTg5h8hZDvbTU54vmZfrx/wsci/6ANCQM1KqOGeYfWHNvrqp/0bDANDR NlvQZ1wUp35VPokOPIWQ4AVBFV13qXvkcNbIDpZxHLUmMuf0OM/oekefdu8Bvu9eC5P1 tQC2qrLugxtGvKARILfObLBqiDl1wR0D6+dPzBdMAGlzFrI+mHK3dIz+EaIxcR2efcfL 0w3xnMRz0nLO5/mlukvS9rjTLK7DwyeCE13kzMse48TdEm3jAySyQCh0pmdTIUrYEtrM 8wgg== X-Forwarded-Encrypted: i=1; AFNElJ8jXo/n45yM+qu8YuU/+Jwj8oqLq5iriAUX+8zHcdxaMxtrESB6FfdxmhxOV3rpHP79wZxFXsZDhwNVOw8=@vger.kernel.org X-Gm-Message-State: AOJu0YzMuSauqC3GUZtaLmNogxqLEbidoUaH7vGIxYTD4JybTK6OoN5h FT5D8L9NrTjR64zaT2LSf3KPtM/W52WDu/EVZ3PBahZc6qMaVSkmPMae X-Gm-Gg: AeBDietUtil3ggS8Ik/pf+8bL0UFgzykj4s3PYQZ2Wwb6ecYdo0AlI7xHTHT1uREHm1 M/5I+y4Df12RdmIAk7dJYkXQU71e9w6+VqXxUME79IHco4at1Gdt6YveFVwBsOZOSxq3TVNBl6w 1tL/mPBm72GLGBofmqd2BJN0SMASshrKSttGDiMEAGsKH0eUvxBU4hxwN7dUoG3dkxyFIZw9jhW 2EVHZR+B14xXYssJEh0juGFoo/gC+KQP4OD/4voMSH933LhC2iLu4IJbsihY9OjNAHel7V/3lbI jOO8ESMEJqPBWoS+dtkTI4a/QliBVxvwL0MECN4WUIQPfK8IPrn1KqdE70WSw20gSQLw0UfI1tV N8nrBbuRve+QmkN3LQDFyDmvQtzHhLx/wFcvZ+uxVeppduF5fLZIHqaFXAO/l1s3A2qOCWTJGL0 C7S7UWB1sSgIStJ2SPad90HUOQnPrvS8LFj91iy4c2iAzm8plLIs0qPCCs+eONAnDf88Ou6o7sb 00YulwB8b+Bx2Ro2w== X-Received: by 2002:a05:6a00:f0a:b0:81f:4884:4fed with SMTP id d2e1a72fcca58-82f0c24e21emr14125019b3a.7.1776131797253; Mon, 13 Apr 2026 18:56:37 -0700 (PDT) Received: from deepanshu-kernel-hacker.. ([2405:201:682f:383f:445c:f4a3:a803:e3c6]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f0c4e1a2dsm13070584b3a.44.2026.04.13.18.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2026 18:56:36 -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 v2] hfsplus: fix ignored error return in hfsplus_delete_cat Date: Tue, 14 Apr 2026 07:26:30 +0530 Message-ID: <20260414015630.65081-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 on a corrupt filesystem image (as triggered by syzbot), hfsplus_delete_cat() incorrectly returns 0 (success) to its callers, allowing execution to continue with the filesystem in an inconsistent state and eventually triggering a general protection fault in hfsplus_cat_write_inode(). 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. Changes in v2: - Fixed commit message: hfsplus_delete_cat() is called from multiple callers (hfsplus_unlink, hfsplus_rmdir, hfsplus_rename, hfsplus_evict_inode, hfsplus_fill_super), not just hfsplus_unlink() as incorrectly stated in v1. 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