Bluetooth: SCO: Fix UAF on sco_sock_timeout
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 22 Oct 2024 16:31:08 +0000 (12:31 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 23 Oct 2024 14:20:29 +0000 (10:20 -0400)
commit1bf4470a3939c678fb822073e9ea77a0560bc6bb
tree4e3b5bfbbaf5f90fa8cc5bfed68e30405229f41e
parent989fa5171f005ecf63440057218d8aeb1795287d
Bluetooth: SCO: Fix UAF on sco_sock_timeout

conn->sk maybe have been unlinked/freed while waiting for sco_conn_lock
so this checks if the conn->sk is still valid by checking if it part of
sco_sk_list.

Reported-by: syzbot+4c0d0c4cde787116d465@syzkaller.appspotmail.com
Tested-by: syzbot+4c0d0c4cde787116d465@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4c0d0c4cde787116d465
Fixes: ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
include/net/bluetooth/bluetooth.h
net/bluetooth/af_bluetooth.c
net/bluetooth/sco.c