Commit 81ab6e7b26b453a795d46f2616ed0e31d97f05b9
Committed by
Linus Torvalds
1 parent
ae3cef7300
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
kmod: convert two call sites to call_usermodehelper_fns()
Both kernel/sys.c && security/keys/request_key.c where inlining the exact same code as call_usermodehelper_fns(); So simply convert these sites to directly use call_usermodehelper_fns(). Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 11 additions and 21 deletions Side-by-side Diff
kernel/sys.c
... | ... | @@ -2114,7 +2114,6 @@ |
2114 | 2114 | NULL |
2115 | 2115 | }; |
2116 | 2116 | int ret = -ENOMEM; |
2117 | - struct subprocess_info *info; | |
2118 | 2117 | |
2119 | 2118 | if (argv == NULL) { |
2120 | 2119 | printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", |
2121 | 2120 | |
2122 | 2121 | |
... | ... | @@ -2122,18 +2121,16 @@ |
2122 | 2121 | goto out; |
2123 | 2122 | } |
2124 | 2123 | |
2125 | - info = call_usermodehelper_setup(argv[0], argv, envp, GFP_ATOMIC); | |
2126 | - if (info == NULL) { | |
2124 | + ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_NO_WAIT, | |
2125 | + NULL, argv_cleanup, NULL); | |
2126 | +out: | |
2127 | + if (likely(!ret)) | |
2128 | + return 0; | |
2129 | + | |
2130 | + if (ret == -ENOMEM) | |
2127 | 2131 | argv_free(argv); |
2128 | - goto out; | |
2129 | - } | |
2130 | 2132 | |
2131 | - call_usermodehelper_setfns(info, NULL, argv_cleanup, NULL); | |
2132 | - | |
2133 | - ret = call_usermodehelper_exec(info, UMH_NO_WAIT); | |
2134 | - | |
2135 | - out: | |
2136 | - if (ret && force) { | |
2133 | + if (force) { | |
2137 | 2134 | printk(KERN_WARNING "Failed to start orderly shutdown: " |
2138 | 2135 | "forcing the issue\n"); |
2139 | 2136 |
security/keys/request_key.c
... | ... | @@ -93,16 +93,9 @@ |
93 | 93 | static int call_usermodehelper_keys(char *path, char **argv, char **envp, |
94 | 94 | struct key *session_keyring, int wait) |
95 | 95 | { |
96 | - gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; | |
97 | - struct subprocess_info *info = | |
98 | - call_usermodehelper_setup(path, argv, envp, gfp_mask); | |
99 | - | |
100 | - if (!info) | |
101 | - return -ENOMEM; | |
102 | - | |
103 | - call_usermodehelper_setfns(info, umh_keys_init, umh_keys_cleanup, | |
104 | - key_get(session_keyring)); | |
105 | - return call_usermodehelper_exec(info, wait); | |
96 | + return call_usermodehelper_fns(path, argv, envp, wait, | |
97 | + umh_keys_init, umh_keys_cleanup, | |
98 | + key_get(session_keyring)); | |
106 | 99 | } |
107 | 100 | |
108 | 101 | /* |