Received: by 10.223.185.116 with SMTP id b49csp2503430wrg; Thu, 15 Feb 2018 12:37:27 -0800 (PST) X-Google-Smtp-Source: AH8x2262hXxogSHeHX8KYpf4/sX7PnYalB8y8gSKVu67iGZdOYl23z9sWwnI3545nnvSxZP5OgFe X-Received: by 10.98.13.196 with SMTP id 65mr3759201pfn.139.1518727047835; Thu, 15 Feb 2018 12:37:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518727047; cv=none; d=google.com; s=arc-20160816; b=SIqZRGTmxl0afA4PbJm+qrpzBriK67vVxLi0KDWLccvw1bUlqptedPw8bL8R+fsMas mHOalquWHL85yW/aXcfPj5TjSTrcFUoUPHze5jHCw/iL2Q7zvw6upaOeiu3U8aacJa6y 3I3lqsRxtw3gJcH2Lb66Qt3MVvPP1WcQjNa/LiUr0Kiel8Coouabp8HuY25z57+iFtG9 zcyUUeKvL7oe56YJSY6KvzZ48VuGyK5sQb6P2CKWDFeJAl3xzKcHDGjHqmGvIgWTYwgt vayQRtR+U9KdOdzlN070evMCIXR3I7yffIZYK4Tpl7rTsmXVt1ssbLDjEhQzZ1nHcw06 r4Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=A5qRu5O4XdLKAtLThe4keXjZHlOX9tznKgLQ2HWSaso=; b=r1vvTpdVkvJh4u3654eubeczzuZTdilKr1PKJ4CzHLtWU50xIdN/bcDIbjIbTTbU24 ZBp2Owww9wEpiyvWnr5p0nNJCC76BuAcTWujsPZ/EpFaQXfBQdLgu6x3NgmnB6x3VVP8 n1U1frA3uLEHEeuKaGoLpiMOz62uRJtNuXJyvML7+nIL0KGCS0rriUX9/JEIvjV88gAK kPOR40f5IAyxZc17nQuAa+DlbnySyYtOvtlNMrP7gtSDsArocy51ErKYH8DZD24pOndV Tiovan5+ixKRb2eQpgU1IXOCUq5+y1ZSsixJ3rtgcEduAlHU0Jov55EMNVTy4FXZc4Ex a7lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23-v6si4815332plk.567.2018.02.15.12.37.00; Thu, 15 Feb 2018 12:37:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161066AbeBOPSk (ORCPT + 99 others); Thu, 15 Feb 2018 10:18:40 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47542 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161045AbeBOPSh (ORCPT ); Thu, 15 Feb 2018 10:18:37 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C2682FEB; Thu, 15 Feb 2018 15:18:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Wang Han Subject: [PATCH 3.18 10/45] ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref() Date: Thu, 15 Feb 2018 16:17:01 +0100 Message-Id: <20180215144118.045871977@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215144115.863307741@linuxfoundation.org> References: <20180215144115.863307741@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wang Han Commit 6c16fa957e84 is an incorrect backport as we map the keys in struct __ipv4_neigh_lookup(), but the correct place to add the code is struct __ipv4_neigh_lookup_noref(), compared to upstream. Fix it by moving the code, or fewer cases will be covered as __ipv4_neigh_lookup_noref() will be called unconditionally from __ipv4_neigh_lookup(), and it can be called from other places such as ip_output.c. Fixes: 6c16fa957e84 (ipv4: Make neigh lookup keys for loopback/point-to-point devices be INADDR_ANY) Signed-off-by: Wang Han Signed-off-by: Greg Kroah-Hartman --- include/net/arp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/include/net/arp.h +++ b/include/net/arp.h @@ -22,6 +22,9 @@ static inline struct neighbour *__ipv4_n struct neighbour *n; u32 hash_val; + if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) + key = INADDR_ANY; + hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); n != NULL; @@ -37,9 +40,6 @@ static inline struct neighbour *__ipv4_n { struct neighbour *n; - if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) - key = INADDR_ANY; - rcu_read_lock_bh(); n = __ipv4_neigh_lookup_noref(dev, key); if (n && !atomic_inc_not_zero(&n->refcnt))