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]
Date:   Wed, 18 Jan 2023 17:07:25 -0600
From:   Mike Christie <michael.christie@...cle.com>
To:     Zhong Jinghua <zhongjinghua@...wei.com>, jejb@...ux.ibm.com,
        martin.petersen@...cle.com, bvanassche@....org, emilne@...hat.com,
        hare@...e.de
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        yi.zhang@...wei.com, yukuai3@...wei.com, houtao1@...wei.com
Subject: Re: [PATCH] scsi: fix iscsi rescan fails to create block

On 1/16/23 21:01, Zhong Jinghua wrote:
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 42db9c52208e..e7893835b99a 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -1503,6 +1503,13 @@ void scsi_remove_device(struct scsi_device *sdev)
>  }
>  EXPORT_SYMBOL(scsi_remove_device);
>  
> +static int scsi_device_try_get(struct scsi_device *sdev)
> +{
> +	if (!kobject_get_unless_zero(&sdev->sdev_gendev.kobj))
> +		return -ENXIO;
> +	return 0;
> +}
> +
>  static void __scsi_remove_target(struct scsi_target *starget)
>  {
>  	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
> @@ -1521,9 +1528,7 @@ static void __scsi_remove_target(struct scsi_target *starget)
>  		if (sdev->channel != starget->channel ||
>  		    sdev->id != starget->id)
>  			continue;
> -		if (sdev->sdev_state == SDEV_DEL ||
> -		    sdev->sdev_state == SDEV_CANCEL ||
> -		    !get_device(&sdev->sdev_gendev))
> +		if (scsi_device_try_get(sdev))
>  			continue;
>  		spin_unlock_irqrestore(shost->host_lock, flags);
>  		scsi_remove_device(sdev);

I think the patch will work ok. I don't think we want to mix
in our own reference getting function that works on kobjects
directly with the put_device use a little below that line above.

Since this is the second time (looks like Hannes was wanting one
when he originally fixed this) we've wanted a get_unless_zero type
function did you send Greg a get_device_unless_zero type of patch
already and was that rejected?

Why doesn't scsi_forget_host have the same issue with other drivers and
similar scan/delete/host-removal type of tests? Is there something that
flushes those async scans? I'm just wondering if we can do something
similar for the target removal or if the host removal needs a similar
fix.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ