[Devel,RHEL7,COMMIT] ms/neigh: no need to call lookup_neigh_parms in neigh_parms_alloc

Submitted by Konstantin Khorenko on March 29, 2017, 11:59 a.m.

Details

Message ID 201703291159.v2TBx7KS007894@finist_cl7.x64_64.work.ct
State New
Series "ms/neigh: disallow un-init_net to change thresh of neigh"
Headers show

Commit Message

Konstantin Khorenko March 29, 2017, 11:59 a.m.
The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.7
------>
commit 7071a9adce8ae3a97c5852db0ec9691bfbecca8c
Author: Gao feng <gaofeng@cn.fujitsu.com>
Date:   Thu Jun 20 10:01:32 2013 +0800

    ms/neigh: no need to call lookup_neigh_parms in neigh_parms_alloc
    
    neigh_table.parms always exist and is initialized,kmemdup
    can use it to create new neigh_parms, actually lookup_neigh_parms
    here will return neigh_table.parms too.
    
    Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    (cherry picked from commit cf89d6b2803ab99ac596f95d585c3057d2be645c)
    
    Otherwise after b0bb814 ("ms/neigh: only allow init_net to change the default
    neigh_parms") we get errors on neigh parms allocation.
    
    https://jira.sw.ru/browse/PSBM-63020
    
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 net/core/neighbour.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 6d0497c..d05622a 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1466,15 +1466,11 @@  static inline struct neigh_parms *lookup_neigh_parms(struct neigh_table *tbl,
 struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
 				      struct neigh_table *tbl)
 {
-	struct neigh_parms *p, *ref;
+	struct neigh_parms *p;
 	struct net *net = dev_net(dev);
 	const struct net_device_ops *ops = dev->netdev_ops;
 
-	ref = lookup_neigh_parms(tbl, net, 0);
-	if (!ref)
-		return NULL;
-
-	p = kmemdup(ref, sizeof(*p), GFP_KERNEL);
+	p = kmemdup(&tbl->parms, sizeof(*p), GFP_KERNEL);
 	if (p) {
 		p->tbl		  = tbl;
 		atomic_set(&p->refcnt, 1);