All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Use proper lock in fscache_objlist_config.
@ 2016-10-04 13:38 Artem Savkov
  2016-10-04 15:43 ` David Howells
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Savkov @ 2016-10-04 13:38 UTC (permalink / raw)
  To: dhowells; +Cc: linux-cachefs, linux-kernel, Artem Savkov

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

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

end of thread, other threads:[~2016-10-04 15:54 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:38 [PATCH] Use proper lock in fscache_objlist_config Artem Savkov
2016-10-04 15:43 ` David Howells
2016-10-04 15:54   ` Artem Savkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.