diff options
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/socket.c | 19 | ||||
-rw-r--r-- | net/sctp/ulpevent.c | 11 |
2 files changed, 16 insertions, 14 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 83a76ba9d7..4dcdabf564 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4164,6 +4164,7 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, | |||
4164 | rwlock_t *addr_lock; | 4164 | rwlock_t *addr_lock; |
4165 | int err = 0; | 4165 | int err = 0; |
4166 | void *addrs; | 4166 | void *addrs; |
4167 | void *buf; | ||
4167 | int bytes_copied = 0; | 4168 | int bytes_copied = 0; |
4168 | 4169 | ||
4169 | if (len != sizeof(struct sctp_getaddrs_old)) | 4170 | if (len != sizeof(struct sctp_getaddrs_old)) |
@@ -4217,13 +4218,14 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, | |||
4217 | } | 4218 | } |
4218 | } | 4219 | } |
4219 | 4220 | ||
4221 | buf = addrs; | ||
4220 | list_for_each(pos, &bp->address_list) { | 4222 | list_for_each(pos, &bp->address_list) { |
4221 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 4223 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
4222 | memcpy(&temp, &addr->a, sizeof(temp)); | 4224 | memcpy(&temp, &addr->a, sizeof(temp)); |
4223 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); | 4225 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); |
4224 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | 4226 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; |
4225 | memcpy(addrs, &temp, addrlen); | 4227 | memcpy(buf, &temp, addrlen); |
4226 | to += addrlen; | 4228 | buf += addrlen; |
4227 | bytes_copied += addrlen; | 4229 | bytes_copied += addrlen; |
4228 | cnt ++; | 4230 | cnt ++; |
4229 | if (cnt >= getaddrs.addr_num) break; | 4231 | if (cnt >= getaddrs.addr_num) break; |
@@ -4266,6 +4268,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, | |||
4266 | size_t space_left; | 4268 | size_t space_left; |
4267 | int bytes_copied = 0; | 4269 | int bytes_copied = 0; |
4268 | void *addrs; | 4270 | void *addrs; |
4271 | void *buf; | ||
4269 | 4272 | ||
4270 | if (len <= sizeof(struct sctp_getaddrs)) | 4273 | if (len <= sizeof(struct sctp_getaddrs)) |
4271 | return -EINVAL; | 4274 | return -EINVAL; |
@@ -4316,6 +4319,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, | |||
4316 | } | 4319 | } |
4317 | } | 4320 | } |
4318 | 4321 | ||
4322 | buf = addrs; | ||
4319 | list_for_each(pos, &bp->address_list) { | 4323 | list_for_each(pos, &bp->address_list) { |
4320 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 4324 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
4321 | memcpy(&temp, &addr->a, sizeof(temp)); | 4325 | memcpy(&temp, &addr->a, sizeof(temp)); |
@@ -4325,8 +4329,8 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, | |||
4325 | err = -ENOMEM; /*fixme: right error?*/ | 4329 | err = -ENOMEM; /*fixme: right error?*/ |
4326 | goto error; | 4330 | goto error; |
4327 | } | 4331 | } |
4328 | memcpy(addrs, &temp, addrlen); | 4332 | memcpy(buf, &temp, addrlen); |
4329 | to += addrlen; | 4333 | buf += addrlen; |
4330 | bytes_copied += addrlen; | 4334 | bytes_copied += addrlen; |
4331 | cnt ++; | 4335 | cnt ++; |
4332 | space_left -= addrlen; | 4336 | space_left -= addrlen; |
@@ -5227,7 +5231,12 @@ int sctp_inet_listen(struct socket *sock, int backlog) | |||
5227 | /* Allocate HMAC for generating cookie. */ | 5231 | /* Allocate HMAC for generating cookie. */ |
5228 | if (sctp_hmac_alg) { | 5232 | if (sctp_hmac_alg) { |
5229 | tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC); | 5233 | tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC); |
5230 | if (!tfm) { | 5234 | if (IS_ERR(tfm)) { |
5235 | if (net_ratelimit()) { | ||
5236 | printk(KERN_INFO | ||
5237 | "SCTP: failed to load transform for %s: %ld\n", | ||
5238 | sctp_hmac_alg, PTR_ERR(tfm)); | ||
5239 | } | ||
5231 | err = -ENOSYS; | 5240 | err = -ENOSYS; |
5232 | goto out; | 5241 | goto out; |
5233 | } | 5242 | } |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 661ea2dd78..bfecb353ab 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -141,11 +141,6 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( | |||
141 | * an ABORT, so we need to include it in the sac_info. | 141 | * an ABORT, so we need to include it in the sac_info. |
142 | */ | 142 | */ |
143 | if (chunk) { | 143 | if (chunk) { |
144 | /* sctp_inqu_pop() has allready pulled off the chunk | ||
145 | * header. We need to put it back temporarily | ||
146 | */ | ||
147 | skb_push(chunk->skb, sizeof(sctp_chunkhdr_t)); | ||
148 | |||
149 | /* Copy the chunk data to a new skb and reserve enough | 144 | /* Copy the chunk data to a new skb and reserve enough |
150 | * head room to use as notification. | 145 | * head room to use as notification. |
151 | */ | 146 | */ |
@@ -155,9 +150,6 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( | |||
155 | if (!skb) | 150 | if (!skb) |
156 | goto fail; | 151 | goto fail; |
157 | 152 | ||
158 | /* put back the chunk header now that we have a copy */ | ||
159 | skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); | ||
160 | |||
161 | /* Embed the event fields inside the cloned skb. */ | 153 | /* Embed the event fields inside the cloned skb. */ |
162 | event = sctp_skb2event(skb); | 154 | event = sctp_skb2event(skb); |
163 | sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); | 155 | sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); |
@@ -168,7 +160,8 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( | |||
168 | 160 | ||
169 | /* Trim the buffer to the right length. */ | 161 | /* Trim the buffer to the right length. */ |
170 | skb_trim(skb, sizeof(struct sctp_assoc_change) + | 162 | skb_trim(skb, sizeof(struct sctp_assoc_change) + |
171 | ntohs(chunk->chunk_hdr->length)); | 163 | ntohs(chunk->chunk_hdr->length) - |
164 | sizeof(sctp_chunkhdr_t)); | ||
172 | } else { | 165 | } else { |
173 | event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change), | 166 | event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change), |
174 | MSG_NOTIFICATION, gfp); | 167 | MSG_NOTIFICATION, gfp); |