]> git.dujemihanovic.xyz Git - linux.git/commitdiff
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)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 23 Mar 2023 20:09:38 +0000 (13:09 -0700)
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>
drivers/bluetooth/btsdio.c

index 795be33f2892d5ea41afbcb461c4e0c8e939ef2a..02893600db390402858ebf65618832f79cadc375 100644 (file)
@@ -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;