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.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 661ad12e0cc9..ef750ff7497e 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -273,7 +273,7 @@ int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev)
273} 273}
274EXPORT_SYMBOL(neigh_ifdown); 274EXPORT_SYMBOL(neigh_ifdown);
275 275
276static struct neighbour *neigh_alloc(struct neigh_table *tbl) 276static struct neighbour *neigh_alloc(struct neigh_table *tbl, struct net_device *dev)
277{ 277{
278 struct neighbour *n = NULL; 278 struct neighbour *n = NULL;
279 unsigned long now = jiffies; 279 unsigned long now = jiffies;
@@ -288,7 +288,15 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl)
288 goto out_entries; 288 goto out_entries;
289 } 289 }
290 290
291 n = kzalloc(tbl->entry_size, GFP_ATOMIC); 291 if (tbl->entry_size)
292 n = kzalloc(tbl->entry_size, GFP_ATOMIC);
293 else {
294 int sz = sizeof(*n) + tbl->key_len;
295
296 sz = ALIGN(sz, NEIGH_PRIV_ALIGN);
297 sz += dev->neigh_priv_len;
298 n = kzalloc(sz, GFP_ATOMIC);
299 }
292 if (!n) 300 if (!n)
293 goto out_entries; 301 goto out_entries;
294 302
@@ -463,7 +471,7 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey,
463 u32 hash_val; 471 u32 hash_val;
464 int key_len = tbl->key_len; 472 int key_len = tbl->key_len;
465 int error; 473 int error;
466 struct neighbour *n1, *rc, *n = neigh_alloc(tbl); 474 struct neighbour *n1, *rc, *n = neigh_alloc(tbl, dev);
467 struct neigh_hash_table *nht; 475 struct neigh_hash_table *nht;
468 476
469 if (!n) { 477 if (!n) {