]> 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)
commit6bc9146bc1d04825f21832173bf6702c4350bcd8
treec503ab68da10306eae7170efb19dd614ba9cc93e
parentf42810408548370c65f17a4c9ca1ce4991b5ac57
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