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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200828074035.GB942935@kroah.com>
Date:   Fri, 28 Aug 2020 09:40:35 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     madhuparnabhowmik10@...il.com
Cc:     jacmet@...site.dk, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org,
        andrianov@...ras.ru
Subject: Re: [PATCH] usb/c67x00/c67x00-drv: Fix Data Race bug

On Wed, Aug 26, 2020 at 08:14:59PM +0530, madhuparnabhowmik10@...il.com wrote:
> From: Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>
> 
> Currently in c67x00_drv_probe() IRQ is requested before calling
> c67x00_probe_sie() and hence if interrupt happens the reading of certain
> variables in the handler can race with initialization of the variables,
> for e.g. sie->sie_num is written in c67x00_probe_sie() and read in
>  c67x00_hcd_irq().
> Hence, this patch calls c67x00_probe_sie() before requesting IRQ in
> probe.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>
> ---
>  drivers/usb/c67x00/c67x00-drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/c67x00/c67x00-drv.c b/drivers/usb/c67x00/c67x00-drv.c
> index 53838e7d4eef..2e816d5ca0eb 100644
> --- a/drivers/usb/c67x00/c67x00-drv.c
> +++ b/drivers/usb/c67x00/c67x00-drv.c
> @@ -146,6 +146,9 @@ static int c67x00_drv_probe(struct platform_device *pdev)
>  	c67x00_ll_init(c67x00);
>  	c67x00_ll_hpi_reg_init(c67x00);
>  
> +	for (i = 0; i < C67X00_SIES; i++)
> +		c67x00_probe_sie(&c67x00->sie[i], c67x00, i);
> +
>  	ret = request_irq(res2->start, c67x00_irq, 0, pdev->name, c67x00);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Cannot claim IRQ\n");
> @@ -158,9 +161,6 @@ static int c67x00_drv_probe(struct platform_device *pdev)
>  		goto reset_failed;
>  	}
>  
> -	for (i = 0; i < C67X00_SIES; i++)
> -		c67x00_probe_sie(&c67x00->sie[i], c67x00, i);
> -
>  	platform_set_drvdata(pdev, c67x00);
>  
>  	return 0;

Have you tested this on hardware to verify it works properly?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ