From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224PJgA/Fmd8qZC0g54CiyWnsF1IkTdKbDcdwP0ykjkR5ocM/NzfndPrm8ENr2a4z/oPr6Y6 ARC-Seal: i=1; a=rsa-sha256; t=1517256288; cv=none; d=google.com; s=arc-20160816; b=ZCyZu4tyPo+mq5x6o2SXfc0Eca0cywbze1UmVrXfSXWEOPYofpFnEkvvsp5xhzkWCO toXdHOcpyR2NuCz17xeE5NDbHO+ZzfcCBQEnanfIW+O+2RNTddWWVQvQZ/STuU6qahJ3 GbrSKjPUdaT8gGA2vY1Nshzqkxp5MnTgMMkVWnnnbvmCZktadLr3PYCPKoZLfmH1Y7ge VNHfuoyl2MwJqAlRepgQv/trL1j4qJnfFjNcq8S9TyDVmlb4E6MGPunD1i4Go7q2MljR IcDAM8l3OfYfxJzCHm/ky/9lGcgLfJjxja0kTjOM4vBTabFLrz5gE9TRN+Ivp5qH00dX fB5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=W8jeghDP2uPqSq+EEkIyQ1e6VBYtwJ+6tTJJ4aHYvyM=; b=MU/X+4IYL3hbd3R+IIp5CMgWruWVQjBrdJVTsvQbb3XLdFHixICfdtXYDewAae3RMb RGNCsQSEkhS2HLBaR2zySQqGewWMGsrV28KJNbDjlpgvM6AEcwr1bpbpxcLCjOvcUtZq gSRBVKERwDNkhCM2aLD3GAkv4kEFj0AG0U/FX+6VWy0HG4oEiG5jKJizrj6aKsa+kxkF iAygUICat7UP+JyODyP6Dw509QeqSLLQkZKXHQHb07c93N6oa12Y458j2wrjJZ2Ns86V 62vebA0wr0wR0C1+LoPoHogH48X15ndt+dQKhF5fNmf3T8iG+cqYaSkWU11PlfmYtqVT 1X1A== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Westfall , "David S. Miller" Subject: [PATCH 4.14 23/71] net: Allow neigh contructor functions ability to modify the primary_key Date: Mon, 29 Jan 2018 13:56:51 +0100 Message-Id: <20180129123828.835358109@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123827.271171825@linuxfoundation.org> References: <20180129123827.271171825@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958529601343755?= X-GMAIL-MSGID: =?utf-8?q?1590958529601343755?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jim Westfall [ 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/neighbour.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -532,7 +532,7 @@ struct neighbour *__neigh_create(struct if (atomic_read(&tbl->entries) > (1 << nht->hash_shift)) nht = neigh_hash_grow(tbl, nht->hash_shift + 1); - hash_val = tbl->hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift); + hash_val = tbl->hash(n->primary_key, dev, nht->hash_rnd) >> (32 - nht->hash_shift); if (n->parms->dead) { rc = ERR_PTR(-EINVAL); @@ -544,7 +544,7 @@ struct neighbour *__neigh_create(struct n1 != NULL; n1 = rcu_dereference_protected(n1->next, lockdep_is_held(&tbl->lock))) { - if (dev == n1->dev && !memcmp(n1->primary_key, pkey, key_len)) { + if (dev == n1->dev && !memcmp(n1->primary_key, n->primary_key, key_len)) { if (want_ref) neigh_hold(n1); rc = n1;