android_kernel_xiaomi_sm8450/net/rds
Allison Henderson 338a3ba30c net:rds: Fix possible deadlock in rds_message_put
commit f1acf1ac84d2ae97b7889b87223c1064df850069 upstream.

Functions rds_still_queued and rds_clear_recv_queue lock a given socket
in order to safely iterate over the incoming rds messages. However
calling rds_inc_put while under this lock creates a potential deadlock.
rds_inc_put may eventually call rds_message_purge, which will lock
m_rs_lock. This is the incorrect locking order since m_rs_lock is
meant to be locked before the socket. To fix this, we move the message
item to a local list or variable that wont need rs_recv_lock protection.
Then we can safely call rds_inc_put on any item stored locally after
rs_recv_lock is released.

Fixes: bdbe6fbc6a ("RDS: recv.c")
Reported-by: syzbot+f9db6ff27b9bfdcfeca0@syzkaller.appspotmail.com
Reported-by: syzbot+dcd73ff9291e6d34b3ab@syzkaller.appspotmail.com
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Link: https://lore.kernel.org/r/20240209022854.200292-1-allison.henderson@oracle.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-04 13:17:45 +02:00
..
af_rds.c net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv 2024-02-23 08:41:56 +01:00
bind.c net/rds: Check laddr_check before calling it 2019-09-27 12:10:55 +02:00
cong.c net: rds: delete duplicated words 2020-09-18 14:12:43 -07:00
connection.c rds: memory leak in __rds_conn_create() 2021-12-22 09:30:54 +01:00
ib_cm.c rds: stop using dmapool 2021-11-18 14:03:44 +01:00
ib_frmr.c net/rds: dma_map_sg is entitled to merge entries 2021-09-03 10:09:28 +02:00
ib_mr.h RDMA/rds: Remove FMR support for memory registration 2020-06-02 20:32:53 -03:00
ib_rdma.c RDMA/rds: Remove FMR support for memory registration 2020-06-02 20:32:53 -03:00
ib_recv.c rds: add missing barrier to release_refill 2022-08-25 11:37:49 +02:00
ib_ring.c
ib_send.c rds: stop using dmapool 2021-11-18 14:03:44 +01:00
ib_stats.c net/rds: Fix 'ib_evt_handler_call' element in 'rds_ib_stat_names' 2019-09-15 20:56:19 +02:00
ib_sysctl.c
ib.c rds: stop using dmapool 2021-11-18 14:03:44 +01:00
ib.h rds: stop using dmapool 2021-11-18 14:03:44 +01:00
info.c rds: fix crash in rds_info_getsockopt() 2020-05-20 14:08:06 -07:00
info.h
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
loop.c rds: Changing IP address internal representation to struct in6_addr 2018-07-23 21:17:44 -07:00
loop.h rds: clean up loopback rds_connections on netns deletion 2018-06-27 10:11:03 +09:00
Makefile RDMA/rds: Remove FMR support for memory registration 2020-06-02 20:32:53 -03:00
message.c rds: rds_rm_zerocopy_callback() correct order for list_add_tail() 2023-03-11 16:39:26 +01:00
page.c
rdma_transport.c net: rds: Fix possible NULL-pointer dereference 2023-10-10 21:53:28 +02:00
rdma_transport.h net: rds: rdma_transport.h: delete duplicated word 2020-07-19 18:14:51 -07:00
rdma.c net/rds: fix possible cp null dereference 2024-04-13 12:59:19 +02:00
rds_single_path.h
rds.h net: pass a sockptr_t into ->setsockopt 2020-07-24 15:41:54 -07:00
recv.c net:rds: Fix possible deadlock in rds_message_put 2024-09-04 13:17:45 +02:00
send.c rds: introduce acquire/release ordering in acquire/release_in_xmit() 2024-03-26 18:22:03 -04:00
stats.c rds: check for excessive looping in rds_send_xmit 2019-08-15 12:04:24 -07:00
sysctl.c
tcp_connect.c net: prevent address rewrite in kernel_bind() 2023-10-25 11:54:13 +02:00
tcp_listen.c net: prevent address rewrite in kernel_bind() 2023-10-25 11:54:13 +02:00
tcp_recv.c rds: Changing IP address internal representation to struct in6_addr 2018-07-23 21:17:44 -07:00
tcp_send.c tcp: add tcp_sock_set_cork 2020-05-28 11:11:45 -07:00
tcp_stats.c
tcp.c net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks() 2022-10-26 13:25:23 +02:00
tcp.h RDS tcp loopback connection can hang 2021-06-16 12:01:36 +02:00
threads.c rds: make v3.1 as compat version 2019-02-04 14:59:11 -08:00
transport.c rds: transport module should be auto loaded when transport is set 2020-06-25 16:26:25 -07:00