Merge branch 'core-hweight-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / security / keys / user_defined.c
index 5bbfdebb7acfb79436d615851ec91d57c2d74c49..e9aa079296561507835e0e349a55f07b11bec5bb 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/seq_file.h>
 #include <linux/err.h>
@@ -200,7 +199,8 @@ long user_read(const struct key *key, char __user *buffer, size_t buflen)
        struct user_key_payload *upayload;
        long ret;
 
-       upayload = rcu_dereference(key->payload.data);
+       upayload = rcu_dereference_protected(
+               key->payload.data, rwsem_is_locked(&((struct key *)key)->sem));
        ret = upayload->datalen;
 
        /* we can return the data as is */