From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225HLWfMMCYe5tZrJOwPuvGpjxDtv1hsak90OpA4m/q7L1htS96JB7fETFhl4Gu95V2Tr/LA ARC-Seal: i=1; a=rsa-sha256; t=1517256804; cv=none; d=google.com; s=arc-20160816; b=PzzG/5a/SXNTSaFIC7Mx4UuqBuZlc1XQc0UHvAnKRv54qY0jIb0wjaFxW+AxFbz9ss dNdLpuWNmus32CVLM7h8gfXcqGvJqEZo8Vnro0ZF4AXDAq/qkm2+hLXJXuUIS8E89gDv XEHppJ2F7GZN9uG8Wt3mHFku/+vcS/TiQV08makXjUk/IESaOc5ko1qu7Nt84eJV9pbt dOVisizxWhqWiiR34Pmu4E/QVXyw2McaKB9GghqW2gkW8837PvcmjsMqJ1moI4E468so WXlr70dF4LK5En4JLGSNISnssJp+cbCOM4umMwh+e5hevqilUKnSRN4nPQj+63Kph77w aB4g== 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=SYmM/EeZnOjERcJ4qE3IEfTwFpoAeZnp+38WtSwrgc8=; b=rzBrv1ps7AXhxZmRR2Dh6AQJCWHr2roSxfi7EtyuyWiUZfi4eaR9SaNyW8tpYH0nVe fSB4hA7u9gNRTnyn/9MXEdUQJuCart10W8ld7qZighiHzn8/7Vk3zXoBEL40+vO+fpmw v/QYtZ+airCiQqDUzfBPZLUYiKEn6ynUgcStsxa06uYpPk6NEo58rXSWhKFyTr2eGaJf Kt8iGMj6JePuN+vgi0HsssSbZsxWAvVkq24IXU5bXRzqpfSrtcyZuRUMa0o/kPFAu8ZZ ONQ5S9pzcsqyD2wSsvfQD/rwhdtQTeyYnLA8Y5PA7XQleSmjC3tZY1cDc8yo/h89GR/7 7cYA== 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.4 71/74] net: Allow neigh contructor functions ability to modify the primary_key Date: Mon, 29 Jan 2018 13:57:16 +0100 Message-Id: <20180129123850.740902292@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@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?1590959071242611284?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-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 @@ -496,7 +496,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); @@ -508,7 +508,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;