Message ID | 20230309080739.3714610-1-zyytlz.wz@163.com |
---|---|
State | Accepted |
Commit | f132c2d1308895b0a10e0f0c5f9f25e680777913 |
Headers | show |
Series | Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work | expand |
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Thu, 9 Mar 2023 16:07:39 +0800 you wrote: > 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> > > [...] Here is the summary with links: - Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work https://git.kernel.org/bluetooth/bluetooth-next/c/f132c2d13088 You are awesome, thank you!
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index 795be33f2892..02893600db39 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c @@ -354,6 +354,7 @@ static void btsdio_remove(struct sdio_func *func) BT_DBG("func %p", func); + cancel_work_sync(&data->work); if (!data) return;
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> --- drivers/bluetooth/btsdio.c | 1 + 1 file changed, 1 insertion(+)