From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CB103064B2 for ; Tue, 14 Apr 2026 19:29:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776194977; cv=none; b=kr8hhD69SbbgiHuWBJp1b1NxpNjKyVqX67hiP3aDszU/cdF+wfYS/T9O5NgYEwLgAModyXvknjc5CR26vUHspr2NdCcOUlMlxYC/4xRviU6zJIYBBPCZzJFf/BIb38B7pZ2Tf6uEmaOiAoFTsRkItBgxzRny3kbAkB+XthLd/8s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776194977; c=relaxed/simple; bh=18jf9Es9xLIQexRpw6/Q5wgPDX3/hTUkaWFr0fhigAg=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=jmAbteaTYBNAjlR3Ukg30+czOK8H52rZwU0HssmxeppgnqSFsrZaO/YmVDYaOImkiM4YX31jJkGaAERmGcS9YPp+5gqpR63wztASw8AvYMfDdmH9YSI6CSK65Q2vRqKYthh+OLPS2aFtUgRYFxedlSo4LLREKeOQtLvqdyZ5Xug= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hsvasi80; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Eo8Cqcav; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hsvasi80"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Eo8Cqcav" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776194973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lOyAxml64xkpl80S1+G1dwmhjQXPrpMGBGP1sr394fs=; b=hsvasi80fgMho2ZvwRmDOFd0atQ/s+vOnyXSjxj+lrK9l2auwO9iFciBWHyXedsJ6amH1B 9z3AUrTEo6kHOEkfmNaEzPK04194/ob4zlihBimTkwmJRNCdpQXoMN+mVDOf44SoLxVlZH u+SCFcqzayblD3n0AgnYYOWAB3zQ6o8= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-35-ooAK7IJ_MNSDRIOX2JE2vA-1; Tue, 14 Apr 2026 15:29:32 -0400 X-MC-Unique: ooAK7IJ_MNSDRIOX2JE2vA-1 X-Mimecast-MFC-AGG-ID: ooAK7IJ_MNSDRIOX2JE2vA_1776194971 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-794b240c0d3so204795657b3.0 for ; Tue, 14 Apr 2026 12:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1776194971; x=1776799771; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=lOyAxml64xkpl80S1+G1dwmhjQXPrpMGBGP1sr394fs=; b=Eo8Cqcava6ln9yqOIPIQowHl3phMKEKAHcPyynACfC7flseBICv/L52u80yXmbSfo3 TUNh2t2doO8XM86iBZCsvXNdo57YjGUvKtPb1t2t3YDMvlYsUtbCE4uRiQkM2kHxvmm8 G9W8WKBkxRr2LcnUW2p9hxR0VvVS/C02GT9u1ejf58j9zN0/uK8t2Ig4InqrlpYHZRX5 MAh8H2bihJ+oEbwLgl6ZDGjKTpUM8oZtrsFfYrjiU7Yw2wYkAoqReCrhAeu7VqYiIKQb I/HjS73Ic2Ifkc+qINnEyMWZKxyLpDpmhF45SqY1n8g+OFoV1y0FOZiZpFzSIQQREBmp 42LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776194971; x=1776799771; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lOyAxml64xkpl80S1+G1dwmhjQXPrpMGBGP1sr394fs=; b=g3h0QWdwTUnsMqWzx/22FQkC9OlQoC1XMjZzKjcO9CnPafY9RbVxrT2tNhk6CFuPs1 nFU+zQ9NrYSjwNkBYTLRA9DUj/84b/7qsm/9LBXU8cZqM+rR5OQm8muaewrQ0sIbWGUL LHUEHSfowd2/93fED3W5PbA+q5pF4AwXAPtA1+WkT3L6YHfeWI/DQs/LqyAD9e2Ohwhd mEyXGPf4g0JL95cBrbxt6L6Q+rNLBnxtGzmBuEVKV6JGf9xw9RYaTDqIxg0RNmycCPTl 20hOpgzeTxjvHhIkFqzMRioOfQjit8/UpFCC9PcLidfuNjnjeGr3ayG8bg4yCFDgW5M9 fLuQ== X-Forwarded-Encrypted: i=1; AFNElJ+BYUVZ8qqU5hqtBuaXsIJOelx1PqblwTBH6eSIcIbeYBazGRs6zqTVlxgTyQ0EYYLhwa5mqeMboL0PjYk=@vger.kernel.org X-Gm-Message-State: AOJu0YyoeEYEQMxXNiLhDPtBoQ9krzHCfw4f8ZIPZEguEfIpkuxazLQV gAsKxXV54vOe8Z6fNZHQgJvBeGW/Tu7JRf0Nc8mgjxAeO+OVmxdoWGKylBf7fT75N7OxbEF8tGX cMhVT9pd3rtDZQxosig5NgAOPckFaXts7rW6toDVXPWWBixRk88eu9+p5T1qKjVPVCg== X-Gm-Gg: AeBDieuKWl0LqV/cSbFgQbn9Tl8AWgZ0XCPbzUkRuGPC8ry4K74pmecpzgGh/jEMBZt KZUsFwzlDgrHdEsQ+qWRJ5MR706rSdmmjVvTzrTAZIxeyzA8388F9unYf9hHGw8SHe2CSPK0zM0 fa3CrxFfTMqRY3IYizxClSeovH55jFjaKkawzLVMGRt2HcXt9f3LbwAypJ4cUNmO3yKw9gEkq4L FlhxyaUg/sSqZbbU17/0YkdsjLklgwZKcDujBo0Dug1fSJoVnV0JgAZlCKFngQhkZjav5iM/R90 GCOFkbsHPdsgsXgy969AVK5kqmthcMnMtCcpYBNBgAraIWgE3jY66JaNkJ12uIx7Tspye8uuw6E qUaLjs8dE8VJQHD5SFtrH+DGbI5HlOnO8jBjnf+eKAj0zgiYAmBAqe8BK0mHsnEk= X-Received: by 2002:a05:690c:10d:b0:7b0:4bc1:d713 with SMTP id 00721157ae682-7b04bc1e0c3mr147975847b3.23.1776194971371; Tue, 14 Apr 2026 12:29:31 -0700 (PDT) X-Received: by 2002:a05:690c:10d:b0:7b0:4bc1:d713 with SMTP id 00721157ae682-7b04bc1e0c3mr147975717b3.23.1776194970897; Tue, 14 Apr 2026 12:29:30 -0700 (PDT) Received: from li-4c4c4544-0032-4210-804c-c3c04f423534.ibm.com ([2600:1700:6476:1430::29]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7af3fdff108sm71623247b3.42.2026.04.14.12.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2026 12:29:30 -0700 (PDT) Message-ID: Subject: Re: [PATCH v2] hfsplus: fix ignored error return in hfsplus_delete_cat From: Viacheslav Dubeyko To: Deepanshu Kartikey , 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, syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com Date: Tue, 14 Apr 2026 12:29:29 -0700 In-Reply-To: <20260414015630.65081-1-kartikey406@gmail.com> References: <20260414015630.65081-1-kartikey406@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43app2) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2026-04-14 at 07:26 +0530, Deepanshu Kartikey wrote: > hfsplus_delete_cat() calls hfsplus_delete_all_attrs() to remove all > extended attributes associated with a catalog entry, but silently > discards its return value. >=20 > 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(). >=20 > 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. >=20 Frankly speaking, I don't quite follow how your fix relates to the initial problem? vfs_unlink+0x272/0x6d0 fs/namei.c:5476 error =3D dir->i_op->unlink(dir, dentry); hfsplus_unlink+0x57a/0x930 fs/hfsplus/dir.c:435 res =3D hfsplus_cat_write_inode(sbi->hidden_dir); RIP: 0010:hfsplus_cat_write_inode+0xbe/0x8f0 fs/hfsplus/inode.c:637 struct hfs_btree *tree =3D HFSPLUS_SB(inode->i_sb)->cat_tree; It looks like that sbi->hidden_dir is NULL and this is why crash here. But how have it happened at first place? > 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. >=20 > Fixes: 324ef39a8a4f ("hfsplus: add support of manipulation by attributes = file") > 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(-) >=20 > 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); > =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); It looks like that this code is generated by Claude AI or something like th= is. Thanks, Slava. > + > + 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: