Skip to content

Commit 73f7b17

Browse files
bluesheep1337Vudentz
authored andcommitted
Bluetooth: btsdio: fix use after free bug in btsdio_remove due to race condition
In btsdio_probe, the data->work is bound with btsdio_work. It will be started in btsdio_send_frame. If the btsdio_remove runs with a unfinished work, there may be a race condition that hdev is freed but used in btsdio_work. Fix it by canceling the work before do cleanup in btsdio_remove. Signed-off-by: Zheng Wang <zyytlz.wz@163.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent c95930a commit 73f7b17

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/bluetooth/btsdio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ static void btsdio_remove(struct sdio_func *func)
358358
if (!data)
359359
return;
360360

361+
cancel_work_sync(&data->work);
361362
hdev = data->hdev;
362363

363364
sdio_set_drvdata(func, NULL);

0 commit comments

Comments
 (0)