Re: [PATCH] sbitmap: order RW on old associated instance and setting clear bit

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

 



Hi Ming

On 3/19/19 3:58 PM, Ming Lei wrote:
> On Tue, Mar 19, 2019 at 01:17:31PM +0800, jianchao.wang wrote:
>> Hi Ming
>>
>> On 3/19/19 12:24 PM, Ming Lei wrote:
>>> @@ -591,6 +591,15 @@ EXPORT_SYMBOL_GPL(sbitmap_queue_wake_up);
>>>  void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
>>>  			 unsigned int cpu)
>>>  {
>>> +	/*
>>> +	 * Once the clear bit is set, it will be visible to allocation
>>> +	 * side.
>>> +	 *
>>> +	 * This memory barrier orders any READ/WRITE on the to-be-freed
>>> +	 * asssociated instance for avoiding potential use-after-free, and
>>> +	 * its pair is the memory barrier implied in sbitmap_get().
>> which one ?
> 
> test_and_set_bit_lock() in __sbitmap_get_word().

Yes, thanks for your pointing out.
Would you perhaps detail this in the comment ?

Thanks
Jianchao
> 
>>
>>> +	 */
>>> +	smp_mb();
>>
>> smp_mb_before_atomic should be enough.
> 
> Right, will change to it in V2.
> 
> Thanks,
> Ming
> 



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux