* [net-next] tcp: correctly handle increased zerocopy args struct size
@ 2020-12-10 19:16 Arjun Roy
2020-12-10 21:15 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Arjun Roy @ 2020-12-10 19:16 UTC (permalink / raw)
To: davem, netdev; +Cc: arjunroy, edumazet, soheil
From: Arjun Roy <arjunroy@google.com>
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: 18fb76ed5386 ("net-zerocopy: Copy straggler unaligned data for TCP Rx. zerocopy.")
Signed-off-by: Arjun Roy <arjunroy@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
---
net/ipv4/tcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 3c99d48b65d8..ed42d2193c5c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -4082,7 +4082,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
}
#ifdef CONFIG_MMU
case TCP_ZEROCOPY_RECEIVE: {
- struct tcp_zerocopy_receive zc;
+ struct tcp_zerocopy_receive zc = {};
int err;
if (get_user(len, optlen))
@@ -4099,7 +4099,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
lock_sock(sk);
err = tcp_zerocopy_receive(sk, &zc);
release_sock(sk);
- if (len == sizeof(zc))
+ if (len >= offsetofend(struct tcp_zerocopy_receive, err))
goto zerocopy_rcv_sk_err;
switch (len) {
case offsetofend(struct tcp_zerocopy_receive, err):
--
2.29.2.576.ga3fc446d84-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net-next] tcp: correctly handle increased zerocopy args struct size
2020-12-10 19:16 [net-next] tcp: correctly handle increased zerocopy args struct size Arjun Roy
@ 2020-12-10 21:15 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-12-10 21:15 UTC (permalink / raw)
To: arjunroy.kdev; +Cc: netdev, arjunroy, edumazet, soheil
From: Arjun Roy <arjunroy.kdev@gmail.com>
Date: Thu, 10 Dec 2020 11:16:03 -0800
> From: Arjun Roy <arjunroy@google.com>
>
> 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: 18fb76ed5386 ("net-zerocopy: Copy straggler unaligned data for TCP Rx. zerocopy.")
> Signed-off-by: Arjun Roy <arjunroy@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-10 21:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-10 19:16 [net-next] tcp: correctly handle increased zerocopy args struct size Arjun Roy
2020-12-10 21:15 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).