]> git.baikalelectronics.ru Git - kernel.git/commit
net: rtnetlink: use rcu to free rtnl message handlers
authorFlorian Westphal <fw@strlen.de>
Sat, 2 Dec 2017 20:44:05 +0000 (21:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Dec 2017 16:32:22 +0000 (11:32 -0500)
commitc9b94f943aa12dbf7868d8f3a00c8f5c9d3866be
treec503ab68da10306eae7170efb19dd614ba9cc93e
parent3c1f2b9346c08efedf205de9ec19615b9243acdc
net: rtnetlink: use rcu to free rtnl message handlers

rtnetlink is littered with READ_ONCE() because we can have read accesses
while another cpu can write to the structure we're reading by
(un)registering doit or dumpit handlers.

This patch changes this so that (un)registering cpu allocates a new
structure and then publishes it via rcu_assign_pointer, i.e. once
another cpu can see such pointer no modifications will occur anymore.

based on initial patch from Peter Zijlstra.

Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c