*/
pkt_size -= WORD_ROUND(chunk->skb->len);
- if (chunk == packet->auth && !list_empty(&packet->chunk_list))
- list_add(&chunk->list, &packet->chunk_list);
- else if (!sctp_chunk_is_data(chunk))
+ if (!sctp_chunk_is_data(chunk) && chunk != packet->auth)
sctp_chunk_free(chunk);
if (!pkt_size)
(struct sctp_auth_chunk *)auth,
gfp);
+ if (packet->auth) {
+ if (!list_empty(&packet->chunk_list)) {
+ /* We will generate more packets, so re-queue
+ * auth chunk.
+ */
+ list_add(&chunk->list, &packet->chunk_list);
+ } else {
+ sctp_chunk_free(packet->auth);
+ packet->auth = NULL;
+ }
+ }
+
if (!gso)
break;
}
goto out;
nomem:
+ if (packet->auth && list_empty(&packet->auth->list))
+ sctp_chunk_free(packet->auth);
err = -ENOMEM;
goto err;
}