From nobody Thu Apr 16 02:01:00 2026 Received: from lgeamrelo13.lge.com (lgeamrelo13.lge.com [156.147.23.53]) (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 281FE379ECC for ; Tue, 3 Mar 2026 08:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.147.23.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772526612; cv=none; b=C7lAmzLNvNyGyTNA4utJsUSYtVV3rTrI03Lc4ck3P1gMWrG6fpO15VqHpPUU6xiW5Cd9nMLO4iz9gKKGRLW0aXDTvkptwSlhpvsqrs7v7xNlAYD+VgRk725Tqydm5Q5vK3zWHWy3vFm0MjnNp/nlNpW6sJMzuwQWcJr4PNxItBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772526612; c=relaxed/simple; bh=G2IGR9gNph6Q5iOaLhO3exspOvBvq/3N3sHkTTdDCLs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YwVZ4co8LIHKEHbt7hrHOeP4BmetuTlEXKWoNjs3N6d0evF4MhnXYKkBaxbpK9QJQQ/ALXbk6O6ZLx2Sw9a20aEjfwtG3DQECVYqr4+FEEE2zszIupIzjEw9hs9k9b7KgZmFFm0Ev79XP5jh/Q66LqgmntQgSXBCQtT9b2uzHdo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=156.147.23.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from unknown (HELO lgeamrelo01.lge.com) (156.147.1.125) by 156.147.23.53 with ESMTP; 3 Mar 2026 17:28:28 +0900 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: hyc.lee@gmail.com Received: from unknown (HELO hyunchul-PC02.lge.net) (10.177.111.62) by 156.147.1.125 with ESMTP; 3 Mar 2026 17:28:28 +0900 X-Original-SENDERIP: 10.177.111.62 X-Original-MAILFROM: hyc.lee@gmail.com From: Hyunchul Lee To: Viacheslav Dubeyko , John Paul Adrian Glaubitz , Yangtao Li Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, cheol.lee@lge.com Subject: [PATCH] hfsplus: limit sb_maxbytes to partition size Date: Tue, 3 Mar 2026 17:28:07 +0900 Message-ID: <20260303082807.750679-1-hyc.lee@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" s_maxbytes currently is set to MAX_LFS_FILESIZE, which allows writes beyond the partition size. As a result, large-offset writes on small partitions can fail late with ENOSPC. Set s_maxbytes to the partition size. With this change, the large-offset writes are rejected early by `generic_write_check_limit()` with EFBIG. This patch also fixes generic/268. Signed-off-by: Hyunchul Lee --- fs/hfsplus/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 7229a8ae89f9..18350abc659b 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -500,7 +500,8 @@ static int hfsplus_fill_super(struct super_block *sb, s= truct fs_context *fc) =20 /* Set up operations so we can load metadata */ sb->s_op =3D &hfsplus_sops; - sb->s_maxbytes =3D MAX_LFS_FILESIZE; + sb->s_maxbytes =3D (loff_t)min(MAX_LFS_FILESIZE, + (u64)sbi->total_blocks << sbi->alloc_blksz_shift); =20 if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) { pr_warn("Filesystem was not cleanly unmounted, running fsck.hfsplus is r= ecommended. mounting read-only.\n"); --=20 2.43.0