diff -drupN a/security/keys/trusted.c b/security/keys/trusted.c --- a/security/keys/trusted.c 2018-08-06 17:23:04.000000000 +0300 +++ b/security/keys/trusted.c 2022-06-12 05:28:14.000000000 +0300 @@ -1139,15 +1139,14 @@ out: static long trusted_read(const struct key *key, char __user *buffer, size_t buflen) { - struct trusted_key_payload *p; + const struct trusted_key_payload *p; char *ascii_buf; char *bufp; int i; - p = rcu_dereference_key(key); + p = dereference_key_locked(key); if (!p) return -EINVAL; - if (buffer && buflen >= 2 * p->blob_len) { ascii_buf = kmalloc(2 * p->blob_len, GFP_KERNEL); if (!ascii_buf)