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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b71b38ff-f0d0-83c6-6066-195180b08ea0@huawei.com>
Date:   Thu, 15 Sep 2016 15:08:00 +0100
From:   John Garry <john.garry@...wei.com>
To:     Vaishali Thakkar <vaishali.thakkar@...cle.com>,
        <jejb@...ux.vnet.ibm.com>
CC:     <linux-kernel@...r.kernel.org>, <martin.petersen@...cle.com>,
        <linux-scsi@...r.kernel.org>
Subject: Re: [PATCH] [SCSI] wd719x: Avoid calling request_firmware under
 spinlock

On 15/09/2016 14:48, Vaishali Thakkar wrote:
> It is preferrable to use request_firmware where sleeping is
> allowed. Using it under spinlock can cause blocking. Here,
> the function wd719x_chip_init calls request_firmware while
> holding a spinlock. So, let's access it outside the spinlock.
>
> Coccinelle is used to detect the issue.
>
> Signed-off-by: Vaishali Thakkar <vaishali.thakkar@...cle.com>
> ---
> Please note that the patch is compile-tested only. And this change
> may require driver testing.
> ---
>  drivers/scsi/wd719x.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
> index e3da1a2..b8e57f3 100644
> --- a/drivers/scsi/wd719x.c
> +++ b/drivers/scsi/wd719x.c
> @@ -518,13 +518,14 @@ static int wd719x_host_reset(struct scsi_cmnd *cmd)
>  	int result;
>
>  	dev_info(&wd->pdev->dev, "host reset requested\n");
> -	spin_lock_irqsave(wd->sh->host_lock, flags);
> +

In the version of code I have flags is only used for this spinlock, so 
can flags be removed?

>  	/* Try to reinit the RISC */
>  	if (wd719x_chip_init(wd) == 0)
>  		result = SUCCESS;
>  	else
>  		result = FAILED;
>
> +	spin_lock_irqsave(wd->sh->host_lock, flags);
>  	/* flush all SCBs */
>  	list_for_each_entry_safe(scb, tmp, &wd->active_scbs, list) {
>  		struct scsi_cmnd *tmp_cmd = scb->cmd;
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ