diff options
Diffstat (limited to 'net/sctp/sm_statefuns.c')
-rw-r--r-- | net/sctp/sm_statefuns.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 505c7de10c50..475bfb4972d9 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -5160,6 +5160,8 @@ static int sctp_eat_data(const struct sctp_association *asoc, | |||
5160 | sctp_verb_t deliver; | 5160 | sctp_verb_t deliver; |
5161 | int tmp; | 5161 | int tmp; |
5162 | __u32 tsn; | 5162 | __u32 tsn; |
5163 | int account_value; | ||
5164 | struct sock *sk = asoc->base.sk; | ||
5163 | 5165 | ||
5164 | data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *)chunk->skb->data; | 5166 | data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *)chunk->skb->data; |
5165 | skb_pull(chunk->skb, sizeof(sctp_datahdr_t)); | 5167 | skb_pull(chunk->skb, sizeof(sctp_datahdr_t)); |
@@ -5169,6 +5171,26 @@ static int sctp_eat_data(const struct sctp_association *asoc, | |||
5169 | 5171 | ||
5170 | /* ASSERT: Now skb->data is really the user data. */ | 5172 | /* ASSERT: Now skb->data is really the user data. */ |
5171 | 5173 | ||
5174 | /* | ||
5175 | * if we are established, and we have used up our receive | ||
5176 | * buffer memory, drop the frame | ||
5177 | */ | ||
5178 | if (asoc->state == SCTP_STATE_ESTABLISHED) { | ||
5179 | /* | ||
5180 | * If the receive buffer policy is 1, then each | ||
5181 | * association can allocate up to sk_rcvbuf bytes | ||
5182 | * otherwise, all the associations in aggregate | ||
5183 | * may allocate up to sk_rcvbuf bytes | ||
5184 | */ | ||
5185 | if (asoc->ep->rcvbuf_policy) | ||
5186 | account_value = atomic_read(&asoc->rmem_alloc); | ||
5187 | else | ||
5188 | account_value = atomic_read(&sk->sk_rmem_alloc); | ||
5189 | |||
5190 | if (account_value > sk->sk_rcvbuf) | ||
5191 | return SCTP_IERROR_IGNORE_TSN; | ||
5192 | } | ||
5193 | |||
5172 | /* Process ECN based congestion. | 5194 | /* Process ECN based congestion. |
5173 | * | 5195 | * |
5174 | * Since the chunk structure is reused for all chunks within | 5196 | * Since the chunk structure is reused for all chunks within |