From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 C58912E0413 for ; Tue, 14 Apr 2026 01:53:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776131605; cv=none; b=JLKWqF0HhjHvpcDsJnP22KBwhBrdSO5eBLKkCSlZzs3/kPwyV0YJkSwTD4CzafBKeRHd4UjY9Z7fW9bGTv0dg+rJWNREjXnOZ3yIAYrfSMuAmIRgfSkn95CQi21zUHNZAixxODF2P15cHmTbzVctnZnqLCwDTcRlYT3eIMqtVRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776131605; c=relaxed/simple; bh=73PTIOzEApyKbESlUFkgG/fKbUVItu55gtgkI7CqDUs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Vpn8PogvAUpKGaMJALCrM7gwVFBWyBdAWZU3S0Zhb/gBLCbUGGIdBNHSP/aJnVOHqDyCJ0K2c4deRZ8VhCmuTv+Vg8hYiJ5hcnomr7cXlm+0AdBghjILHJU71Cd6db7s2XhZBjopi4AZDEFqhZiYtywDLx60Pgu++w5db8Ou8OE= 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=fznxDZ3f; arc=none smtp.client-ip=209.85.216.43 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="fznxDZ3f" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-35fc0d7c310so586427a91.1 for ; Mon, 13 Apr 2026 18:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776131603; x=1776736403; 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=M/FyreqTm+YT6hCujD3FTmSWTkYhr7dO9Go7aHpZvck=; b=fznxDZ3fXt0aqNNyEZvcJEqIBU0ylc6rw1QiAlrmwy1+DzrwubvQ+tsP/RmbZg25tI YDfZlNu3ltJujEkanisEREAtWII885HuVtce6JWgKm0TqxEeYRaUnyHEJFdBjwxttYrw cb5wStfec7ElgnBGawuynnej8lcOHFfO54c4LypX7kEOtPgoSx3EVZmjz1/aJWa3ujoe CN98HEwrc7l5crl+PAi83YK8HjYrWIy3CZh9miiJ/uV+bVtPDdNObsOLWtpq+wOZ0fl4 EhbMmnNqThc7Kmf/4ZNHMJVfJkiqKXne/Se/3EuzDD5S+DJ+cZ13VZ4lFUrVpgiCMecZ D59Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776131603; x=1776736403; 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=M/FyreqTm+YT6hCujD3FTmSWTkYhr7dO9Go7aHpZvck=; b=TnXj5s1G1BoyRhYW4ZVWONjJNaPSG1R89aEN01I7l801IhQ3b8eMG6l9HmOk1mixDA 8eO9oxQ15FVVaA8r2ptddKxsiWOkYdCVlbbEj7NuoTgptzpFs9nDboW1atDvU3NkzhUx AUMEuKrGYHrhTiVql+TXuAHF/BJsS5BdXts35RPC6Zi+I1yXkoqQX8k9aWjYExY5PUEE PuZyZh6rjCOoxwQ/mGpn8IN1/YTKO2CoDIGEdkWQxj0RMhfyKP8SAjEtoXsgbLOpAs+2 c2Pu1CJ3DqJCFBfs1CQADSLsYndwA7sitdQXyTP/pntZuJJ4/0E89g1YC3eozmIz01Id LUUw== X-Forwarded-Encrypted: i=1; AFNElJ9rwPSTN9OdHAlO2rncD25F3wI2R5E09R6D+ILveJ/i1fpp4rxbyoGcN1jEu9B8+nsqw1HCqcGbBd1vvXI=@vger.kernel.org X-Gm-Message-State: AOJu0Yyw5kN25RAW18HGzeGTi7mpu6B9+H52FpuRYgTzPhJUA/zi2yW3 HEDQEv/cPLIVA3ejoOiclb0EihJnduvCerIchiBuqBPkGivR88A8dxoD X-Gm-Gg: AeBDietSP/RngOv1nE6bBc99rNJ73q18c8znvAdEdJqX0S1QzaPnuojg+7tUfAazY5T IokSsGIz6sZ4ywIuTv3Bfa2GanwI6FOU1jCWzvy/lQap2Ir5OkR98jAHS1K/neH6xO2kPFVPFpN 14nkOYK3ESlXjioidW0iTXEjyXKDiR5JRllaB7YPrZF0p0/lbKEI7ebiL5ufMMcJDWYKw1Fba+j kjDYmKo/FbnFxRmA7iQInyT4wBWJHHY9Vu+XdwHUUEW0Otc6ksMQ0mGWxrLH/iJxei7Z3ozItpP wl+OjIkT/8LcLqlkh61cWtALPYfpVFvQw9g6jvuUWo8iRYOt8CyyhpYINgYxfzhPCNgMnSUXWqA lfb3wE48SeYu826h/2Hc/8g7CIJMX8S9zUpDmBXAl+ZzxSi4ZYwRbQydJvRQCSNg3yQI8vL1pQT cOsVoqDi0C9NNcfcDTgm1wZUTlciCQ399riJZiVdjQG7bcIdhHRm25WnyjFxIf4Ho/OkE4I/NwM scTcsC6DCqybfQf/y6aiE5+SuFe X-Received: by 2002:a17:90a:38c1:b0:35f:b5df:448 with SMTP id 98e67ed59e1d1-35fb5df0c31mr3797552a91.24.1776131603052; Mon, 13 Apr 2026 18:53:23 -0700 (PDT) Received: from deepanshu-kernel-hacker.. ([2405:201:682f:383f:445c:f4a3:a803:e3c6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35fc6e8ca0fsm332332a91.14.2026.04.13.18.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2026 18:53:22 -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 07:23:15 +0530 Message-ID: <20260414015315.64954-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: 8bit 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. Fixes: 324ef39a8a4f ("hfsplus: add support of manipulation by attributes file") Reported-by: syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=c0ba772a362e70937dfb 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, 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