lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 20 Feb 2015 17:45:30 -0800
From:	John Youn <John.Youn@...opsys.com>
To:	Romain Perier <romain.perier@...il.com>,
	"John.Youn@...opsys.com" <John.Youn@...opsys.com>
CC:	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-rockchip@...ts.infradead.org" 
	<linux-rockchip@...ts.infradead.org>
Subject: Re: [PATCH v2] usb: dwc2: Register interrupt handler only once gadget
 is correctly initialized

On 2/6/2015 8:50 AM, Romain Perier wrote:
> Don't register interrupt handler before usb gadget is correctly initialized.
> For some embedded platforms which don't have a usb-phy, it crashes the driver
> because an interrupt is emitted with non-initialized hardware.
> According to devm_request_irq documentation, an interrupt can be emitted
> at any time once the interrupt is registered, so we have to care about driver
> and hardware initialization.
> 
> Signed-off-by: Romain Perier <romain.perier@...il.com>
> ---
> 
> Changes for v2: fix typos in commit log
> 
>  drivers/usb/dwc2/platform.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index ae095f0..b26cf8c 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -196,14 +196,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  		return irq;
>  	}
>  
> -	dev_dbg(hsotg->dev, "registering common handler for irq%d\n",
> -		irq);
> -	retval = devm_request_irq(hsotg->dev, irq,
> -				  dwc2_handle_common_intr, IRQF_SHARED,
> -				  dev_name(hsotg->dev), hsotg);
> -	if (retval)
> -		return retval;
> -
>  	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
>  	hsotg->regs = devm_ioremap_resource(&dev->dev, res);
>  	if (IS_ERR(hsotg->regs))
> @@ -237,6 +229,15 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  	retval = dwc2_gadget_init(hsotg, irq);
>  	if (retval)
>  		return retval;
> +
> +        dev_dbg(hsotg->dev, "registering common handler for irq%d\n",
> +                irq);
> +        retval = devm_request_irq(hsotg->dev, irq,
> +                                dwc2_handle_common_intr, IRQF_SHARED,
> +                                dev_name(hsotg->dev), hsotg);
> +        if (retval)
> +                return retval;
> +
>  	retval = dwc2_hcd_init(hsotg, irq, params);
>  	if (retval)
>  		return retval;
> 

This patch fails checkpatch.pl.

Which interrupt is being emitted?

You are only initializing the gadget side before registering the handler. Could it affect the host side as well, say if you config for HOST only? In that case none of the dwc2_gadget_init() will be done (as it is a no-op).

Thanks,
John


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists