From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0CA8C34DCD2; Tue, 26 Aug 2025 14:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218895; cv=none; b=q3s9kwDIu9XSgGQPLQRVClGocunA6V8rmUbZwXlxhHMZNFooU7/FHeV3wpOzbPuiLvroPeGYMAxf4WNNKdsA9zo4P68gUoTpU3UPRrJlNWl4F/NX99Vw13Xh4MRyaEakiat65wO1I/j++AOkFZvnFJDnvag/ONgIK0qFfPHgTig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218895; c=relaxed/simple; bh=0V3/Kz2KEv2wZP5/n47M8ce6RVFmPVz/igpIVntpMsk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oi+ioNerdxubsxCIyzTcyKHeydf5d0ZR+tgLm18wlffj0R0BTgtj6F3E52rDjEHU7v5adDQpWQaQMXd53i7pQKypymlGSAmakNMC/coa2WJeJWAxP862eG1wEBenA909y1sSTQZAc4N23/sq5HwewQutyhacvSAiJbjx+/RoD38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XQay+kL1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XQay+kL1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91D5DC113D0; Tue, 26 Aug 2025 14:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756218894; bh=0V3/Kz2KEv2wZP5/n47M8ce6RVFmPVz/igpIVntpMsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQay+kL1hZD7p+y47xmtOQPjhgOh0j95//J7YZI+uEPJUKNqUcapZTlLdD0mmsPKh U1d4w58hPXYP1T/86Lks4u9CehJhVXLPy3KeeOrO+LovYS5JOyvaZngfG6IOF/OVt4 08zqEJf3qFBNMSnpZytb0wn0XPivzKdspl/Qen+A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot , Tetsuo Handa , Viacheslav Dubeyko , Sasha Levin Subject: [PATCH 5.4 174/403] hfsplus: dont use BUG_ON() in hfsplus_create_attributes_file() Date: Tue, 26 Aug 2025 13:08:20 +0200 Message-ID: <20250826110911.696163012@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110905.607690791@linuxfoundation.org> References: <20250826110905.607690791@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tetsuo Handa [ Upstream commit c7c6363ca186747ebc2df10c8a1a51e66e0e32d9 ] 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=1107451c16b9eb9d29e6 Signed-off-by: Tetsuo Handa Reviewed-by: Viacheslav Dubeyko Link: https://lore.kernel.org/r/7b587d24-c8a1-4413-9b9a-00a33fbd849f@I-love.SAKURA.ne.jp Signed-off-by: Viacheslav Dubeyko Signed-off-by: Sasha Levin --- 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 d91f76ef18d9..2438cd759620 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); } - BUG_ON(i_size_read(attr_file) != 0); + if (i_size_read(attr_file) != 0) { + err = -EIO; + pr_err("detected inconsistent attributes file, running fsck.hfsplus is recommended.\n"); + goto end_attr_file_creation; + } hip = HFSPLUS_I(attr_file); -- 2.39.5