]> asedeno.scripts.mit.edu Git - linux.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)
commitaddf9b90de22f7aaad0db39bccb5d51ac47dd4e1
treec503ab68da10306eae7170efb19dd614ba9cc93e
parent9753c21f55d4ca2b02bbe81448f2a552ce79d068
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