sctp: shrink stream outq only when new outcnt < old outcnt
authorXin Long <lucien.xin@gmail.com>
Wed, 22 Jul 2020 15:52:11 +0000 (23:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jul 2020 01:00:12 +0000 (18:00 -0700)
commit8f13399db22f909a35735bf8ae2f932e0c8f0e30
tree076d3e3508f1f1b7f8fe8f219ff3b3066459e0e9
parent2f2a7ffad5c6cbf3d438e813cfdc88230e185ba6
sctp: shrink stream outq only when new outcnt < old outcnt

It's not necessary to go list_for_each for outq->out_chunk_list
when new outcnt >= old outcnt, as no chunk with higher sid than
new (outcnt - 1) exists in the outqueue.

While at it, also move the list_for_each code in a new function
sctp_stream_shrink_out(), which will be used in the next patch.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/stream.c