]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: fix init and cleanup of sco_conn.timeout_work
authorDesmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Fri, 3 Sep 2021 03:13:06 +0000 (23:13 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 3 Sep 2021 23:33:10 +0000 (16:33 -0700)
commit6f10707b4d48134bdf3952106546e4af800a24ad
tree698d6a3a5bbd7dec1c3011657c0d63b8fb4d8052
parent901c4d17518cd1b1ab50926ba3d004d6fc130dfe
Bluetooth: fix init and cleanup of sco_conn.timeout_work

Before freeing struct sco_conn, all delayed timeout work should be
cancelled. Otherwise, sco_sock_timeout could potentially use the
sco_conn after it has been freed.

Additionally, sco_conn.timeout_work should be initialized when the
connection is allocated, not when the channel is added. This is
because an sco_conn can create channels with multiple sockets over its
lifetime, which happens if sockets are released but the connection
isn't deleted.

Fixes: 45bebe514d7f ("Bluetooth: schedule SCO timeouts with delayed_work")
Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/sco.c