aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/output.c')
-rw-r--r--net/dccp/output.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 0248e8a3460c..4ce912e691d0 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -390,7 +390,7 @@ int dccp_retransmit_skb(struct sock *sk)
390 return dccp_transmit_skb(sk, skb_clone(sk->sk_send_head, GFP_ATOMIC)); 390 return dccp_transmit_skb(sk, skb_clone(sk->sk_send_head, GFP_ATOMIC));
391} 391}
392 392
393struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, 393struct sk_buff *dccp_make_response(const struct sock *sk, struct dst_entry *dst,
394 struct request_sock *req) 394 struct request_sock *req)
395{ 395{
396 struct dccp_hdr *dh; 396 struct dccp_hdr *dh;
@@ -398,13 +398,18 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
398 const u32 dccp_header_size = sizeof(struct dccp_hdr) + 398 const u32 dccp_header_size = sizeof(struct dccp_hdr) +
399 sizeof(struct dccp_hdr_ext) + 399 sizeof(struct dccp_hdr_ext) +
400 sizeof(struct dccp_hdr_response); 400 sizeof(struct dccp_hdr_response);
401 struct sk_buff *skb = sock_wmalloc(sk, sk->sk_prot->max_header, 1, 401 struct sk_buff *skb;
402 GFP_ATOMIC); 402
403 if (skb == NULL) 403 /* sk is marked const to clearly express we dont hold socket lock.
404 * sock_wmalloc() will atomically change sk->sk_wmem_alloc,
405 * it is safe to promote sk to non const.
406 */
407 skb = sock_wmalloc((struct sock *)sk, MAX_DCCP_HEADER, 1,
408 GFP_ATOMIC);
409 if (!skb)
404 return NULL; 410 return NULL;
405 411
406 /* Reserve space for headers. */ 412 skb_reserve(skb, MAX_DCCP_HEADER);
407 skb_reserve(skb, sk->sk_prot->max_header);
408 413
409 skb_dst_set(skb, dst_clone(dst)); 414 skb_dst_set(skb, dst_clone(dst));
410 415