diff options
Diffstat (limited to 'net/sctp/ulpevent.c')
-rw-r--r-- | net/sctp/ulpevent.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index bfecb353ab3d..5dc094b9732d 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -685,6 +685,24 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, | |||
685 | struct sctp_ulpevent *event = NULL; | 685 | struct sctp_ulpevent *event = NULL; |
686 | struct sk_buff *skb; | 686 | struct sk_buff *skb; |
687 | size_t padding, len; | 687 | size_t padding, len; |
688 | int rx_count; | ||
689 | |||
690 | /* | ||
691 | * check to see if we need to make space for this | ||
692 | * new skb, expand the rcvbuffer if needed, or drop | ||
693 | * the frame | ||
694 | */ | ||
695 | if (asoc->ep->rcvbuf_policy) | ||
696 | rx_count = atomic_read(&asoc->rmem_alloc); | ||
697 | else | ||
698 | rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc); | ||
699 | |||
700 | if (rx_count >= asoc->base.sk->sk_rcvbuf) { | ||
701 | |||
702 | if ((asoc->base.sk->sk_userlocks & SOCK_RCVBUF_LOCK) || | ||
703 | (!sk_stream_rmem_schedule(asoc->base.sk, chunk->skb))) | ||
704 | goto fail; | ||
705 | } | ||
688 | 706 | ||
689 | /* Clone the original skb, sharing the data. */ | 707 | /* Clone the original skb, sharing the data. */ |
690 | skb = skb_clone(chunk->skb, gfp); | 708 | skb = skb_clone(chunk->skb, gfp); |