]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xhci: tegra: Prevent error pointer dereference
authorThierry Reding <treding@nvidia.com>
Wed, 20 Feb 2019 13:48:41 +0000 (14:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Feb 2019 16:55:04 +0000 (17:55 +0100)
During initialization, the host and super-speed power domains will
contain an ERR_PTR() encoded error code rather than being NULL. To
avoid a crash, use a !IS_ERR_OR_NULL() condition during cleanup.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Fixes: 6494a9ad86de ("usb: xhci: tegra: Add genpd support")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-tegra.c

index 938ff06c034959f445dc8ad764d2e8a97887c15b..efb0cad8710e3dcbc484ec2e78742fa14e79dbb8 100644 (file)
@@ -941,9 +941,9 @@ static void tegra_xusb_powerdomain_remove(struct device *dev,
                device_link_del(tegra->genpd_dl_ss);
        if (tegra->genpd_dl_host)
                device_link_del(tegra->genpd_dl_host);
-       if (tegra->genpd_dev_ss)
+       if (!IS_ERR_OR_NULL(tegra->genpd_dev_ss))
                dev_pm_domain_detach(tegra->genpd_dev_ss, true);
-       if (tegra->genpd_dev_host)
+       if (!IS_ERR_OR_NULL(tegra->genpd_dev_host))
                dev_pm_domain_detach(tegra->genpd_dev_host, true);
 }