Re: [syzbot] [PATCH] test uaf in sco_sock_timeout

From: syzbot
Date: Thu Nov 16 2023 - 20:04:52 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: [PATCH] test uaf in sco_sock_timeout
Author: lizhi.xu@xxxxxxxxxxxxx

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c

diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..515b52e14b5f 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -415,6 +415,8 @@ static void sco_sock_cleanup_listen(struct sock *parent)
*/
static void sco_sock_kill(struct sock *sk)
{
+ struct sco_conn *conn = container_of(sk, struct sco_conn, sk);
+
if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
return;

@@ -423,6 +425,9 @@ static void sco_sock_kill(struct sock *sk)
/* Kill poor orphan */
bt_sock_unlink(&sco_sk_list, sk);
sock_set_flag(sk, SOCK_DEAD);
+ sco_conn_lock(conn);
+ conn->sk = NULL;
+ sco_conn_unlock(conn);
sock_put(sk);
}