diff options
Diffstat (limited to 'net/sctp/inqueue.c')
-rw-r--r-- | net/sctp/inqueue.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c index cedf4351556c..2d33922c044b 100644 --- a/net/sctp/inqueue.c +++ b/net/sctp/inqueue.c | |||
@@ -50,7 +50,7 @@ | |||
50 | /* Initialize an SCTP inqueue. */ | 50 | /* Initialize an SCTP inqueue. */ |
51 | void sctp_inq_init(struct sctp_inq *queue) | 51 | void sctp_inq_init(struct sctp_inq *queue) |
52 | { | 52 | { |
53 | skb_queue_head_init(&queue->in); | 53 | INIT_LIST_HEAD(&queue->in_chunk_list); |
54 | queue->in_progress = NULL; | 54 | queue->in_progress = NULL; |
55 | 55 | ||
56 | /* Create a task for delivering data. */ | 56 | /* Create a task for delivering data. */ |
@@ -62,11 +62,13 @@ void sctp_inq_init(struct sctp_inq *queue) | |||
62 | /* Release the memory associated with an SCTP inqueue. */ | 62 | /* Release the memory associated with an SCTP inqueue. */ |
63 | void sctp_inq_free(struct sctp_inq *queue) | 63 | void sctp_inq_free(struct sctp_inq *queue) |
64 | { | 64 | { |
65 | struct sctp_chunk *chunk; | 65 | struct sctp_chunk *chunk, *tmp; |
66 | 66 | ||
67 | /* Empty the queue. */ | 67 | /* Empty the queue. */ |
68 | while ((chunk = (struct sctp_chunk *) skb_dequeue(&queue->in)) != NULL) | 68 | list_for_each_entry_safe(chunk, tmp, &queue->in_chunk_list, list) { |
69 | list_del_init(&chunk->list); | ||
69 | sctp_chunk_free(chunk); | 70 | sctp_chunk_free(chunk); |
71 | } | ||
70 | 72 | ||
71 | /* If there is a packet which is currently being worked on, | 73 | /* If there is a packet which is currently being worked on, |
72 | * free it as well. | 74 | * free it as well. |
@@ -92,7 +94,7 @@ void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *packet) | |||
92 | * Eventually, we should clean up inqueue to not rely | 94 | * Eventually, we should clean up inqueue to not rely |
93 | * on the BH related data structures. | 95 | * on the BH related data structures. |
94 | */ | 96 | */ |
95 | skb_queue_tail(&(q->in), (struct sk_buff *) packet); | 97 | list_add_tail(&packet->list, &q->in_chunk_list); |
96 | q->immediate.func(q->immediate.data); | 98 | q->immediate.func(q->immediate.data); |
97 | } | 99 | } |
98 | 100 | ||
@@ -131,12 +133,16 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) | |||
131 | 133 | ||
132 | /* Do we need to take the next packet out of the queue to process? */ | 134 | /* Do we need to take the next packet out of the queue to process? */ |
133 | if (!chunk) { | 135 | if (!chunk) { |
136 | struct list_head *entry; | ||
137 | |||
134 | /* Is the queue empty? */ | 138 | /* Is the queue empty? */ |
135 | if (skb_queue_empty(&queue->in)) | 139 | if (list_empty(&queue->in_chunk_list)) |
136 | return NULL; | 140 | return NULL; |
137 | 141 | ||
142 | entry = queue->in_chunk_list.next; | ||
138 | chunk = queue->in_progress = | 143 | chunk = queue->in_progress = |
139 | (struct sctp_chunk *) skb_dequeue(&queue->in); | 144 | list_entry(entry, struct sctp_chunk, list); |
145 | list_del_init(entry); | ||
140 | 146 | ||
141 | /* This is the first chunk in the packet. */ | 147 | /* This is the first chunk in the packet. */ |
142 | chunk->singleton = 1; | 148 | chunk->singleton = 1; |