Re: [PATCH] xhci: tegra: Prevent error pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/02/2019 13:48, Thierry Reding wrote:
> From: Thierry Reding <treding@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  drivers/usb/host/xhci-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
> index 938ff06c0349..efb0cad8710e 100644
> --- a/drivers/usb/host/xhci-tegra.c
> +++ b/drivers/usb/host/xhci-tegra.c
> @@ -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);
>  }

Reviewed-by: Jon Hunter <jonathanh@xxxxxxxxxx>

Thanks for fixing!
Jon

-- 
nvpublic



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux