Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295273
b: refs/heads/master
c: 1cc684a
h: refs/heads/master
i:
  295271: 38f547a
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Mar 23, 2012
1 parent aabde9c commit 2a46ca4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e63a93b987685f02421e18b2aa452d20553a88b
refs/heads/master: 1cc684ab75123efe7ff446eb821d44375ba8fa30
26 changes: 24 additions & 2 deletions trunk/kernel/kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ static DECLARE_RWSEM(umhelper_sem);
*/
char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe";

static void free_modprobe_argv(struct subprocess_info *info)
{
kfree(info->argv[3]); /* check call_modprobe() */
kfree(info->argv);
}

static int call_modprobe(char *module_name, int wait)
{
static char *envp[] = {
Expand All @@ -69,10 +75,26 @@ static int call_modprobe(char *module_name, int wait)
NULL
};

char *argv[] = { modprobe_path, "-q", "--", module_name, NULL };
char **argv = kmalloc(sizeof(char *[5]), GFP_KERNEL);
if (!argv)
goto out;

module_name = kstrdup(module_name, GFP_KERNEL);
if (!module_name)
goto free_argv;

argv[0] = modprobe_path;
argv[1] = "-q";
argv[2] = "--";
argv[3] = module_name; /* check free_modprobe_argv() */
argv[4] = NULL;

return call_usermodehelper_fns(modprobe_path, argv, envp,
wait, NULL, NULL, NULL);
wait | UMH_KILLABLE, NULL, free_modprobe_argv, NULL);
free_argv:
kfree(argv);
out:
return -ENOMEM;
}

/**
Expand Down

0 comments on commit 2a46ca4

Please sign in to comment.