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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 30 Jan 2015 07:46:26 +0000
From:	Patrick McHardy <kaber@...sh.net>
To:	herbert@...dor.apana.org.au
Cc:	tgraf@...g.ch, davem@...emloft.net, David.Laight@...LAB.COM,
	ying.xue@...driver.com, paulmck@...ux.vnet.ibm.com,
	netdev@...r.kernel.org, netfilter-devel@...r.kernel.org
Subject: [PATCH 1/9] rhashtable: simplify rhashtable_remove()

Remove some duplicated code by moving the restart label up a few
lines. Also use rcu_access_pointer() for the pointer comparison
instead of rht_dereference_rcu().

Signed-off-by: Patrick McHardy <kaber@...sh.net>
---
 lib/rhashtable.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index aca6998..5f079f7 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -588,12 +588,12 @@ bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *obj)
 
 	rcu_read_lock();
 	tbl = rht_dereference_rcu(ht->tbl, ht);
+restart:
 	hash = head_hashfn(ht, tbl, obj);
 
 	lock = bucket_lock(tbl, hash);
 	spin_lock_bh(lock);
 
-restart:
 	pprev = &tbl->buckets[hash];
 	rht_for_each(he, tbl, hash) {
 		if (he != obj) {
@@ -613,14 +613,10 @@ restart:
 		return true;
 	}
 
-	if (tbl != rht_dereference_rcu(ht->future_tbl, ht)) {
+	if (tbl != rcu_access_pointer(ht->future_tbl)) {
 		spin_unlock_bh(lock);
 
 		tbl = rht_dereference_rcu(ht->future_tbl, ht);
-		hash = head_hashfn(ht, tbl, obj);
-
-		lock = bucket_lock(tbl, hash);
-		spin_lock_bh(lock);
 		goto restart;
 	}
 
-- 
2.1.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