OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Ensure that pneigh_lookup is protected with RTNL
[PATCH] Ensure that pneigh_lookup is protected with RTNL [message #21733] Mon, 15 October 2007 13:38 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
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>

---
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index c52df85..cd3af59 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;
Re: [PATCH] Ensure that pneigh_lookup is protected with RTNL [message #21745 is a reply to message #21733] Mon, 15 October 2007 19:54 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Mon, 15 Oct 2007 17:38:57 +0400

> 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>

Thanks for this patch, applied.
Previous Topic: [patch 0/2][NETNS49][IPV4][IGMP] activate multicast per namespace
Next Topic: [PATCH][NETNS] Don't panic on creating the namespace's loopback
Goto Forum:
  


Current Time: Sun May 28 03:07:54 GMT 2023

Total time taken to generate the page: 0.01295 seconds