Re: [PATCH v2 1/7] drivers/base: Fix a race condition in the device probing code

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

 



On Wed, Oct 17, 2018 at 04:40:00PM -0700, Bart Van Assche wrote:
> This patch avoids that complaints similar to the following appear in the
> system log:
> 
> sysfs: cannot create duplicate filename '/devices/pseudo_0/adapter0/host3/target3:0:0/3:0:0:133/driver'
> 
> Cc: Lee Duncan <lduncan@xxxxxxxx>
> Cc: Hannes Reinecke <hare@xxxxxxxx>
> Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
> Cc: Johannes Thumshirn <jthumshirn@xxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
>  drivers/base/dd.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index edfc9f0b1180..b4212154a94b 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -645,6 +645,14 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
>  {
>  	int ret = 0;
>  
> +	/*
> +	 * Several callers check the driver pointer without holding the
> +	 * device mutex. Hence check the driver pointer again while holding
> +	 * the device mutex.
> +	 */
> +	if (dev->driver)
> +		return dev->driver == drv;

I do not understand, who is calling probe twice?  What is the sequence
of events that is causing that error message being printed out?  Wh is
not grabbing the mutex properly?

thanks,

greg k-h



[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