WSL2-Linux-Kernel/net/rose
Hyunwoo Kim 6769cd8a74 net/rose: Fix to not accept on connected socket
[ Upstream commit 14caefcf98 ]

If you call listen() and accept() on an already connect()ed
rose socket, accept() can successfully connect.
This is because when the peer socket sends data to sendmsg,
the skb with its own sk stored in the connected socket's
sk->sk_receive_queue is connected, and rose_accept() dequeues
the skb waiting in the sk->sk_receive_queue.

This creates a child socket with the sk of the parent
rose socket, which can cause confusion.

Fix rose_listen() to return -EINVAL if the socket has
already been successfully connected, and add lock_sock
to prevent this issue.

Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20230125105944.GA133314@ubuntu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-22 12:57:02 +01:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
af_rose.c net/rose: Fix to not accept on connected socket 2023-02-22 12:57:02 +01:00
rose_dev.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rose_in.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
rose_link.c rose: Fix NULL pointer dereference in rose_send_frame() 2022-11-10 18:15:29 +01:00
rose_loopback.c rose: check NULL rose_loopback_neigh->loopback 2022-08-31 17:16:38 +02:00
rose_out.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rose_route.c net: rose: fix netdev reference changes 2022-08-17 14:23:37 +02:00
rose_subr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rose_timer.c net: rose: fix UAF bugs caused by timer handler 2022-07-07 17:53:25 +02:00
sysctl_net_rose.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00