Skip to content

Commit

Permalink
sctp: use right member as the param of list_for_each_entry
Browse files Browse the repository at this point in the history
Commit d04adf1 ("sctp: reset owner sk for data chunks on out queues
when migrating a sock") made a mistake that using 'list' as the param of
list_for_each_entry to traverse the retransmit, sacked and abandoned
queues, while chunks are using 'transmitted_list' to link into these
queues.

It could cause NULL dereference panic if there are chunks in any of these
queues when peeling off one asoc.

So use the chunk member 'transmitted_list' instead in this patch.

Fixes: d04adf1 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xin Long authored and David S. Miller committed Nov 28, 2017
1 parent f85729d commit a8dd397
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc,
list_for_each_entry(chunk, &t->transmitted, transmitted_list)
cb(chunk);

list_for_each_entry(chunk, &q->retransmit, list)
list_for_each_entry(chunk, &q->retransmit, transmitted_list)
cb(chunk);

list_for_each_entry(chunk, &q->sacked, list)
list_for_each_entry(chunk, &q->sacked, transmitted_list)
cb(chunk);

list_for_each_entry(chunk, &q->abandoned, list)
list_for_each_entry(chunk, &q->abandoned, transmitted_list)
cb(chunk);

list_for_each_entry(chunk, &q->out_chunk_list, list)
Expand Down

0 comments on commit a8dd397

Please sign in to comment.