[linux-cifs-client] Oops in call_sbin_request_key in 2.6.26-rc2

Steve French smfrench at gmail.com
Wed May 21 03:17:46 GMT 2008


With the patch - no more oops in the key API

On Tue, May 20, 2008 at 10:50 AM, David Howells <dhowells at redhat.com> wrote:
> Steve French <smfrench at gmail.com> wrote:
>
>> Yes - that makes sense that it should check - search_process_keyrings
>> already checks for this (null user keyring):
>> ie
>>         /* or search the user-session keyring */
>>         else if (context->user->session_keyring) {
>>
>> but the callout via request_key does not
>
> Can you try the attached patch please?  I don't have access to my test machine
> at the moment, so I haven't tested it.
>
> David
> ---
> KEYS: Make request key instantiate the per-user keyrings
>
> Make request_key() instantiate the per-user keyrings so that it doesn't oops
> if it needs to get hold of the user session keyring because there isn't a
> session keyring in place.
>
> Signed-off-by: David Howells <dhowells at redhat.com>
> ---
>
>  security/keys/internal.h     |    1 +
>  security/keys/process_keys.c |    2 +-
>  security/keys/request_key.c  |    4 ++++
>  3 files changed, 6 insertions(+), 1 deletions(-)
>
>
> diff --git a/security/keys/internal.h b/security/keys/internal.h
> index 8c05587..2bdfacc 100644
> --- a/security/keys/internal.h
> +++ b/security/keys/internal.h
> @@ -108,6 +108,7 @@ extern key_ref_t search_process_keyrings(struct key_type *type,
>
>  extern struct key *find_keyring_by_name(const char *name, bool skip_perm_check);
>
> +extern int install_user_keyrings(struct task_struct *tsk);
>  extern int install_thread_keyring(struct task_struct *tsk);
>  extern int install_process_keyring(struct task_struct *tsk);
>
> diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> index 5be6d01..45b240a 100644
> --- a/security/keys/process_keys.c
> +++ b/security/keys/process_keys.c
> @@ -40,7 +40,7 @@ struct key_user root_key_user = {
>  /*
>  * install user and user session keyrings for a particular UID
>  */
> -static int install_user_keyrings(struct task_struct *tsk)
> +int install_user_keyrings(struct task_struct *tsk)
>  {
>        struct user_struct *user = tsk->user;
>        struct key *uid_keyring, *session_keyring;
> diff --git a/security/keys/request_key.c b/security/keys/request_key.c
> index ba32ca6..abea08f 100644
> --- a/security/keys/request_key.c
> +++ b/security/keys/request_key.c
> @@ -74,6 +74,10 @@ static int call_sbin_request_key(struct key_construction *cons,
>
>        kenter("{%d},{%d},%s", key->serial, authkey->serial, op);
>
> +       ret = install_user_keyrings(tsk);
> +       if (ret < 0)
> +               goto error_alloc;
> +
>        /* allocate a new session keyring */
>        sprintf(desc, "_req.%u", key->serial);
>
>



-- 
Thanks,

Steve


More information about the linux-cifs-client mailing list