]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: ensure ep is not destroyed before doing the dump
authorXin Long <lucien.xin@gmail.com>
Sat, 17 Jun 2017 08:10:27 +0000 (16:10 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Jun 2017 19:13:43 +0000 (15:13 -0400)
commit2959b44e60ae2de495ab45726c5fccc5b86eeaba
treeb6fefe0b3cf22d208e9afa87f9dd638116ac6606
parentdd75175e9fb3381d6b6c464212399478e2c09da2
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>
net/sctp/endpointola.c
net/sctp/sctp_diag.c