* [PATCH for 3.18] ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()
@ 2018-02-02 15:06 Wang Han
2018-02-07 23:18 ` Patch "ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()" has been added to the 3.18-stable tree gregkh
0 siblings, 1 reply; 2+ messages in thread
From: Wang Han @ 2018-02-02 15:06 UTC (permalink / raw)
To: stable
As discussed earlier,
From: Wang Han <wanghan1995315@gmail.com>
Date: Sat, 3 Feb 2018 03:28:35 +1400
Subject: [PATCH] ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()
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 <wanghan1995315@gmail.com>
---
include/net/arp.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/net/arp.h b/include/net/arp.h
index 174014585ade..5d8c7990582f 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -22,6 +22,9 @@ static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev
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_neigh_lookup(struct net_device *dev, u32
{
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))
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Patch "ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()" has been added to the 3.18-stable tree
2018-02-02 15:06 [PATCH for 3.18] ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref() Wang Han
@ 2018-02-07 23:18 ` gregkh
0 siblings, 0 replies; 2+ messages in thread
From: gregkh @ 2018-02-07 23:18 UTC (permalink / raw)
To: wanghan1995315, gregkh; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()
to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ipv4-map-neigh-lookup-keys-in-__ipv4_neigh_lookup_noref.patch
and it can be found in the queue-3.18 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From wanghan1995315@gmail.com Wed Feb 7 17:17:43 2018
From: Wang Han <wanghan1995315@gmail.com>
Date: Fri, 2 Feb 2018 23:06:51 +0800
Subject: ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()
To: stable@vger.kernel.org
Message-ID: <20180202224114.00002fd9@gmail.com>
From: Wang Han <wanghan1995315@gmail.com>
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 <wanghan1995315@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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))
Patches currently in stable-queue which might be from wanghan1995315@gmail.com are
queue-3.18/ipv4-map-neigh-lookup-keys-in-__ipv4_neigh_lookup_noref.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-07 23:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-02 15:06 [PATCH for 3.18] ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref() Wang Han
2018-02-07 23:18 ` Patch "ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()" has been added to the 3.18-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).