greybus: sdio: fix tear-down use-after-free
authorJohan Hovold <johan@hovoldconsulting.com>
Mon, 14 Sep 2015 18:19:03 +0000 (20:19 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 15 Sep 2015 04:57:25 +0000 (21:57 -0700)
The mmc-driver private data must not be accessed after mmc_free_host()
has released it.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/sdio.c

index 24b2e3152fa1778d16be794214572080030b0984..14617e31782e66d7aa2edcacac0d873c466f4487 100644 (file)
@@ -750,8 +750,8 @@ static void gb_sdio_connection_exit(struct gb_connection *connection)
        flush_workqueue(gb_sdio_mrq_workqueue);
        destroy_workqueue(gb_sdio_mrq_workqueue);
        mmc_remove_host(mmc);
-       mmc_free_host(mmc);
        kfree(host->xfer_buffer);
+       mmc_free_host(mmc);
 }
 
 static struct gb_protocol sdio_protocol = {