diff options
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/input.c | 7 | ||||
-rw-r--r-- | net/sctp/socket.c | 12 |
2 files changed, 12 insertions, 7 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c index c201b26879a1..e64d5210ed13 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -752,15 +752,12 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) | |||
752 | 752 | ||
753 | epb = &ep->base; | 753 | epb = &ep->base; |
754 | 754 | ||
755 | if (hlist_unhashed(&epb->node)) | ||
756 | return; | ||
757 | |||
758 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); | 755 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); |
759 | 756 | ||
760 | head = &sctp_ep_hashtable[epb->hashent]; | 757 | head = &sctp_ep_hashtable[epb->hashent]; |
761 | 758 | ||
762 | sctp_write_lock(&head->lock); | 759 | sctp_write_lock(&head->lock); |
763 | __hlist_del(&epb->node); | 760 | hlist_del_init(&epb->node); |
764 | sctp_write_unlock(&head->lock); | 761 | sctp_write_unlock(&head->lock); |
765 | } | 762 | } |
766 | 763 | ||
@@ -841,7 +838,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc) | |||
841 | head = &sctp_assoc_hashtable[epb->hashent]; | 838 | head = &sctp_assoc_hashtable[epb->hashent]; |
842 | 839 | ||
843 | sctp_write_lock(&head->lock); | 840 | sctp_write_lock(&head->lock); |
844 | __hlist_del(&epb->node); | 841 | hlist_del_init(&epb->node); |
845 | sctp_write_unlock(&head->lock); | 842 | sctp_write_unlock(&head->lock); |
846 | } | 843 | } |
847 | 844 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 74bd3c47350a..5d488cdcf679 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1231,8 +1231,14 @@ out_free: | |||
1231 | SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p" | 1231 | SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p" |
1232 | " kaddrs: %p err: %d\n", | 1232 | " kaddrs: %p err: %d\n", |
1233 | asoc, kaddrs, err); | 1233 | asoc, kaddrs, err); |
1234 | if (asoc) | 1234 | if (asoc) { |
1235 | /* sctp_primitive_ASSOCIATE may have added this association | ||
1236 | * To the hash table, try to unhash it, just in case, its a noop | ||
1237 | * if it wasn't hashed so we're safe | ||
1238 | */ | ||
1239 | sctp_unhash_established(asoc); | ||
1235 | sctp_association_free(asoc); | 1240 | sctp_association_free(asoc); |
1241 | } | ||
1236 | return err; | 1242 | return err; |
1237 | } | 1243 | } |
1238 | 1244 | ||
@@ -1942,8 +1948,10 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1942 | goto out_unlock; | 1948 | goto out_unlock; |
1943 | 1949 | ||
1944 | out_free: | 1950 | out_free: |
1945 | if (new_asoc) | 1951 | if (new_asoc) { |
1952 | sctp_unhash_established(asoc); | ||
1946 | sctp_association_free(asoc); | 1953 | sctp_association_free(asoc); |
1954 | } | ||
1947 | out_unlock: | 1955 | out_unlock: |
1948 | sctp_release_sock(sk); | 1956 | sctp_release_sock(sk); |
1949 | 1957 | ||