Skip to content

Commit dff34ef

Browse files
jhovoldstorulf
authored andcommitted
mmc: vub300: fix NULL-deref on disconnect
Make sure to deregister the controller before dropping the reference to the driver data on disconnect to avoid NULL-pointer dereferences or use-after-free. Fixes: 88095e7 ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver") Cc: stable@vger.kernel.org # 3.0+ Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 5e3486e commit dff34ef

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/mmc/host/vub300.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2365,8 +2365,8 @@ static void vub300_disconnect(struct usb_interface *interface)
23652365
usb_set_intfdata(interface, NULL);
23662366
/* prevent more I/O from starting */
23672367
vub300->interface = NULL;
2368-
kref_put(&vub300->kref, vub300_delete);
23692368
mmc_remove_host(mmc);
2369+
kref_put(&vub300->kref, vub300_delete);
23702370
pr_info("USB vub300 remote SDIO host controller[%d]"
23712371
" now disconnected", ifnum);
23722372
return;

0 commit comments

Comments
 (0)