Commit f1533cce authored by Marcelo Ricardo Leitner's avatar Marcelo Ricardo Leitner Committed by David S. Miller
Browse files

sctp: fix panic when sending auth chunks

When we introduced GSO support, if using auth the auth chunk was being
left queued on the packet even after the final segment was generated.
Later on sctp_transmit_packet it calls sctp_packet_reset, which zeroed
the packet len while not accounting for this left-over. This caused more
space to be used the next packet due to the chunk still being queued,
but space which wasn't allocated as its size wasn't accounted.

The fix is to only queue it back when we know that we are going to
generate another segment.

Fixes: 90017acc

 ("sctp: Add GSO support")
Signed-off-by: default avatarMarcelo Ricardo Leitner <>
Signed-off-by: default avatarDavid S. Miller <>
parent 09a7636a
......@@ -582,9 +582,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
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)
if (!pkt_size)
......@@ -605,6 +603,18 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
(struct sctp_auth_chunk *)auth,
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 {
packet->auth = NULL;
if (!gso)
......@@ -735,6 +745,8 @@ err:
goto out;
if (packet->auth && list_empty(&packet->auth->list))
err = -ENOMEM;
goto err;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment