Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work
authorZheng Wang <zyytlz.wz@163.com>
Thu, 9 Mar 2023 08:07:39 +0000 (16:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 10:49:12 +0000 (12:49 +0200)
commitcbf8deacb7053ce3e3fed64b277c6c6989e65bba
treed0cdb680162a2d5e1526908c780f74309e19bcb5
parentc357e28b01c4cfbc3131cac030308c3bb326f5f3
Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work

[ Upstream commit 1e9ac114c4428fdb7ff4635b45d4f46017e8916f ]

In btsdio_probe, &data->work was bound with btsdio_work.In
btsdio_send_frame, it was started by schedule_work.

If we call btsdio_remove with an unfinished job, there may
be a race condition and cause UAF bug on hdev.

Fixes: ddbaf13e3609 ("[Bluetooth] Add generic driver for Bluetooth SDIO devices")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/bluetooth/btsdio.c