From: Artem Savkov <asavkov@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: dhowells@redhat.com, trond.myklebust@primarydata.com,
anna.schumaker@netapp.com, linux-kernel@vger.kernel.org,
Artem Savkov <asavkov@redhat.com>
Subject: [PATCH] Fix suspicious RCU usage in nfs_idmap_get_key.
Date: Tue, 4 Oct 2016 15:37:40 +0200 [thread overview]
Message-ID: <1475588260-10838-1-git-send-email-asavkov@redhat.com> (raw)
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
next reply other threads:[~2016-10-04 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 13:37 Artem Savkov [this message]
2016-10-04 15:45 ` [PATCH] Fix suspicious RCU usage in nfs_idmap_get_key David Howells
2016-10-04 15:52 ` Artem Savkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1475588260-10838-1-git-send-email-asavkov@redhat.com \
--to=asavkov@redhat.com \
--cc=anna.schumaker@netapp.com \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).