Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;