[NEIGH]: Ensure that pneigh_lookup is protected with RTNL
authorPavel Emelyanov <xemul@openvz.org>
Mon, 15 Oct 2007 19:54:15 +0000 (12:54 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Oct 2007 19:54:15 +0000 (12:54 -0700)
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>
net/core/neighbour.c

index c52df858d0be10a597109bed466c860d1177e097..cd3af59b38a10fbdb6163c2f705930f2002698df 100644 (file)
@@ -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;