From: Pavel Emelyanov Date: Mon, 15 Oct 2007 19:54:15 +0000 (-0700) Subject: [NEIGH]: Ensure that pneigh_lookup is protected with RTNL X-Git-Tag: firefly_0821_release~25893^2~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4ae289444b968b4cefd776ada8da519ce10e56fa;p=firefly-linux-kernel-4.4.55.git [NEIGH]: Ensure that pneigh_lookup is protected with RTNL The pnigh_lookup is used to lookup proxy entries and to create them in case lookup failed. However, the "creation" code does not perform the re-lookup after GFP_KERNEL allocation. This is done because the code is expected to be protected with the RTNL lock, so add the assertion (mainly to address future questions from new network developers like me :) ). Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- diff --git a/net/core/neighbour.c b/net/core/neighbour.c index c52df858d0be..cd3af59b38a1 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -481,6 +481,8 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, const void *pkey, if (!creat) goto out; + ASSERT_RTNL(); + n = kmalloc(sizeof(*n) + key_len, GFP_KERNEL); if (!n) goto out;