aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2013-04-30 18:28:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 20:04:06 -0400
commit93997f6ddb9d574cd58694f13c5b15212927bfa1 (patch)
tree730d902f168df136dad8b7a2b0b438a2929311f3
parentf634460c90751da21745eec7a220edf76c7d0c76 (diff)
KEYS: split call to call_usermodehelper_fns()
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>
-rw-r--r--security/keys/request_key.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 4bd6bdb74193..c411f9bb156b 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -93,9 +93,16 @@ static void umh_keys_cleanup(struct subprocess_info *info)
93static int call_usermodehelper_keys(char *path, char **argv, char **envp, 93static int call_usermodehelper_keys(char *path, char **argv, char **envp,
94 struct key *session_keyring, int wait) 94 struct key *session_keyring, int wait)
95{ 95{
96 return call_usermodehelper_fns(path, argv, envp, wait, 96 struct subprocess_info *info;
97 umh_keys_init, umh_keys_cleanup, 97
98 key_get(session_keyring)); 98 info = call_usermodehelper_setup(path, argv, envp, GFP_KERNEL,
99 umh_keys_init, umh_keys_cleanup,
100 session_keyring);
101 if (!info)
102 return -ENOMEM;
103
104 key_get(session_keyring);
105 return call_usermodehelper_exec(info, wait);
99} 106}
100 107
101/* 108/*