1
0
Fork 0

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/87sged3a9n.fsf_-_@x220.int.ebiederm.org
Link: https://lkml.kernel.org/r/20200702164140.4468-16-ebiederm@xmission.com
Acked-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
zero-sugar-mainline-defconfig
Eric W. Biederman 2020-06-29 08:28:33 -05:00
parent 8c2f526639
commit 33c326014f
1 changed files with 3 additions and 9 deletions

View File

@ -160,27 +160,21 @@ static void umd_cleanup(struct subprocess_info *info)
int fork_usermode_driver(struct umd_info *info) int fork_usermode_driver(struct umd_info *info)
{ {
struct subprocess_info *sub_info; struct subprocess_info *sub_info;
char **argv = NULL; const char *argv[] = { info->driver_name, NULL };
int err; int err;
if (WARN_ON_ONCE(info->tgid)) if (WARN_ON_ONCE(info->tgid))
return -EBUSY; return -EBUSY;
err = -ENOMEM; err = -ENOMEM;
argv = argv_split(GFP_KERNEL, info->driver_name, NULL); sub_info = call_usermodehelper_setup(info->driver_name,
if (!argv) (char **)argv, NULL, GFP_KERNEL,
goto out;
sub_info = call_usermodehelper_setup(info->driver_name, argv, NULL,
GFP_KERNEL,
umd_setup, umd_cleanup, info); umd_setup, umd_cleanup, info);
if (!sub_info) if (!sub_info)
goto out; goto out;
err = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC); err = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC);
out: out:
if (argv)
argv_free(argv);
return err; return err;
} }
EXPORT_SYMBOL_GPL(fork_usermode_driver); EXPORT_SYMBOL_GPL(fork_usermode_driver);