android_kernel_xiaomi_sm8450/net/sctp
Chengfeng Ye 6d2243ab78 sctp: fix potential deadlock on &net->sctp.addr_wq_lock
[ Upstream commit 6feb37b3b06e9049e20dcf7e23998f92c9c5be9a ]

As &net->sctp.addr_wq_lock is also acquired by the timer
sctp_addr_wq_timeout_handler() in protocal.c, the same lock acquisition
at sctp_auto_asconf_init() seems should disable irq since it is called
from sctp_accept() under process context.

Possible deadlock scenario:
sctp_accept()
    -> sctp_sock_migrate()
    -> sctp_auto_asconf_init()
    -> spin_lock(&net->sctp.addr_wq_lock)
        <timer interrupt>
        -> sctp_addr_wq_timeout_handler()
        -> spin_lock_bh(&net->sctp.addr_wq_lock); (deadlock here)

This flaw was found using an experimental static analysis tool we are
developing for irq-related deadlock.

The tentative patch fix the potential deadlock by spin_lock_bh().

Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Fixes: 34e5b0118685 ("sctp: delay auto_asconf init until binding the first addr")
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/20230627120340.19432-1-dg573847474@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-27 08:44:08 +02:00
..
associola.c sctp: leave the err path free in sctp_stream_init to sctp_stream_free 2022-08-03 12:00:49 +02:00
auth.c sctp: handle the error returned from sctp_auth_asoc_init_active_key 2022-10-26 13:25:23 +02:00
bind_addr.c sctp: fail if no bound addresses can be used for a given scope 2023-02-01 08:23:25 +01:00
chunk.c net: sctp: chunk.c: delete duplicated word 2020-08-24 16:21:43 -07: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:55:57 +01:00
endpointola.c sctp: use call_rcu to free endpoint 2022-01-05 12:40:30 +01:00
input.c sctp: read sk->sk_bound_dev_if once in sctp_rcv() 2022-06-09 10:21:09 +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 09:44:55 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09: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: get netns from asoc and ep base 2019-12-09 20:14:01 -08:00
outqueue.c sctp: clear out_curr if all frag chunks of current msg are pruned 2022-11-25 17:45:43 +01: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 11:02:29 +01:00
protocol.c ip: Fix data-races around sysctl_ip_nonlocal_bind. 2022-07-29 17:19:12 +02:00
sm_make_chunk.c sctp: account stream padding length for reconf chunk 2021-10-20 11:45:03 +02:00
sm_sideeffect.c sctp: check asoc strreset_chunk in sctp_generate_reconf_event 2022-05-09 09:05:03 +02:00
sm_statefuns.c sctp: fix an error code in sctp_sf_eat_auth() 2023-06-21 15:45:39 +02: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: fix potential deadlock on &net->sctp.addr_wq_lock 2023-07-27 08:44:08 +02:00
stream_interleave.c sctp: fix a potential overflow in sctp_ifwdtsn_skip 2023-04-20 12:10:26 +02:00
stream_sched_prio.c sctp: add a refcnt in sctp_stream_priorities to avoid a nested loop 2023-03-11 16:40:12 +01:00
stream_sched_rr.c sctp: fix memory leak in sctp_stream_outq_migrate() 2022-12-08 11:23:57 +01:00
stream_sched.c sctp: fix memory leak in sctp_stream_outq_migrate() 2022-12-08 11:23:57 +01:00
stream.c sctp: fix memory leak in sctp_stream_outq_migrate() 2022-12-08 11:23:57 +01:00
sysctl.c sctp: sysctl: make extra pointers netns aware 2023-01-14 10:15:44 +01:00
transport.c sctp: change to hold/put transport for proto_unreach_timer 2020-11-14 11:57:12 -08:00
tsnmap.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 104 2019-05-24 17:39:00 +02:00
ulpevent.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-05-31 17:48:46 -07:00
ulpqueue.c net: sctp: ulpqueue.c: delete duplicated word 2020-08-24 16:21:43 -07:00