Commit b58662a5 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: ulp: fix possible crash in tcp_diag_get_aux_size()

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: 61723b39 ("tcp: ulp: add functions to dump ulp-specific information")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarLuke Hsiao <lukehsiao@google.com>
Reported-by: default avatarNeal Cardwell <ncardwell@google.com>
Cc: Davide Caratti <dcaratti@redhat.com>
Acked-by: default avatarDavide Caratti <dcaratti@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3dd97a08
......@@ -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;
......
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