소스 검색

[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 <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Pavel Emelyanov 17 년 전
부모
커밋
4ae289444b
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      net/core/neighbour.c

+ 2 - 0
net/core/neighbour.c

@@ -481,6 +481,8 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, const void *pkey,
 	if (!creat)
 	if (!creat)
 		goto out;
 		goto out;
 
 
+	ASSERT_RTNL();
+
 	n = kmalloc(sizeof(*n) + key_len, GFP_KERNEL);
 	n = kmalloc(sizeof(*n) + key_len, GFP_KERNEL);
 	if (!n)
 	if (!n)
 		goto out;
 		goto out;