From nobody Tue Nov 24 11:52:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.30.148.34 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795358916; b=GIp5vzkbHUYiGPR/k5/D11FjhD5IFyrG3hWKp7wSffe6uLUOU4BNBhoH3eZ2ofw+UMpE Dx2vguSH7C4vxDogWzhjzMxgmWNpwq37FTNm1arOqyfmbPAT4H5BTp/HR8xFwOMO02r9S d4U/R+llh2jaueIJmbngt9g7gfm4k+lsPQS8wwghzveusKYm98cpFFf1ltHFTux1P8za/ sJXRSp1i4h62zJsKw6JwPx93wX60C+oNxY/b4uVpX+vRSrVcpwfcuzGAkc/5O94a4KY6/ wUwnrBDOCNJ/VHC3R7Qoqij7ltUJiselSEfu/5iGimNRvP0HBsHTbG2AFN640mRAnwA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795358916; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: X-Zmail-TransId:X-Mailer:Message-ID:In-Reply-To:References:Date: Mime-Version:From:To:Cc:Subject:Content-Type:X-MAIL:X-TLS: X-ENVELOPE-SENDER:X-SOURCE-IP:X-CLEAN:X-Fangmail-Anti-Spam-Filtered: X-Fangmail-MID-QID; bh=Ju3+Kzur//wZ1L6j9QF+ag4oEga6H+h5IALePIcZepg=; b=opXNWRL8QSiLz7VoBe6okWaBE2MXp9MU7MNHTAxvjaDFvUkTDG1/d7emchh/NYkqGYNZ G3LLZpvCFajggh5YtXVKXzfkYNdETIBvMtQEZHdtqily20MYKkyUZMlcGC5imGwsXPGHV OjTym8fH0znI9tgVsf46J6gT9+qckUSYcO7nktFzuq5jbVavPQRaxgy9vkIz/M1rTR3S5 8sRmpabvO+gAq14BfisoACWr109FLtPp0C9OhxqGOPlm3GrC8nrIdUSdaUHw1TLvQ48Vu bRNk1WF/ccLleLGHlThDB6+6NRaBb2WqStCHAv5f+u9jiIv8orPSh9+ayobkCnJ1xHw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; dkim=pass header.d=zte.com.cn header.i=@zte.com.cn header.a=rsa-sha256 header.s=z202610 header.b=X1HvDEFS; arc=none smtp.remote-ip=160.30.148.34 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4934C606A32A; Sun, 22 Nov 2026 14:48:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4934C606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=zte.com.cn header.i=@zte.com.cn header.a=rsa-sha256 header.s=z202610 header.b=X1HvDEFS Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4jXX4x2cQpz5BNS0; Sun, 22 Nov 2026 22:48:33 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zte.com.cn; s=z202610; t=1795358913; bh=0qJjM47HXnOSi2reeQMhqCNH+1k6sf1nNxDed1gjJbY=; h=In-Reply-To:References:Date:From:To:Cc:Subject; b=X1HvDEFSVEGtcUKIIqTWR1KjxOu2lPFakWgIqmmicTZuPAHrDz+8X9v4NsD9a2XJK GoHViKAMr7GWe2oDWmOZjkgaNkdpKI5dwURIcs187Mf0o43SPsKupLE1i3/PNHrB0e 4JwavCfNJQoc346MdqojC5NTGp6byuDCk1PeR3xz4YdbWIunOxkpozIf7rTPJzBiCv BsCHOrhuTJeT9u5fEQazEjC9HBoGIn1fqsE0h42KdjehaKUq0YeINnD4KGbgPOG4bw DUPGKmKHjqfTmdmmN4uPoL54OEJkOFkY8TlsWzS0Wjj6ZP/LFdDY8XJZliWfx0kxEr FBVLPy6y95IYQ== Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl2.zte.com.cn with SMTP id 6AMEmST3038793; Sun, 22 Nov 2026 22:48:28 +0800 (+08) (envelope-from shao.mingyin@zte.com.cn) Received: from mapi (xaxapp05[null]) by mapi (Zmail) with MAPI id mid32; Sun, 22 Nov 2026 22:48:31 +0800 (CST) X-Zmail-TransId: 2afc6b0300bf8b6-4e46c X-Mailer: Zmail v1.0 Message-ID: <20261122224831886ognkZtXtygomcSayJJdF8@zte.com.cn> In-Reply-To: <20261122224829803Cnc907ditjVjp2YzW1gmE@zte.com.cn> References: 20261122224829803Cnc907ditjVjp2YzW1gmE@zte.com.cn Date: Sun, 22 Nov 2026 22:48:31 +0800 (CST) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 From: To: , Cc: , , , , Subject: =?UTF-8?B?W1BBVENIIHYyIDEvMl0gbnZtZTogem5zOiByZWplY3QgYW4gb3V0LW9mLXJhbmdlIHpvbmUgYXBwZW5kIHNpemUgbGltaXQ=?= X-MAIL: mse-fl2.zte.com.cn 6AMEmST3038793 X-TLS: YES X-ENVELOPE-SENDER: shao.mingyin@zte.com.cn X-SOURCE-IP: 10.5.228.133 unknown Sun, 22 Nov 2026 22:48:33 +0800 X-CLEAN: YES X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6B0300C1.000/4jXX4x2cQpz5BNS0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shao Mingyin nvme_set_max_append() derives a sector limit by shifting 1 by ZASL + 3. ZASL is a byte from the Identify Controller ZNS data. Values of 29 or larger require a shift of at least 32 bits, which is undefined for the 32-bit operand. ZASL =3D 28 shifts into bit 31, which a signed operand cannot express either. Use an unsigned shift for representable values. If the reported limit exceeds the range of max_zone_append, use max_hw_sectors, the same limit used when ZASL is zero. The hardware transfer limit is smaller than any append limit that requires a shift of at least 32 bits. Fixes: 240e6ee272c0 ("nvme: support for zoned namespaces") Cc: stable@vger.kernel.org Signed-off-by: Shao Mingyin --- Changes in v2: - Drop the warning for values the driver cannot represent (Christoph). - Clarify that such a value can be valid and why the fallback is safe. v1: https://lore.kernel.org/r/20261115012752774qFGtgUXwZKwN-2LDj0D80@zte.co= m.cn drivers/nvme/host/zns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c index e31ec6f4f94fbe872d346516b02dd1e6a2223872..a93f3b152faaad34199e0d62765= 36be0c0ae8767 100644 --- a/drivers/nvme/host/zns.c +++ b/drivers/nvme/host/zns.c @@ -27,8 +27,8 @@ static int nvme_set_max_append(struct nvme_ctrl *ctrl) return status; } =20 - if (id->zasl) - ctrl->max_zone_append =3D 1 << (id->zasl + 3); + if (id->zasl && id->zasl + 3 < 32) + ctrl->max_zone_append =3D 1U << (id->zasl + 3); else ctrl->max_zone_append =3D ctrl->max_hw_sectors; kfree(id); base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726 --=20 2.43.0 From nobody Tue Nov 24 11:52:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.30.148.34 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795358920; b=Z+g0J0neoFUrpzEszlaN8xrGKpi5t6ewLMsmqJ1SjwtHk5oPtVl+eVRqu7dHjLGkwYzt +S1/l7Wbasn6NZJzhKdnz1g3A19OBO2WyJORgTuArV4WsUQeaiiMQHGk4J16U6EkfwBAq dfa7NXH5kkQWeOxKO+2NEkSJK4WW2jAGgxSUQge6qySHRZ2bVi7yXWYYfWTHqyVos77mw Ur4DpAyvA+cwuRFpLiQdL+oR+48RvyZfpSA9PsHCdQ4k7uF1W9B5xr7I1SwRT9tG9EZ9a T3i4RiWh0mobTJQn4ILfZsw5u7MdADItlLsyBnMMPOSF+Fphkbkl4vJKXlZWPV/exVA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795358920; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: X-Zmail-TransId:X-Mailer:Message-ID:In-Reply-To:References:Date: Mime-Version:From:To:Cc:Subject:Content-Type:X-MAIL:X-TLS: X-ENVELOPE-SENDER:X-SOURCE-IP:X-CLEAN:X-Fangmail-Anti-Spam-Filtered: X-Fangmail-MID-QID; bh=OrcddJ5pCwdY9QU+zPNEcBVg2Z0fI5gaTBEgEYuNhEg=; b=pLBQxLA962J60xKyyPnsNXdBn9DEBf9NMJmGGkHyUZOWEgj4McVc4SCRWVYb/IwYRZvI DNaYw7pq+SAOpi6MBOmCx9DLi5VLy2YMEkkHu/nigpArsJ9vPM7E88ibUxw/rEb6yAGSz VCgo8MvGu1R/L6YKkQtdoAy/UpdzZpsTUN3D7t6lULM04z/iTg/8A3/4CXowSQEFIWat/ zzD9XLqH/jDH7+hbIpUw3WSy5ZdlzJxB6K3mKSYuwB4juWL7vIuyA23oUGa1QrSHBVCo8 8onXHHa3Ya29pQYEaKe23YP6rhtYgcZYeersW1AmUYMqH0PsGXEMmJrfYY/6KS1WlHQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; dkim=pass header.d=zte.com.cn header.i=@zte.com.cn header.a=rsa-sha256 header.s=z202610 header.b=Qnnh+QRb; arc=none smtp.remote-ip=160.30.148.34 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18089606A320; Sun, 22 Nov 2026 14:48:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 18089606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zte.com.cn header.i=@zte.com.cn header.a=rsa-sha256 header.s=z202610 header.b=Qnnh+QRb Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4jXX5258gfz5BNRf; Sun, 22 Nov 2026 22:48:38 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zte.com.cn; s=z202610; t=1795358918; bh=vTX/aGbXYNWAw4/qQGfCC1kEAb8u6nryzk/sdB56V/Y=; h=In-Reply-To:References:Date:From:To:Cc:Subject; b=Qnnh+QRbYHKtgh6vdxEBMJpnFo3cq8EhyCznkhKdEI6buDP9/LmCNduh1m2pYTLIf HYfREfH0ykpw5ZcKSt53Tues14ZpJfMLZLgpGKY7B6XOBn/92M2BUw/+hrrBRtUOat a/OsBz5s1XLLuKs+08JGbrGAgnXx1KndxAGvXfHEDQWZLqIkJtEkuVnApj87GZA4f7 64ic+Q58WxTsvmw2PWgWaqMrKu3VX7rQwYuGsGLKXgZhbo1PG/7ruArSMTRC+CIj+f tj6T/qS3cLqLtMyni3RikVzUi4ybK963gn8hvS2jyd0iFvWolvwazFCa6mY9+3yi/r dA6yHEvTvf4qw== Received: from xaxapp05.zte.com.cn ([10.99.98.109]) by mse-fl1.zte.com.cn with SMTP id 6AMEmU5m029187; Sun, 22 Nov 2026 22:48:30 +0800 (+08) (envelope-from shao.mingyin@zte.com.cn) Received: from mapi (xaxapp05[null]) by mapi (Zmail) with MAPI id mid32; Sun, 22 Nov 2026 22:48:34 +0800 (CST) X-Zmail-TransId: 2afc6b0300c2944-4e4fa X-Mailer: Zmail v1.0 Message-ID: <20261122224834044bbU8YIyVINFDqdSezEwkG@zte.com.cn> In-Reply-To: <20261122224829803Cnc907ditjVjp2YzW1gmE@zte.com.cn> References: 20261122224829803Cnc907ditjVjp2YzW1gmE@zte.com.cn Date: Sun, 22 Nov 2026 22:48:34 +0800 (CST) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 From: To: , Cc: , , , , Subject: =?UTF-8?B?W1BBVENIIHYyIDIvMl0gbnZtZTogZGVjb2RlIHRoZSBGRFAgR2V0IEZlYXR1cmVzIHJlc3VsdCBhcyBhIGR3b3Jk?= X-MAIL: mse-fl1.zte.com.cn 6AMEmU5m029187 X-TLS: YES X-ENVELOPE-SENDER: shao.mingyin@zte.com.cn X-SOURCE-IP: 10.5.228.132 unknown Sun, 22 Nov 2026 22:48:38 +0800 X-CLEAN: YES X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6B0300C6.000/4jXX5258gfz5BNRf Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shao Mingyin nvme_get_features() returns completion dword 0 as a CPU-endian u32. nvme_query_fdp_info() reads the result through a byte-ordered structure. On a big-endian host it reads the high byte for the FDP enable bit and the wrong byte for the configuration index, so FDP can be skipped or configured using the wrong descriptor. Read the result into a u32 and extract the enable bit and configuration index from the dword. Remove the now-unused result structure. Fixes: 30b5f20bb2dd ("nvme: register fdp parameters with the block layer") Cc: stable@vger.kernel.org Signed-off-by: Shao Mingyin --- Changes in v2: - Remove struct nvme_fdp_config now that its only user is gone (Christoph). The v1 QEMU test used an emulated FDP target over nvme-loop. On s390x the namespace gained one write stream after the fix. On x86_64 it had one stream with and without the fix. The core.c change is unchanged. v1: https://lore.kernel.org/r/202611150127572887TC7vHzVUFLZ6nyW1NuhU@zte.co= m.cn drivers/nvme/host/core.c | 6 +++--- include/linux/nvme.h | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f43582e5f6c4a989669f8a92343467932a80b820..eddad69a4abee0322111fd87848= 98a658cb42bf6 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2339,8 +2339,8 @@ static int nvme_query_fdp_info(struct nvme_ns *ns, st= ruct nvme_ns_info *info) struct nvme_ns_head *head =3D ns->head; struct nvme_ctrl *ctrl =3D ns->ctrl; struct nvme_fdp_ruh_status *ruhs; - struct nvme_fdp_config fdp; struct nvme_command c =3D {}; + u32 fdp; size_t size; int i, ret; =20 @@ -2351,10 +2351,10 @@ static int nvme_query_fdp_info(struct nvme_ns *ns, = struct nvme_ns_info *info) return ret; } =20 - if (!(fdp.flags & FDPCFG_FDPE)) + if (!(fdp & FDPCFG_FDPE)) return 0; =20 - ret =3D nvme_query_fdp_granularity(ctrl, info, fdp.fdpcidx); + ret =3D nvme_query_fdp_granularity(ctrl, info, (fdp >> 8) & 0xff); if (!info->runs) return ret; =20 diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 6248711784b37030e82c8a1ff8579c2d669da0ba..a75f3e5f6210792348d34bdba38= b20a24e54202e 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -701,12 +701,8 @@ struct nvme_rotational_media_log { __u8 rsvd24[488]; }; =20 -struct nvme_fdp_config { - __u8 flags; +/* FDP Get Features result (completion dword 0). */ #define FDPCFG_FDPE (1U << 0) - __u8 fdpcidx; - __le16 reserved; -}; =20 struct nvme_fdp_ruh_desc { __u8 ruht; base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726 --=20 2.43.0