From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796221497; b=N7OydNt1QSdULVKBu3N4k1YwAioUzc3QbmyPz/sLf1O2fW2sc2xevSjlnsNhHHfZGHN+ porex1UZqwvnm/o390VY5zBRObbtFBonppe0j/+uGtGyEmrveVb3zZqFoUfctFXV5YdRc U1u6606u+WkDvG+jqaGOp2+WTnDC5wCNtxheh4t9Y7gqg2bvb2ngc07Gcil0yCrQaKqlZ BupH6REg6irK5pZ9aRXdtGeSTY/H0fd5+gWPDSDyBkzFBjjIfSLEoS08NgAeFKb9EKYHx S3EdTd5/XN4q1zdctFDEQvagGtGxNc0wT4vceqkbqHbawLHpuGCQrLIO7lO+q3Cxa5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221497; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=z7tErqRN2GXGLT2qTtqmfDtk35UhsfR4TvGqpDCvT1g=; b=BlBwKCS4clVzHulPAK6iUCnaprL91xZZhHHjRBj8EnAY6s1jqJbiqOxMChBEZ2WqIdo3 Et8XUq0vMka97ErqTZaRvAlxwjAKSRElgL+fpRLYQI8u2p02pst8UHnostjxv8UY++EgR rk5oCsQPqVlQUdknzS2LC6rzFgLYdBLORX/S5BGJG4lHMP38tT4yNvsBNXaDnBRKA9y30 /HHtdXvbBk7Dnli+pRdXRw8N3BEZAJoUlPR3JcoZ0MGzW0U3mTZl8+lfGM/wMuqFtnVdG URG3URFueZYMBJFFCVhRZp+DWOmoKjQbMCNDyRjnh7Xt/ceXTwr/K1W+9J91rdGjjUA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=vSgdmOUF; 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 2F73D606A325 for ; Wed, 2 Dec 2026 14:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=vSgdmOUF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CBE91F000C1; Wed, 2 Dec 2026 14:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221497; bh=z7tErqRN2GXGLT2qTtqmfDtk35UhsfR4TvGqpDCvT1g=; h=Subject:To:Cc:From:Date; b=vSgdmOUFwWzeu5I00EuqddafW0uWqdcTyQIi3AJqIRtCaMPkLP+Dc734g1UNCbJsI 4rgW8gCS2iTnY8h77n2WxGb/Xzw+rBwg/F44kgWZZNHRH/dklvgxZL1/BMDM1qrTf5 LydSUbNTUEwlI3MWY9HRAlPcho1Kw0nm714WRSYA= Subject: FAILED: patch "[PATCH] nvme-tcp: use an aligned buffer for the TLS record type" failed to apply to 6.12-stable tree To: martin.belanger@dell.com,hare@kernel.org,kbusch@kernel.org Cc: From: Date: Wed, 02 Dec 2026 14:53:15 +0100 Message-ID: <2026120215-stunt-agony-baa2@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 1193566c35ead643e954ff8356bb54b1cd78378a # git commit -s git send-email --to '' --in-reply-to '2026120215-stunt-agony-baa2@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1193566c35ead643e954ff8356bb54b1cd78378a Mon Sep 17 00:00:00 2001 From: Martin Belanger Date: Thu, 12 Nov 2026 16:13:34 -0500 Subject: [PATCH] nvme-tcp: use an aligned buffer for the TLS record type The buffers that receive the TLS record type are char arrays. put_cmsg() and tls_get_record_type() access them as struct cmsghdr, which needs a stricter alignment than a char array has. Use a union with struct cmsghdr, sized with CMSG_SPACE(), as svc_tcp_recv_cmsg() and xs_tls_read_record() in sunrpc do. Fixes: 2837966ab2a8 ("nvme-tcp: control message handling for recvmsg()") Cc: stable@vger.kernel.org Signed-off-by: Martin Belanger Reviewed-by: Hannes Reinecke Signed-off-by: Keith Busch diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 2587db92a3a2..2be355315df2 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -77,6 +77,12 @@ MODULE_PARM_DESC(tls_handshake_timeout, /* TLS records read while waiting for the ICResp, the ICResp included */ #define NVME_TCP_ICRESP_MAX_RECORDS 8 +/* control message buffer for the TLS record type */ +union nvme_tcp_tls_cmsg { + struct cmsghdr cmsg; + u8 buf[CMSG_SPACE(sizeof(u8))]; +}; + static int nvme_tcp_cpu_queues[NR_CPUS]; static DEFINE_SPINLOCK(nvme_tcp_cpu_queues_lock); @@ -1653,11 +1659,11 @@ static int nvme_tcp_skip_tls_record(struct nvme_tcp_queue *queue, .iov_base = buf, .iov_len = sizeof(buf), }; - char cbuf[CMSG_LEN(sizeof(char))] = {}; + union nvme_tcp_tls_cmsg u = {}; /* kTLS fails a control record read without a cmsg buffer */ struct msghdr drain = { - .msg_control = cbuf, - .msg_controllen = sizeof(cbuf), + .msg_control = &u, + .msg_controllen = sizeof(u), }; ret = kernel_recvmsg(queue->sock, &drain, &iov, 1, sizeof(buf), @@ -1682,7 +1688,7 @@ static int nvme_tcp_skip_tls_record(struct nvme_tcp_queue *queue, static int nvme_tcp_recv_icresp(struct nvme_tcp_queue *queue, struct nvme_tcp_icresp_pdu *icresp) { - char cbuf[CMSG_LEN(sizeof(char))]; + union nvme_tcp_tls_cmsg u; struct msghdr msg; struct kvec iov; u8 ctype; @@ -1690,12 +1696,12 @@ static int nvme_tcp_recv_icresp(struct nvme_tcp_queue *queue, for (i = 0; i < NVME_TCP_ICRESP_MAX_RECORDS; i++) { memset(&msg, 0, sizeof(msg)); - memset(cbuf, 0, sizeof(cbuf)); + memset(&u, 0, sizeof(u)); iov.iov_base = icresp; iov.iov_len = sizeof(*icresp); if (nvme_tcp_queue_tls(queue)) { - msg.msg_control = cbuf; - msg.msg_controllen = sizeof(cbuf); + msg.msg_control = &u; + msg.msg_controllen = sizeof(u); } msg.msg_flags = MSG_WAITALL; ret = kernel_recvmsg(queue->sock, &msg, &iov, 1, @@ -1703,8 +1709,7 @@ static int nvme_tcp_recv_icresp(struct nvme_tcp_queue *queue, if (ret <= 0 || !nvme_tcp_queue_tls(queue)) return ret; - ctype = tls_get_record_type(queue->sock->sk, - (struct cmsghdr *)cbuf); + ctype = tls_get_record_type(queue->sock->sk, &u.cmsg); if (ctype == TLS_RECORD_TYPE_DATA) return ret;