Skip to content

Commit 93997f6

Browse files
Lucas De Marchitorvalds
authored andcommitted
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 <[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]>
1 parent f634460 commit 93997f6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

security/keys/request_key.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,16 @@ static void umh_keys_cleanup(struct subprocess_info *info)
9393
static int call_usermodehelper_keys(char *path, char **argv, char **envp,
9494
struct key *session_keyring, int wait)
9595
{
96-
return call_usermodehelper_fns(path, argv, envp, wait,
97-
umh_keys_init, umh_keys_cleanup,
98-
key_get(session_keyring));
96+
struct subprocess_info *info;
97+
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);
99106
}
100107

101108
/*

0 commit comments

Comments
 (0)