From: Artem Savkov <asavkov@redhat.com>
To: dhowells@redhat.com
Cc: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org,
Artem Savkov <asavkov@redhat.com>
Subject: [PATCH] Use proper lock in fscache_objlist_config.
Date: Tue, 4 Oct 2016 15:38:30 +0200 [thread overview]
Message-ID: <1475588310-10910-1-git-send-email-asavkov@redhat.com> (raw)
fscache_objlist_config doesn't hold rkey->sem when calling user_key_payload,
that can result in a "suspicious RCU usage" warning. It does 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/fscache/object-list.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index 5d5ddaa..26c20e9 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -327,7 +327,7 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
goto no_config;
config = 0;
- rcu_read_lock();
+ down_read(&key->sem);
confkey = user_key_payload(key);
buf = confkey->data;
@@ -349,7 +349,7 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
}
}
- rcu_read_unlock();
+ up_read(&key->sem);
key_put(key);
if (!(config & (FSCACHE_OBJLIST_CONFIG_COOKIE | FSCACHE_OBJLIST_CONFIG_NOCOOKIE)))
--
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:38 Artem Savkov [this message]
2016-10-04 15:43 ` David Howells
2016-10-04 15:54 ` 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=1475588310-10910-1-git-send-email-asavkov@redhat.com \
--to=asavkov@redhat.com \
--cc=dhowells@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®