Re: [PATCH tip/core/rcu 05/13] net: add checking to rcu_dereference() primitives

From: Michał Mirosław
Date: Sun Feb 14 2010 - 03:34:50 EST


2010/2/12 Eric Dumazet <eric.dumazet@xxxxxxxxx>:
> Le jeudi 11 fÃvrier 2010 Ã 16:00 -0800, Paul E. McKenney a Ãcrit :
[...]
>> @@ -1654,12 +1654,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq)
>>
>> Â Â Â for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) {
>> Â Â Â Â Â Â Â rcu_read_lock_bh();
>> - Â Â Â Â Â Â rt = dn_rt_hash_table[s->bucket].chain;
>> + Â Â Â Â Â Â rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain);
>> Â Â Â Â Â Â Â if (rt)
>> Â Â Â Â Â Â Â Â Â Â Â break;
>> Â Â Â Â Â Â Â rcu_read_unlock_bh();
>> Â Â Â }
>> - Â Â return rcu_dereference(rt);
>> + Â Â return rt;
>> Â}

Isn't there a bug? Looks like data pointed to by rt should be
protected by RCU, but the rcu_read_lock is withdrawn before access.

Best Regards,
MichaÅ MirosÅaw
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/