From nobody Tue Oct 7 03:48:58 2025 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (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 1FE39260580; Tue, 15 Jul 2025 05:18:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752556708; cv=none; b=PmNHT5iMPMKFC+TjysFNxxJdcGnvL7Udkz3muF3Pd6rn+mosILx8RN59+hMX/WJpCu7HOH10Et2Dz24PJOxbV2BZS3Fgpsr1CJW8rtAR5JI9Jrx8DKUI8De15v2X+v5T2wdFk993qPf06BUE8+DQsiLLKfECXyTzyRJPp0JQPt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752556708; c=relaxed/simple; bh=V7YR6XFnZpQsMgISoY1pYpl1rtvTcBvxb02xYS0bsz4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uZLpMIODKBhKZr2ULkL7BeVhxp6S2gjuM4ypYe9ZbJjMJq8rnBGHVYFRQrAoODQSvETxshq5pJ+RI/X6Z5vDGLvRRexSSFQT5efLVUWvXczIMlZsSMkREPZScXOFBrMZLvV56j/fSUi1I5TfUW6bQuRYlVJl/BDgYSgnCEiWMxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 56F5Hvnw089690; Tue, 15 Jul 2025 14:17:57 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 56F5HvkX089687 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Tue, 15 Jul 2025 14:17:57 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <7b587d24-c8a1-4413-9b9a-00a33fbd849f@I-love.SAKURA.ne.jp> Date: Tue, 15 Jul 2025 14:17:56 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2] hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file() To: Viacheslav Dubeyko , "frank.li@vivo.com" , "glaubitz@physik.fu-berlin.de" , "slava@dubeyko.com" , "brauner@kernel.org" , "akpm@linux-foundation.org" Cc: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <54358ab7-4525-48ba-a1e5-595f6b107cc6@I-love.SAKURA.ne.jp> <4ce5a57c7b00bbd77d7ad6c23f0dcc55f99c3d1a.camel@ibm.com> <72c9d0c2-773c-4508-9d2d-e24703ff26e1@vivo.com> <427a9432-95a5-47a8-ba42-1631c6238486@I-love.SAKURA.ne.jp> <127b250a6bb701c631bedf562b3ee71eeb55dc2c.camel@ibm.com> <316f8d5b06aed08bd979452c932cbce2341a8a56.camel@ibm.com> <3efa3d2a-e98f-43ee-91dd-5aeefcff75e1@I-love.SAKURA.ne.jp> <244c8da9-4c5e-42ed-99c7-ceee3e039a9c@I-love.SAKURA.ne.jp> <22cddf1f1db9a6c9efdf21f8b3197f858d37ec70.camel@ibm.com> Content-Language: en-US From: Tetsuo Handa In-Reply-To: <22cddf1f1db9a6c9efdf21f8b3197f858d37ec70.camel@ibm.com> Content-Transfer-Encoding: quoted-printable X-Anti-Virus-Server: fsav403.rs.sakura.ne.jp X-Virus-Status: clean Content-Type: text/plain; charset="utf-8" When the volume header contains erroneous values that do not reflect the actual state of the filesystem, hfsplus_fill_super() assumes that the attributes file is not yet created, which later results in hitting BUG_ON() when hfsplus_create_attributes_file() is called. Replace this BUG_ON() with -EIO error with a message to suggest running fsck tool. Reported-by: syzbot Closes: https://syzkaller.appspot.com/bug?extid=3D1107451c16b9eb9d29e6 Signed-off-by: Tetsuo Handa Reviewed-by: Viacheslav Dubeyko --- fs/hfsplus/xattr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index 9a1a93e3888b..18dc3d254d21 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c @@ -172,7 +172,11 @@ static int hfsplus_create_attributes_file(struct super= _block *sb) return PTR_ERR(attr_file); } =20 - BUG_ON(i_size_read(attr_file) !=3D 0); + if (i_size_read(attr_file) !=3D 0) { + err =3D -EIO; + pr_err("detected inconsistent attributes file, running fsck.hfsplus is r= ecommended.\n"); + goto end_attr_file_creation; + } =20 hip =3D HFSPLUS_I(attr_file); =20 --=20 2.50.1