Re: [PATCH 1/2] sg: fix races during device removal (v5)

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

 



Stefan Richter wrote:
> Tony Battersby wrote:
>   
>> I think BUG_ON is
>> the best way to go for this instead of printk/return because bugs
>> will be noticed and fixed instead of possibly going unnoticed.
>>     
> ...
>   
>>  static void sg_rq_end_io(struct request *rq, int uptodate)
>>  {
>>     
> ...
>   
>> +	int result, resid, done = 1;
>> +
>> +	BUG_ON(srp->done != 0);
>>     
>
> AFAIU this is typically called in atomic context.  If so, WARN_ON is
> preferred.
>
>   

Good point.  I think the following would be the best way then:

	if (WARN_ON(srp->done != 0))
		return;


> ...
>   
>> +	BUG_ON(sfp == NULL);
>> +
>> +	sdp = sfp->parentdp;
>>     
>
> This would bring up a NULL pointer dereference dump anyway.
>   

Yes, and that would have the same problem as BUG_ON by killing the
machine.  So I think WARN_ON()/return works best for this too.

Tony

--
To unsubscribe from this list: 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