linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix suspicious RCU usage in nfs_idmap_get_key.
@ 2016-10-04 13:37 Artem Savkov
  2016-10-04 15:45 ` David Howells
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Savkov @ 2016-10-04 13:37 UTC (permalink / raw)
  To: linux-nfs
  Cc: dhowells, trond.myklebust, anna.schumaker, linux-kernel,
	Artem Savkov

nfs_idmap_get_key doesn't hold rkey->sem when calling user_key_payload
resulting in a "suspicious RCU usage" lockdep splat. It does, however hold
rcu_read_lock, so it either needs to use unprotected rcu_dereference, or take
rkey->sem instead of rcu_read_lock.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
---
 fs/nfs/nfs4idmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c
index c444285..a67d1c0 100644
--- a/fs/nfs/nfs4idmap.c
+++ b/fs/nfs/nfs4idmap.c
@@ -309,7 +309,7 @@ static ssize_t nfs_idmap_get_key(const char *name, size_t namelen,
 		goto out;
 	}
 
-	rcu_read_lock();
+	down_read(&rkey->sem);
 	rkey->perm |= KEY_USR_VIEW;
 
 	ret = key_validate(rkey);
@@ -329,7 +329,7 @@ static ssize_t nfs_idmap_get_key(const char *name, size_t namelen,
 		ret = -EINVAL;
 
 out_up:
-	rcu_read_unlock();
+	up_read(&rkey->sem);
 	key_put(rkey);
 out:
 	return ret;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-04 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-04 13:37 [PATCH] Fix suspicious RCU usage in nfs_idmap_get_key Artem Savkov
2016-10-04 15:45 ` David Howells
2016-10-04 15:52   ` Artem Savkov

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).