aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/neighbour.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r--net/core/neighbour.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 763a7b08df67..4230400b9a30 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -18,6 +18,7 @@
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19 19
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/kmemleak.h>
21#include <linux/types.h> 22#include <linux/types.h>
22#include <linux/kernel.h> 23#include <linux/kernel.h>
23#include <linux/module.h> 24#include <linux/module.h>
@@ -443,12 +444,14 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
443 ret = kmalloc(sizeof(*ret), GFP_ATOMIC); 444 ret = kmalloc(sizeof(*ret), GFP_ATOMIC);
444 if (!ret) 445 if (!ret)
445 return NULL; 446 return NULL;
446 if (size <= PAGE_SIZE) 447 if (size <= PAGE_SIZE) {
447 buckets = kzalloc(size, GFP_ATOMIC); 448 buckets = kzalloc(size, GFP_ATOMIC);
448 else 449 } else {
449 buckets = (struct neighbour __rcu **) 450 buckets = (struct neighbour __rcu **)
450 __get_free_pages(GFP_ATOMIC | __GFP_ZERO, 451 __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
451 get_order(size)); 452 get_order(size));
453 kmemleak_alloc(buckets, size, 1, GFP_ATOMIC);
454 }
452 if (!buckets) { 455 if (!buckets) {
453 kfree(ret); 456 kfree(ret);
454 return NULL; 457 return NULL;
@@ -468,10 +471,12 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
468 size_t size = (1 << nht->hash_shift) * sizeof(struct neighbour *); 471 size_t size = (1 << nht->hash_shift) * sizeof(struct neighbour *);
469 struct neighbour __rcu **buckets = nht->hash_buckets; 472 struct neighbour __rcu **buckets = nht->hash_buckets;
470 473
471 if (size <= PAGE_SIZE) 474 if (size <= PAGE_SIZE) {
472 kfree(buckets); 475 kfree(buckets);
473 else 476 } else {
477 kmemleak_free(buckets);
474 free_pages((unsigned long)buckets, get_order(size)); 478 free_pages((unsigned long)buckets, get_order(size));
479 }
475 kfree(nht); 480 kfree(nht);
476} 481}
477 482
@@ -1002,7 +1007,7 @@ static void neigh_probe(struct neighbour *neigh)
1002 if (neigh->ops->solicit) 1007 if (neigh->ops->solicit)
1003 neigh->ops->solicit(neigh, skb); 1008 neigh->ops->solicit(neigh, skb);
1004 atomic_inc(&neigh->probes); 1009 atomic_inc(&neigh->probes);
1005 kfree_skb(skb); 1010 consume_skb(skb);
1006} 1011}
1007 1012
1008/* Called when a timer expires for a neighbour entry. */ 1013/* Called when a timer expires for a neighbour entry. */