Re: [PATCH] scsi: mpt3sas: Fix unlock imbalance

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

 



On 2020/07/01 19:10, Johannes Thumshirn wrote:
> Looks good,
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
> 
> While we're at it the next block does a direct return manually unlocking 
> 'ioc->pci_access_mutex' and rc is never set for any of the error paths 
> in 'BRM_status_show'...
> 
> Maybe we should add this one on top of your patch:
> 
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
> index 62e552838565..70d2d0987249 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
> @@ -3149,20 +3149,20 @@ BRM_status_show(struct device *cdev, struct device_attribute *attr,
>         }
>         /* pci_access_mutex lock acquired by sysfs show path */
>         mutex_lock(&ioc->pci_access_mutex);
> -       if (ioc->pci_error_recovery || ioc->remove_host) {
> -               mutex_unlock(&ioc->pci_access_mutex);
> -               return 0;
> -       }
> +       if (ioc->pci_error_recovery || ioc->remove_host)
> +               goto out;
>  
>         /* allocate upto GPIOVal 36 entries */
>         sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36);
>         io_unit_pg3 = kzalloc(sz, GFP_KERNEL);
>         if (!io_unit_pg3) {
> +               rc = -ENOMEM;
>                 ioc_err(ioc, "%s: failed allocating memory for iounit_pg3: (%d) bytes\n",
>                         __func__, sz);
>                 goto out;
>         }
>  
> +       rc = -EINVAL;
>         if (mpt3sas_config_get_iounit_pg3(ioc, &mpi_reply, io_unit_pg3, sz) !=
>             0) {
>                 ioc_err(ioc, "%s: failed reading iounit_pg3\n",
> 

Indeed... I did not look at the other early return path :)
Can you send something ?

-- 
Damien Le Moal
Western Digital Research




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux