Merge tag 'keys-request-20190626' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-rpi.git] / kernel / cred.c
index 12a6562..f9a0ce6 100644 (file)
@@ -170,6 +170,11 @@ void exit_creds(struct task_struct *tsk)
        validate_creds(cred);
        alter_cred_subscribers(cred, -1);
        put_cred(cred);
+
+#ifdef CONFIG_KEYS_REQUEST_CACHE
+       key_put(current->cached_requested_key);
+       current->cached_requested_key = NULL;
+#endif
 }
 
 /**
@@ -323,6 +328,10 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
        struct cred *new;
        int ret;
 
+#ifdef CONFIG_KEYS_REQUEST_CACHE
+       p->cached_requested_key = NULL;
+#endif
+
        if (
 #ifdef CONFIG_KEYS
                !p->cred->thread_keyring &&