]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: chipidea: usbmisc: fix a potential race condition
authorMarc Kleine-Budde <mkl@pengutronix.de>
Sat, 30 Mar 2013 10:53:58 +0000 (12:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Mar 2013 15:13:57 +0000 (08:13 -0700)
This fixes a potential race condition where the ci13xxx_imx glue code
could be fast enough to call one of the usbmisc_ops before he got a
valid value on the static usbmisc pointer. To fix that we first set
usbmisc, then call usbmisc_set_ops().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/usbmisc_imx.c

index fd4d3392125f43e551881258f5cdb8391d249417..d77e712c6c2dc8662fc12ba144cab8146a05757e 100644 (file)
@@ -116,14 +116,14 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
                return ret;
        }
 
+       usbmisc = data;
        ret = usbmisc_set_ops(&imx6q_usbmisc_ops);
        if (ret) {
+               usbmisc = NULL;
                clk_disable_unprepare(data->clk);
                return ret;
        }
 
-       usbmisc = data;
-
        return 0;
 }