Skip to content

Commit

Permalink
KEYS: split call to call_usermodehelper_fns()
Browse files Browse the repository at this point in the history
Use call_usermodehelper_setup() + call_usermodehelper_exec() instead of
calling call_usermodehelper_fns().  In case there's an OOM in this last
function the cleanup function may not be called - in this case we would
miss a call to key_put().

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Oleg Nesterov <oleg@redhat.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <james.l.morris@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Tejun Heo <tj@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Lucas De Marchi authored and Linus Torvalds committed May 1, 2013
1 parent f634460 commit 93997f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions security/keys/request_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,16 @@ static void umh_keys_cleanup(struct subprocess_info *info)
static int call_usermodehelper_keys(char *path, char **argv, char **envp,
struct key *session_keyring, int wait)
{
return call_usermodehelper_fns(path, argv, envp, wait,
umh_keys_init, umh_keys_cleanup,
key_get(session_keyring));
struct subprocess_info *info;

info = call_usermodehelper_setup(path, argv, envp, GFP_KERNEL,
umh_keys_init, umh_keys_cleanup,
session_keyring);
if (!info)
return -ENOMEM;

key_get(session_keyring);
return call_usermodehelper_exec(info, wait);
}

/*
Expand Down

0 comments on commit 93997f6

Please sign in to comment.