Skip to content

Commit 33c3260

Browse files
committed
umd: Stop using split_argv
There is exactly one argument so there is nothing to split. All split_argv does now is cause confusion and avoid the need for a cast when passing a "const char *" string to call_usermodehelper_setup. So avoid confusion and the possibility of an odd driver name causing problems by just using a fixed argv array with a cast in the call to call_usermodehelper_setup. v1: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Acked-by: Alexei Starovoitov <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 8c2f526 commit 33c3260

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

kernel/usermode_driver.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,27 +160,21 @@ static void umd_cleanup(struct subprocess_info *info)
160160
int fork_usermode_driver(struct umd_info *info)
161161
{
162162
struct subprocess_info *sub_info;
163-
char **argv = NULL;
163+
const char *argv[] = { info->driver_name, NULL };
164164
int err;
165165

166166
if (WARN_ON_ONCE(info->tgid))
167167
return -EBUSY;
168168

169169
err = -ENOMEM;
170-
argv = argv_split(GFP_KERNEL, info->driver_name, NULL);
171-
if (!argv)
172-
goto out;
173-
174-
sub_info = call_usermodehelper_setup(info->driver_name, argv, NULL,
175-
GFP_KERNEL,
170+
sub_info = call_usermodehelper_setup(info->driver_name,
171+
(char **)argv, NULL, GFP_KERNEL,
176172
umd_setup, umd_cleanup, info);
177173
if (!sub_info)
178174
goto out;
179175

180176
err = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC);
181177
out:
182-
if (argv)
183-
argv_free(argv);
184178
return err;
185179
}
186180
EXPORT_SYMBOL_GPL(fork_usermode_driver);

0 commit comments

Comments
 (0)