]> Git Repo - linux.git/commitdiff
KEYS: split call to call_usermodehelper_fns()
authorLucas De Marchi <[email protected]>
Tue, 30 Apr 2013 22:28:05 +0000 (15:28 -0700)
committerLinus Torvalds <[email protected]>
Wed, 1 May 2013 00:04:06 +0000 (17:04 -0700)
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 <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Acked-by: David Howells <[email protected]>
Acked-by: James Morris <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
security/keys/request_key.c

index 4bd6bdb74193cba33b235b4b8b3934ddc576526c..c411f9bb156b205751ae06983e85f547119a245f 100644 (file)
@@ -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);
 }
 
 /*
This page took 0.053362 seconds and 4 git commands to generate.