aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/ulpqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/ulpqueue.c')
-rw-r--r--net/sctp/ulpqueue.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 97fae53310e0..0b427100b0d4 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -1093,29 +1093,21 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
1093void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, 1093void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
1094 gfp_t gfp) 1094 gfp_t gfp)
1095{ 1095{
1096 struct sctp_association *asoc; 1096 struct sctp_association *asoc = ulpq->asoc;
1097 __u16 needed, freed; 1097 __u32 freed = 0;
1098 1098 __u16 needed;
1099 asoc = ulpq->asoc;
1100 1099
1101 if (chunk) { 1100 needed = ntohs(chunk->chunk_hdr->length) -
1102 needed = ntohs(chunk->chunk_hdr->length); 1101 sizeof(struct sctp_data_chunk);
1103 needed -= sizeof(struct sctp_data_chunk);
1104 } else
1105 needed = SCTP_DEFAULT_MAXWINDOW;
1106
1107 freed = 0;
1108 1102
1109 if (skb_queue_empty(&asoc->base.sk->sk_receive_queue)) { 1103 if (skb_queue_empty(&asoc->base.sk->sk_receive_queue)) {
1110 freed = sctp_ulpq_renege_order(ulpq, needed); 1104 freed = sctp_ulpq_renege_order(ulpq, needed);
1111 if (freed < needed) { 1105 if (freed < needed)
1112 freed += sctp_ulpq_renege_frags(ulpq, needed - freed); 1106 freed += sctp_ulpq_renege_frags(ulpq, needed - freed);
1113 }
1114 } 1107 }
1115 /* If able to free enough room, accept this chunk. */ 1108 /* If able to free enough room, accept this chunk. */
1116 if (chunk && (freed >= needed)) { 1109 if (freed >= needed) {
1117 int retval; 1110 int retval = sctp_ulpq_tail_data(ulpq, chunk, gfp);
1118 retval = sctp_ulpq_tail_data(ulpq, chunk, gfp);
1119 /* 1111 /*
1120 * Enter partial delivery if chunk has not been 1112 * Enter partial delivery if chunk has not been
1121 * delivered; otherwise, drain the reassembly queue. 1113 * delivered; otherwise, drain the reassembly queue.