Skip to content

Commit 98fcfb3

Browse files
jwestfall69gregkh
authored andcommitted
net: Allow neigh contructor functions ability to modify the primary_key
[ Upstream commit 096b9854c04df86f03b38a97d40b6506e5730919 ] Use n->primary_key instead of pkey to account for the possibility that a neigh constructor function may have modified the primary_key value. Signed-off-by: Jim Westfall <jwestfall@surrealistic.net> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1414a1e commit 98fcfb3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/core/neighbour.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey,
508508
if (atomic_read(&tbl->entries) > (1 << nht->hash_shift))
509509
nht = neigh_hash_grow(tbl, nht->hash_shift + 1);
510510

511-
hash_val = tbl->hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
511+
hash_val = tbl->hash(n->primary_key, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
512512

513513
if (n->parms->dead) {
514514
rc = ERR_PTR(-EINVAL);
@@ -520,7 +520,7 @@ struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey,
520520
n1 != NULL;
521521
n1 = rcu_dereference_protected(n1->next,
522522
lockdep_is_held(&tbl->lock))) {
523-
if (dev == n1->dev && !memcmp(n1->primary_key, pkey, key_len)) {
523+
if (dev == n1->dev && !memcmp(n1->primary_key, n->primary_key, key_len)) {
524524
if (want_ref)
525525
neigh_hold(n1);
526526
rc = n1;

0 commit comments

Comments
 (0)