diff options
author | David S. Miller <davem@davemloft.net> | 2012-11-29 12:51:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-29 12:51:17 -0500 |
commit | 8a2cf062b27ef5511a7d8a7ce6662fbc04f671b8 (patch) | |
tree | 31f32c0d9a548f0dbbe9f3a32aca5767093d98b4 /net/sctp | |
parent | 3177bf6f922f62743133abbcbbbb5545f4133b2d (diff) | |
parent | e9296e89b85604862bd9ec2d54dc43edad775c0d (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/chunk.c | 20 | ||||
-rw-r--r-- | net/sctp/socket.c | 4 | ||||
-rw-r--r-- | net/sctp/transport.c | 2 |
3 files changed, 17 insertions, 9 deletions
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c index 7c2df9c33df3..69ce21e3716f 100644 --- a/net/sctp/chunk.c +++ b/net/sctp/chunk.c | |||
@@ -183,7 +183,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
183 | 183 | ||
184 | msg = sctp_datamsg_new(GFP_KERNEL); | 184 | msg = sctp_datamsg_new(GFP_KERNEL); |
185 | if (!msg) | 185 | if (!msg) |
186 | return NULL; | 186 | return ERR_PTR(-ENOMEM); |
187 | 187 | ||
188 | /* Note: Calculate this outside of the loop, so that all fragments | 188 | /* Note: Calculate this outside of the loop, so that all fragments |
189 | * have the same expiration. | 189 | * have the same expiration. |
@@ -280,11 +280,14 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
280 | 280 | ||
281 | chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, 0); | 281 | chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, 0); |
282 | 282 | ||
283 | if (!chunk) | 283 | if (!chunk) { |
284 | err = -ENOMEM; | ||
284 | goto errout; | 285 | goto errout; |
286 | } | ||
287 | |||
285 | err = sctp_user_addto_chunk(chunk, offset, len, msgh->msg_iov); | 288 | err = sctp_user_addto_chunk(chunk, offset, len, msgh->msg_iov); |
286 | if (err < 0) | 289 | if (err < 0) |
287 | goto errout; | 290 | goto errout_chunk_free; |
288 | 291 | ||
289 | offset += len; | 292 | offset += len; |
290 | 293 | ||
@@ -315,8 +318,10 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
315 | 318 | ||
316 | chunk = sctp_make_datafrag_empty(asoc, sinfo, over, frag, 0); | 319 | chunk = sctp_make_datafrag_empty(asoc, sinfo, over, frag, 0); |
317 | 320 | ||
318 | if (!chunk) | 321 | if (!chunk) { |
322 | err = -ENOMEM; | ||
319 | goto errout; | 323 | goto errout; |
324 | } | ||
320 | 325 | ||
321 | err = sctp_user_addto_chunk(chunk, offset, over,msgh->msg_iov); | 326 | err = sctp_user_addto_chunk(chunk, offset, over,msgh->msg_iov); |
322 | 327 | ||
@@ -324,7 +329,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
324 | __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr | 329 | __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr |
325 | - (__u8 *)chunk->skb->data); | 330 | - (__u8 *)chunk->skb->data); |
326 | if (err < 0) | 331 | if (err < 0) |
327 | goto errout; | 332 | goto errout_chunk_free; |
328 | 333 | ||
329 | sctp_datamsg_assign(msg, chunk); | 334 | sctp_datamsg_assign(msg, chunk); |
330 | list_add_tail(&chunk->frag_list, &msg->chunks); | 335 | list_add_tail(&chunk->frag_list, &msg->chunks); |
@@ -332,6 +337,9 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
332 | 337 | ||
333 | return msg; | 338 | return msg; |
334 | 339 | ||
340 | errout_chunk_free: | ||
341 | sctp_chunk_free(chunk); | ||
342 | |||
335 | errout: | 343 | errout: |
336 | list_for_each_safe(pos, temp, &msg->chunks) { | 344 | list_for_each_safe(pos, temp, &msg->chunks) { |
337 | list_del_init(pos); | 345 | list_del_init(pos); |
@@ -339,7 +347,7 @@ errout: | |||
339 | sctp_chunk_free(chunk); | 347 | sctp_chunk_free(chunk); |
340 | } | 348 | } |
341 | sctp_datamsg_put(msg); | 349 | sctp_datamsg_put(msg); |
342 | return NULL; | 350 | return ERR_PTR(err); |
343 | } | 351 | } |
344 | 352 | ||
345 | /* Check whether this message has expired. */ | 353 | /* Check whether this message has expired. */ |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 2e897069310a..bc1624913c42 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1916,8 +1916,8 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1916 | 1916 | ||
1917 | /* Break the message into multiple chunks of maximum size. */ | 1917 | /* Break the message into multiple chunks of maximum size. */ |
1918 | datamsg = sctp_datamsg_from_user(asoc, sinfo, msg, msg_len); | 1918 | datamsg = sctp_datamsg_from_user(asoc, sinfo, msg, msg_len); |
1919 | if (!datamsg) { | 1919 | if (IS_ERR(datamsg)) { |
1920 | err = -ENOMEM; | 1920 | err = PTR_ERR(datamsg); |
1921 | goto out_free; | 1921 | goto out_free; |
1922 | } | 1922 | } |
1923 | 1923 | ||
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 953c21e4af97..206cf5238fd3 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -331,7 +331,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) | |||
331 | * 1/8, rto_alpha would be expressed as 3. | 331 | * 1/8, rto_alpha would be expressed as 3. |
332 | */ | 332 | */ |
333 | tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta) | 333 | tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta) |
334 | + ((abs(tp->srtt - rtt)) >> net->sctp.rto_beta); | 334 | + (((__u32)abs64((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta); |
335 | tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha) | 335 | tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha) |
336 | + (rtt >> net->sctp.rto_alpha); | 336 | + (rtt >> net->sctp.rto_alpha); |
337 | } else { | 337 | } else { |