diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-06-17 11:10:27 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-19 22:13:43 +0300 |
commit | 86fdb3448cc1ffe0e9f55380f1410f1d12c35f95 (patch) | |
tree | b6fefe0b3cf22d208e9afa87f9dd638116ac6606 /net/sctp/endpointola.c | |
parent | 7fe5b914313ff67d71cb2b5aa4b850e0884e75dd (diff) | |
download | linux-86fdb3448cc1ffe0e9f55380f1410f1d12c35f95.tar.xz |
sctp: ensure ep is not destroyed before doing the dump
Now before dumping a sock in sctp_diag, it only holds the sock while
the ep may be already destroyed. It can cause a use-after-free panic
when accessing ep->asocs.
This patch is to set sctp_sk(sk)->ep NULL in sctp_endpoint_destroy,
and check if this ep is already destroyed before dumping this ep.
Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdrver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/endpointola.c')
-rw-r--r-- | net/sctp/endpointola.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 8c589230794f..3dcd0ecf3d99 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c @@ -275,6 +275,7 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) if (sctp_sk(sk)->bind_hash) sctp_put_port(sk); + sctp_sk(sk)->ep = NULL; sock_put(sk); } |