lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1317285859.2855.6.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
Date:	Thu, 29 Sep 2011 10:44:19 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	rongqing.li@...driver.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] Ipv6: Delete rcu_read_lock

Le jeudi 29 septembre 2011 à 15:46 +0800, rongqing.li@...driver.com a
écrit :
> From: Roy.Li <rongqing.li@...driver.com>
> 
> Delete rcu_read_lock, it is redundant.
> 

A good changelog and patch title are required.

Something like :

[PATCH net-next] ipv6: remove a rcu_read_lock in ndisc_constructor

in6_dev_get(dev) takes a reference on struct inet6_dev, we dont need rcu
locking in ndisc_constructor()



-----

Or, you could try to really use RCU and not take a reference (ie, use 
__in6_dev_get() instead of in6_dev_get(dev).


Untested patch :

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 9da6e02..a4f4472 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -371,7 +371,7 @@ static int ndisc_constructor(struct neighbour *neigh)
 	int is_multicast = ipv6_addr_is_multicast(addr);
 
 	rcu_read_lock();
-	in6_dev = in6_dev_get(dev);
+	in6_dev = __in6_dev_get(dev);
 	if (in6_dev == NULL) {
 		rcu_read_unlock();
 		return -EINVAL;
@@ -380,7 +380,6 @@ static int ndisc_constructor(struct neighbour *neigh)
 	parms = in6_dev->nd_parms;
 	__neigh_parms_put(neigh->parms);
 	neigh->parms = neigh_parms_clone(parms);
-	rcu_read_unlock();
 
 	neigh->type = is_multicast ? RTN_MULTICAST : RTN_UNICAST;
 	if (!dev->header_ops) {
@@ -409,7 +408,7 @@ static int ndisc_constructor(struct neighbour *neigh)
 		else
 			neigh->output = neigh->ops->output;
 	}
-	in6_dev_put(in6_dev);
+	rcu_read_unlock();
 	return 0;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ