Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794270697; b=KsojBAwoOzS4BPz+YxKQ5YSiI8wAvBRqkzRpJ3zcO+xKrk8CZVUuTweb3ygnr7hXCN8E dEWNQdEDcVM2GE16JuXyP9rGQ3SmYuJOUOr7nn4thaKFozo1CntpouziK5avpRRLWRdU+ J1gdCDUNACL76pMusUWP2gYr1+FxbOd203dHGqDBznW8HgyAg1OLA1ujdgH0yG6buWz16 avj2n8wl8Sz3FKwYegwi2GNrw5rkBTTOvbL1t+Oeh+GyjZn1vJn9n4J/wGOMM4jYqf6Rc kIVk3btLpLisQ0cnpSvlltHWgUoAOQTYrbViHqkTh0b99rjCl+OKPH2zxXymnBx7I2A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794270697; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: Reply-To:MIME-Version:X-Patchwork-Hint:X-stable: Content-Transfer-Encoding; bh=AerpexG+4nqBMsipuQu+U2TzEz4dDt9eHjrjCmPeizM=; b=5fpzwyuG5R98eYy/uYbu7Qnko82fCEj+DyLTO5WtA9DpfgeMMJtWucXYzhPmIKq9Of4j ghFxGvdR0ZZUzB+GEdzjoMcS2ld6XkhAGt3XiI4Nno1yLOeYPFbemr9xgdDowYIhcbRSD Hgp4xQeMjmX2C5kUdcCV4XWTGgauduARP7P/Ab27sGgIKqvL8bMp1uzZ6MsaktbQZ+RAg wABR0awi3f9DXtZZK8PJvvLhOePBTf4cy7GbWSHas9RF+AVgnk65FuYp7Czw/klAkPSoo 1BFYA1OB4veAsztnrtHou3MZ22hkDO2J6Vpq00eHmf7xV5IifoxMI5G+24eSZImFDPA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qj8sINDa; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B804D606A325; Tue, 10 Nov 2026 00:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qj8sINDa Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE5731F008A5; Tue, 10 Nov 2026 00:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794270696; bh=AerpexG+4nqBMsipuQu+U2TzEz4dDt9eHjrjCmPeizM=; h=From:To:Cc:Subject:Date:Reply-To; b=Qj8sINDa7gn6HMRLtOslt8N0JxN5vDKfl8xUVNt8xefFQsJn7pn/ZyFPya5A2ZITT lrtlCFAMtH8PxyHcjs96CupuTf3Be3O45JB/XD9jtZNtmwU3Eu6sxqVLl0yMzvUX1N X2jC4BgGx1hyS8SRJSgg1xc5bXaCMB6USxlIrVpCh9hlyHHA8vMqSJP6uFhCY/woRy HKnOUfDuuPS01cSMs8Z+eo8uASWJb/z1qlecrkabFMElUiSk0chTOZt/lqLWAhHkdD 26gpuZMNp1kxP/62el81QFeutYnFuu5D+rKhdobqkLBpopfphkEyN1Detyyix80dpP YOn2DczJToyQg== From: Sasha Levin To: stable-commits@vger.kernel.org, daejun7.park@samsung.com Cc: Amir Goldstein , "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: Patch "xfs: clamp the pNFS layout range to the maximum file size" has been added to the 6.12-stable tree Date: Mon, 9 Nov 2026 19:31:34 -0500 Message-ID: <20261110003134.3518393-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 Reply-To: stable@vger.kernel.org X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit This is a note to let you know that I've just added the patch titled xfs: clamp the pNFS layout range to the maximum file size to the 6.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-clamp-the-pnfs-layout-range-to-the-maximum-file-.patch and it can be found in the queue-6.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. commit f360062531bf52845394bc5227e433067e0e85e2 Author: Daejun Park Date: Thu Oct 29 11:23:03 2026 +0900 xfs: clamp the pNFS layout range to the maximum file size [ Upstream commit 29f3c1be4e554c9dbc66e13333034e0947477cb6 ] xfs_fs_map_blocks() lets two bad layout ranges through. An offset of 2^63 or more is negative and passes "offset > limit". A length above the limit, such as NFS4_UINT64_MAX, wraps "offset > limit - length" and stays unclamped. With NFS4_UINT64_MAX, a read layout is built from an uninitialized mapping. Reject a negative offset and one at the limit, and clamp the length. This needs "xfs: cap the block count of xfs_iomap_write_direct() at one extent". Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Reviewed-by: Darrick J. Wong Reviewed-by: Pankaj Raghav Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c index a222410812ac4..fa027574d6de1 100644 --- a/fs/xfs/xfs_pnfs.c +++ b/fs/xfs/xfs_pnfs.c @@ -168,10 +168,9 @@ xfs_fs_map_blocks( if (!write) limit = max(limit, round_up(i_size_read(inode), inode->i_sb->s_blocksize)); - if (offset > limit) + if (offset < 0 || offset >= limit) goto out_unlock; - if (offset > limit - length) - length = limit - offset; + length = min_t(u64, length, limit - offset); error = filemap_write_and_wait(inode->i_mapping); if (error)