aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Yasevich <[email protected]>2006-07-21 21:48:26 +0000
committerDavid S. Miller <[email protected]>2006-07-21 21:48:26 +0000
commitcfdeef3282705a4b872d3559c4e7d2561251363c (patch)
tree09d11c52f22b383284f5beb17e63965a6e9ea78f
parent[SCTP]: Check for NULL arg to sctp_bucket_destroy(). (diff)
downloadkernel-cfdeef3282705a4b872d3559c4e7d2561251363c.tar.gz
kernel-cfdeef3282705a4b872d3559c4e7d2561251363c.zip
[SCTP]: Unhash the endpoint in sctp_endpoint_free().
This prevents a race between the close of a socket and receive of an incoming packet. Signed-off-by: Vlad Yasevich <[email protected]> Signed-off-by: Sridhar Samudrala <[email protected]> Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--net/sctp/endpointola.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 67bd53070ee0..ffda1d680529 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -158,6 +158,12 @@ void sctp_endpoint_add_asoc(struct sctp_endpoint *ep,
void sctp_endpoint_free(struct sctp_endpoint *ep)
{
ep->base.dead = 1;
+
+ ep->base.sk->sk_state = SCTP_SS_CLOSED;
+
+ /* Unlink this endpoint, so we can't find it again! */
+ sctp_unhash_endpoint(ep);
+
sctp_endpoint_put(ep);
}
@@ -166,11 +172,6 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
{
SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return);
- ep->base.sk->sk_state = SCTP_SS_CLOSED;
-
- /* Unlink this endpoint, so we can't find it again! */
- sctp_unhash_endpoint(ep);
-
/* Free up the HMAC transform. */
sctp_crypto_free_tfm(sctp_sk(ep->base.sk)->hmac);