android_kernel_asus_sm8350/net/sctp
Xin Long cec326443f sctp: add a refcnt in sctp_stream_priorities to avoid a nested loop
[ Upstream commit 68ba44639537de6f91fe32783766322d41848127 ]

With this refcnt added in sctp_stream_priorities, we don't need to
traverse all streams to check if the prio is used by other streams
when freeing one stream's prio in sctp_sched_prio_free_sid(). This
can avoid a nested loop (up to 65535 * 65535), which may cause a
stuck as Ying reported:

    watchdog: BUG: soft lockup - CPU#23 stuck for 26s! [ksoftirqd/23:136]
    Call Trace:
     <TASK>
     sctp_sched_prio_free_sid+0xab/0x100 [sctp]
     sctp_stream_free_ext+0x64/0xa0 [sctp]
     sctp_stream_free+0x31/0x50 [sctp]
     sctp_association_free+0xa5/0x200 [sctp]

Note that it doesn't need to use refcount_t type for this counter,
as its accessing is always protected under the sock lock.

v1->v2:
 - add a check in sctp_sched_prio_set to avoid the possible prio_head
   refcnt overflow.

Fixes: 9ed7bfc79542 ("sctp: fix memory leak in sctp_stream_outq_migrate()")
Reported-by: Ying Xu <yinxu@redhat.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/825eb0c905cb864991eba335f4a2b780e543f06b.1677085641.git.lucien.xin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-11 16:44:11 +01:00
..
associola.c sctp: leave the err path free in sctp_stream_init to sctp_stream_free 2022-08-03 11:59:41 +02:00
auth.c sctp: handle the error returned from sctp_auth_asoc_init_active_key 2022-10-26 13:22:26 +02:00
bind_addr.c sctp: fail if no bound addresses can be used for a given scope 2023-02-06 07:52:46 +01:00
chunk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
debug.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
diag.c sctp: sctp_sock_filter(): avoid list_entry() on possibly empty list 2023-02-22 12:50:40 +01:00
endpointola.c sctp: use call_rcu to free endpoint 2022-01-05 12:37:44 +01:00
input.c sctp: read sk->sk_bound_dev_if once in sctp_rcv() 2022-06-14 18:11:37 +02:00
inqueue.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
ipv6.c sctp: validate from_addr_param return 2021-07-19 08:53:13 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile sctp: rename sctp_diag.c as diag.c 2018-02-13 13:56:31 -05:00
objcnt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
offload.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-07 11:00:14 -07:00
output.c sctp: count data bundling sack chunk for outctrlchunks 2019-07-03 11:41:24 -07:00
outqueue.c sctp: move trace_sctp_probe_path into sctp_outq_sack 2020-10-01 13:17:27 +02:00
primitive.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
proc.c net: fix iteration for sctp transport seq_files 2021-02-17 10:35:19 +01:00
protocol.c ip: Fix data-races around sysctl_ip_nonlocal_bind. 2022-07-29 17:14:11 +02:00
sm_make_chunk.c sctp: account stream padding length for reconf chunk 2021-10-20 11:40:15 +02:00
sm_sideeffect.c sctp: check asoc strreset_chunk in sctp_generate_reconf_event 2022-05-09 09:03:24 +02:00
sm_statefuns.c sctp: fix the processing for INIT chunk 2022-03-19 13:40:13 +01:00
sm_statetable.c sctp: remove net sctp.x_enable working as a global switch 2019-08-19 18:27:29 -07:00
socket.c sctp: Initialize daddr on peeled off socket 2022-04-20 09:19:35 +02:00
stream_interleave.c sctp: rename asoc intl_enable to asoc peer.intl_capable 2019-07-08 20:16:25 -07:00
stream_sched_prio.c sctp: add a refcnt in sctp_stream_priorities to avoid a nested loop 2023-03-11 16:44:11 +01:00
stream_sched_rr.c sctp: fix memory leak in sctp_stream_outq_migrate() 2022-12-08 11:23:03 +01:00
stream_sched.c sctp: fix memory leak in sctp_stream_outq_migrate() 2022-12-08 11:23:03 +01:00
stream.c sctp: fix memory leak in sctp_stream_outq_migrate() 2022-12-08 11:23:03 +01:00
sysctl.c sctp: allow users to set netns ecn flag with sysctl 2019-08-27 20:54:14 -07:00
transport.c sctp: change to hold/put transport for proto_unreach_timer 2020-11-24 13:28:59 +01:00
tsnmap.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
ulpevent.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
ulpqueue.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00