Re: [PATCH] net: add a synchronize_net() innetdev_rx_handler_unregister()

From: David Miller
Date: Fri Mar 29 2013 - 15:39:46 EST


From: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Mar 2013 12:20:11 -0700

> On Fri, Mar 29, 2013 at 06:01:22AM -0700, Eric Dumazet wrote:
>> [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()
>>
>> commit 35d48903e97819 (bonding: fix rx_handler locking) added a race
>> in bonding driver, reported by Steven Rostedt who did a very good
>> diagnosis :
...
>> We can fix bug this in two ways. First is adding a test in
>> bond_handle_frame() and others to check if rx_handler_data is NULL.
>>
>> A second way is adding a synchronize_net() in
>> netdev_rx_handler_unregister() to make sure that a rcu protected reader
>> has the guarantee to see a non NULL rx_handler_data.
>>
>> The second way is better as it avoids an extra test in fast path.
>>
>> Reported-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
>> Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
>> Cc: Jiri Pirko <jpirko@xxxxxxxxxx>
>> Cc: Paul E. McKenney <paulmck@xxxxxxxxxx>
>
> Reviewed-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
>
> With kudos to Steven Rostedt for his analogy between RCU and
> Schrödinger's cat. ;-)

Applied and queued up for -stable, thanks Everyone.
--
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/