提交 e0fecb28 编写于 作者: A Arjun Roy 提交者: David S. Miller

tcp: correctly handle increased zerocopy args struct size

A prior patch increased the size of struct tcp_zerocopy_receive
but did not update do_tcp_getsockopt() handling to properly account
for this.

This patch simply reintroduces content erroneously cut from the
referenced prior patch that handles the new struct size.

Fixes: 18fb76ed ("net-zerocopy: Copy straggler unaligned data for TCP Rx. zerocopy.")
Signed-off-by: NArjun Roy <arjunroy@google.com>
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NSoheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a76b6b1f
...@@ -4082,7 +4082,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level, ...@@ -4082,7 +4082,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
} }
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
case TCP_ZEROCOPY_RECEIVE: { case TCP_ZEROCOPY_RECEIVE: {
struct tcp_zerocopy_receive zc; struct tcp_zerocopy_receive zc = {};
int err; int err;
if (get_user(len, optlen)) if (get_user(len, optlen))
...@@ -4099,7 +4099,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level, ...@@ -4099,7 +4099,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
lock_sock(sk); lock_sock(sk);
err = tcp_zerocopy_receive(sk, &zc); err = tcp_zerocopy_receive(sk, &zc);
release_sock(sk); release_sock(sk);
if (len == sizeof(zc)) if (len >= offsetofend(struct tcp_zerocopy_receive, err))
goto zerocopy_rcv_sk_err; goto zerocopy_rcv_sk_err;
switch (len) { switch (len) {
case offsetofend(struct tcp_zerocopy_receive, err): case offsetofend(struct tcp_zerocopy_receive, err):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册