Skip to content

Commit

Permalink
[NEIGH]: Ensure that pneigh_lookup is protected with RTNL
Browse files Browse the repository at this point in the history
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 <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Oct 15, 2007
1 parent f1673ca commit 4ae2894
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4ae2894

Please sign in to comment.