Skip to contentSkip to conversation

Ensure that pneigh_lookup is protected with RTNL

PATCH In review Pavel Emelyanov 2 participants 2 messages Oct 15, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 :) ).

---

net/core/neighbour.c +2 -0
index c52df85..cd3af59 100644
@@ -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;
maintainer
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Mon, 15 Oct 2007 17:38:57 +0400

Quoted 10 lines

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 :) ).

Thanks for this patch, applied.