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 80564fe03024..8b9b6790a3df 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
| @@ -736,15 +736,12 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) | |||
| 736 | 736 | ||
| 737 | epb = &ep->base; | 737 | epb = &ep->base; |
| 738 | 738 | ||
| 739 | if (hlist_unhashed(&epb->node)) | ||
| 740 | return; | ||
| 741 | |||
| 742 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); | 739 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); |
| 743 | 740 | ||
| 744 | head = &sctp_ep_hashtable[epb->hashent]; | 741 | head = &sctp_ep_hashtable[epb->hashent]; |
| 745 | 742 | ||
| 746 | sctp_write_lock(&head->lock); | 743 | sctp_write_lock(&head->lock); |
| 747 | __hlist_del(&epb->node); | 744 | hlist_del_init(&epb->node); |
| 748 | sctp_write_unlock(&head->lock); | 745 | sctp_write_unlock(&head->lock); |
| 749 | } | 746 | } |
| 750 | 747 | ||
| @@ -825,7 +822,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc) | |||
| 825 | head = &sctp_assoc_hashtable[epb->hashent]; | 822 | head = &sctp_assoc_hashtable[epb->hashent]; |
| 826 | 823 | ||
| 827 | sctp_write_lock(&head->lock); | 824 | sctp_write_lock(&head->lock); |
| 828 | __hlist_del(&epb->node); | 825 | hlist_del_init(&epb->node); |
| 829 | sctp_write_unlock(&head->lock); | 826 | sctp_write_unlock(&head->lock); |
| 830 | } | 827 | } |
| 831 | 828 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index b3b8a8d813eb..31c7bfcd9b58 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 | ||
