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]
Message-Id: <20241216142156.4133267-4-yangerkun@huaweicloud.com>
Date: Mon, 16 Dec 2024 22:21:54 +0800
From: Yang Erkun <yangerkun@...weicloud.com>
To: chuck.lever@...cle.com,
	jlayton@...nel.org,
	neilb@...e.de,
	okorniev@...hat.com,
	Dai.Ngo@...cle.com,
	tom@...pey.com,
	trondmy@...nel.org,
	anna@...nel.org,
	linux-nfs@...r.kernel.org,
	netdev@...r.kernel.org
Cc: yangerkun@...wei.com,
	yangerkun@...weicloud.com,
	yi.zhang@...wei.com
Subject: [RFC PATCH 3/5] nfsd: no need get cache ref when protected by rcu

From: Yang Erkun <yangerkun@...wei.com>

rcu_read_lock/rcu_read_unlock has already protect any ptr we will
reference when we call e_show. No need get cache ref. Besides, exp_put
may drop the last ref for cache_head, and the .put like
expkey_put/svc_export_put will call dput, which may sleep, and this will
break rcu protection.

Fixes: ae74136b4bb6 ("SUNRPC: Allow cache lookups to use RCU protection rather than the r/w spinlock")
Signed-off-by: Yang Erkun <yangerkun@...wei.com>
---
 fs/nfsd/export.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 56002d9ef66b..1c795dc5a74b 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1427,15 +1427,9 @@ static int e_show(struct seq_file *m, void *p)
 		return 0;
 	}
 
-	if (!cache_get_rcu(&exp->h))
+	if (cache_check(cd, &exp->h, NULL))
 		return 0;
 
-	if (cache_check(cd, &exp->h, NULL)) {
-		cache_put(&exp->h, cd);
-		return 0;
-	}
-
-	exp_put(exp);
 	return svc_export_show(m, cd, cp);
 }
 
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ