[PATCH 1/2] nvme-tcp: move the TLS record read loop into a helper
Martin Belanger
martin.nvme.dev at gmail.com
Mon Nov 9 11:30:01 PST 2026
On 11/9/26 14:11, sashiko-bot at kernel.org wrote:
> [Severity: Medium]
> This problem wasn't introduced by this patch, but can passing the
unaligned
> char cbuf[] array as msg_control [1] cause unaligned struct cmsghdr
> accesses?
The report is correct. The char cbuf[CMSG_LEN(sizeof(char))] pattern
gives the buffer 1-byte alignment, and put_cmsg() and
tls_get_record_type() access it as a struct cmsghdr. The pattern exists
since commit 2837966ab2a8 ("nvme-tcp: control message handling for
recvmsg()"), and this series copies it into the two new receive paths.
v2 will add a first patch that declares the host buffers as a union
with struct cmsghdr, as sunrpc does in svcsock.c and xprtsock.c. The
new code in this series will use the same declaration. I will wait for
review of v1 before I post v2.
nvmet-tcp uses the same pattern in four places. I will fix it in a
separate patch.
Martin
More information about the Linux-nvme
mailing list