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:	Fri, 02 Oct 2015 15:09:33 +0200
From:	Johannes Thumshirn <jthumshirn@...e.de>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	James Bottomley <James.Bottomley@...senPartnership.com>,
	Hannes Reinecke <hare@...e.de>, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] SCSI: Fix hard lockup in scsi_remove_target()

Christoph Hellwig <hch@...radead.org> writes:

>> -	list_for_each_entry(starget, &shost->__targets, siblings) {
>> +	list_for_each_entry_safe(starget, tmp, &shost->__targets, siblings) {
>>  		if (starget->state == STARGET_DEL)
>>  			continue;
>>  		if (starget->dev.parent == dev || &starget->dev == dev) {
>>  			/* assuming new targets arrive at the end */
>
> Now that the last variable is gone this comments isn't needed.

Yep, you're right. I'll remove it.

>
>>  			kref_get(&starget->reap_ref);
>>  			spin_unlock_irqrestore(shost->host_lock, flags);
>> -			if (last)
>> -				scsi_target_reap(last);
>> -			last = starget;
>> +
>>  			__scsi_remove_target(starget);
>> +			list_move_tail(&starget->siblings, &reap_list);
>>  			spin_lock_irqsave(shost->host_lock, flags);
>>  		}
>
> What makes the list_move save after dropping host_lock?  I think this
> needs to be changed to not drop the host_lock and change
> __scsi_remove_target to expect host_lock held to be safe. 

Having the list_move() outside of the host_lock was purely by
accident. Interestingly the stressing didn't mind it. But yes you're
right, __scsi_remove_target() should be made host_lock() save for being
called under the host_lock.

Regarding the list move, does it look OK for you (i.e. do we still need
it after reworking __scsi_remove_target())? IMHO yes, but I only have
half a year of experience in this area).

> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Johannes Thumshirn                                          Storage
jthumshirn@...e.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ