aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/endpointola.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/endpointola.c')
-rw-r--r--net/sctp/endpointola.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index a2b553721514..129756908da4 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -72,6 +72,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
72{ 72{
73 memset(ep, 0, sizeof(struct sctp_endpoint)); 73 memset(ep, 0, sizeof(struct sctp_endpoint));
74 74
75 ep->digest = kzalloc(SCTP_SIGNATURE_SIZE, gfp);
76 if (!ep->digest)
77 return NULL;
78
75 /* Initialize the base structure. */ 79 /* Initialize the base structure. */
76 /* What type of endpoint are we? */ 80 /* What type of endpoint are we? */
77 ep->base.type = SCTP_EP_TYPE_SOCKET; 81 ep->base.type = SCTP_EP_TYPE_SOCKET;
@@ -181,6 +185,9 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
181 /* Free up the HMAC transform. */ 185 /* Free up the HMAC transform. */
182 crypto_free_hash(sctp_sk(ep->base.sk)->hmac); 186 crypto_free_hash(sctp_sk(ep->base.sk)->hmac);
183 187
188 /* Free the digest buffer */
189 kfree(ep->digest);
190
184 /* Cleanup. */ 191 /* Cleanup. */
185 sctp_inq_free(&ep->base.inqueue); 192 sctp_inq_free(&ep->base.inqueue);
186 sctp_bind_addr_free(&ep->base.bind_addr); 193 sctp_bind_addr_free(&ep->base.bind_addr);
@@ -222,7 +229,7 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *ep,
222 struct sctp_endpoint *retval; 229 struct sctp_endpoint *retval;
223 230
224 sctp_read_lock(&ep->base.addr_lock); 231 sctp_read_lock(&ep->base.addr_lock);
225 if (ep->base.bind_addr.port == laddr->v4.sin_port) { 232 if (htons(ep->base.bind_addr.port) == laddr->v4.sin_port) {
226 if (sctp_bind_addr_match(&ep->base.bind_addr, laddr, 233 if (sctp_bind_addr_match(&ep->base.bind_addr, laddr,
227 sctp_sk(ep->base.sk))) { 234 sctp_sk(ep->base.sk))) {
228 retval = ep; 235 retval = ep;
@@ -250,7 +257,7 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
250 struct sctp_association *asoc; 257 struct sctp_association *asoc;
251 struct list_head *pos; 258 struct list_head *pos;
252 259
253 rport = paddr->v4.sin_port; 260 rport = ntohs(paddr->v4.sin_port);
254 261
255 list_for_each(pos, &ep->asocs) { 262 list_for_each(pos, &ep->asocs) {
256 asoc = list_entry(pos, struct sctp_association, asocs); 263 asoc = list_entry(pos, struct sctp_association, asocs);