Re: [PATCH] scsi midlayer: fix sdev reuse after free

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

 



On Mon, 2006-06-26 at 14:53 -0400, James Smart wrote:
>  void __scsi_remove_device(struct scsi_device *sdev)
>  {
>  	struct device *dev = &sdev->sdev_gendev;
> +	unsigned long flags;
>  
>  	if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
>  		return;
>  
> +	spin_lock_irqsave(sdev->host->host_lock, flags);
> +	list_del(&sdev->siblings);
> +	list_del(&sdev->same_target_siblings);
> +	spin_unlock_irqrestore(sdev->host->host_lock, flags);
>  	class_device_unregister(&sdev->sdev_classdev);
>  	transport_remove_device(dev);
>  	device_del(dev);

Not quite ... we cannot physically remove the device from the list until
after device_del has been called otherwise we could get namespace reuse
before it is really free (that's quite a small race window in this case,
but it does exist).

James


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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