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, 2 Jun 2023 08:30:19 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Kai-Heng Feng <kai.heng.feng@...onical.com>, jejb@...ux.ibm.com,
        martin.petersen@...cle.com
Cc:     dlemoal@...nel.org, bblock@...ux.ibm.com, acelan.kao@...onical.com,
        linux-pm@...r.kernel.org, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6] scsi: core: Wait until device is fully resumed before
 doing rescan

On 6/2/23 01:49, Kai-Heng Feng wrote:
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index d217be323cc6..092f37464101 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -1621,6 +1621,11 @@ void scsi_rescan_device(struct device *dev)
>   {
>   	struct scsi_device *sdev = to_scsi_device(dev);
>   
> +#ifdef CONFIG_PM_SLEEP
> +	if (dev->power.is_suspended)
> +		wait_for_completion(&dev->power.completion);
> +#endif
> +
>   	device_lock(dev);
>   
>   	scsi_attach_vpd(sdev);

Directly accessing dev->power.completion from the SCSI core seems like a 
layering violation to me. Isn't this an object that should only be 
accessed directly by the device driver power management core? 
Additionally, what guarantees that the desired power state has been 
reached after wait_for_completion(&dev->power.completion) has finished?

I think we need another solution. The device_lock() and device_unlock() 
calls have been introduced by commit e27829dc92e5 ("scsi: serialize 
->rescan against ->remove"). I think there are other ways to serialize
scsi_rescan_device() against scsi_remove_device(), e.g. via 
host->scan_mutex. Is this something that has been considered?

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ