Commit a6f8ee58 authored by Arjun Roy's avatar Arjun Roy Committed by Jakub Kicinski

tcp: Specify cmsgbuf is user pointer for receive zerocopy.

A prior change (1f466e1f) introduces separate handling for
->msg_control depending on whether the pointer is a kernel or user
pointer. However, while tcp receive zerocopy is using this field, it
is not properly annotating that the buffer in this case is a user
pointer. This can cause faults when the improper mechanism is used
within put_cmsg().

This patch simply annotates tcp receive zerocopy's use as explicitly
being a user pointer.

Fixes: 7eeba170 ("tcp: Add receive timestamp support for receive zerocopy.")
Signed-off-by: default avatarArjun Roy <arjunroy@google.com>
Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20210506223530.2266456-1-arjunroy.kdev@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent cbaf3f6a
...@@ -2039,6 +2039,7 @@ static void tcp_zc_finalize_rx_tstamp(struct sock *sk, ...@@ -2039,6 +2039,7 @@ static void tcp_zc_finalize_rx_tstamp(struct sock *sk,
(__kernel_size_t)zc->msg_controllen; (__kernel_size_t)zc->msg_controllen;
cmsg_dummy.msg_flags = in_compat_syscall() cmsg_dummy.msg_flags = in_compat_syscall()
? MSG_CMSG_COMPAT : 0; ? MSG_CMSG_COMPAT : 0;
cmsg_dummy.msg_control_is_user = true;
zc->msg_flags = 0; zc->msg_flags = 0;
if (zc->msg_control == msg_control_addr && if (zc->msg_control == msg_control_addr &&
zc->msg_controllen == cmsg_dummy.msg_controllen) { zc->msg_controllen == cmsg_dummy.msg_controllen) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment