* [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size()
@ 2019-09-05 20:20 Eric Dumazet
2019-09-05 20:21 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2019-09-05 20:20 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Eric Dumazet, Luke Hsiao, Neal Cardwell,
Davide Caratti
tcp_diag_get_aux_size() can be called with sockets in any state.
icsk_ulp_ops is only present for full sockets.
For SYN_RECV or TIME_WAIT ones we would access garbage.
Fixes: 61723b393292 ("tcp: ulp: add functions to dump ulp-specific information")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Luke Hsiao <lukehsiao@google.com>
Reported-by: Neal Cardwell <ncardwell@google.com>
Cc: Davide Caratti <dcaratti@redhat.com>
---
net/ipv4/tcp_diag.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index babc156deabb573f11bba344215d2c3712c4a3cd..81a8221d650a94be53d17354c60ddd0c655eaccf 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -163,7 +163,7 @@ static size_t tcp_diag_get_aux_size(struct sock *sk, bool net_admin)
}
#endif
- if (net_admin) {
+ if (net_admin && sk_fullsock(sk)) {
const struct tcp_ulp_ops *ulp_ops;
ulp_ops = icsk->icsk_ulp_ops;
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size()
2019-09-05 20:20 [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size() Eric Dumazet
@ 2019-09-05 20:21 ` Eric Dumazet
2019-09-06 7:17 ` Davide Caratti
2019-09-07 15:34 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2019-09-05 20:21 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Luke Hsiao, Neal Cardwell, Davide Caratti
On Thu, Sep 5, 2019 at 10:20 PM Eric Dumazet <edumazet@google.com> wrote:
>
> tcp_diag_get_aux_size() can be called with sockets in any state.
>
> icsk_ulp_ops is only present for full sockets.
>
> For SYN_RECV or TIME_WAIT ones we would access garbage.
>
> Fixes: 61723b393292 ("tcp: ulp: add functions to dump ulp-specific information")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Luke Hsiao <lukehsiao@google.com>
> Reported-by: Neal Cardwell <ncardwell@google.com>
> Cc: Davide Caratti <dcaratti@redhat.com>
> ---
Sorry for the 'net' tag. This patch targets net-next tree only.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size()
2019-09-05 20:20 [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size() Eric Dumazet
2019-09-05 20:21 ` Eric Dumazet
@ 2019-09-06 7:17 ` Davide Caratti
2019-09-07 15:34 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Davide Caratti @ 2019-09-06 7:17 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller
Cc: netdev, Eric Dumazet, Luke Hsiao, Neal Cardwell
On Thu, 2019-09-05 at 13:20 -0700, Eric Dumazet wrote:
> tcp_diag_get_aux_size() can be called with sockets in any state.
>
> icsk_ulp_ops is only present for full sockets.
>
> For SYN_RECV or TIME_WAIT ones we would access garbage.
>
hello Eric,
thanks for fixing this!
Acked-by: Davide Caratti <dcaratti@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size()
2019-09-05 20:20 [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size() Eric Dumazet
2019-09-05 20:21 ` Eric Dumazet
2019-09-06 7:17 ` Davide Caratti
@ 2019-09-07 15:34 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-09-07 15:34 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet, lukehsiao, ncardwell, dcaratti
From: Eric Dumazet <edumazet@google.com>
Date: Thu, 5 Sep 2019 13:20:41 -0700
> tcp_diag_get_aux_size() can be called with sockets in any state.
>
> icsk_ulp_ops is only present for full sockets.
>
> For SYN_RECV or TIME_WAIT ones we would access garbage.
>
> Fixes: 61723b393292 ("tcp: ulp: add functions to dump ulp-specific information")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Luke Hsiao <lukehsiao@google.com>
> Reported-by: Neal Cardwell <ncardwell@google.com>
Applied to net-next, thanks Eric.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-07 15:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-05 20:20 [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size() Eric Dumazet
2019-09-05 20:21 ` Eric Dumazet
2019-09-06 7:17 ` Davide Caratti
2019-09-07 15:34 ` 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).