From: Kirill Tkhai <ktkhai@parallels.com>
To: <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
Rusty Russell <rusty@rustcorp.com.au>, <tkhai@yandex.ru>
Subject: [PATCH] kmod: Pass usermodehelper "-b" to use blacklist commands
Date: Tue, 6 May 2014 12:03:08 +0400 [thread overview]
Message-ID: <1399363388.3718.59.camel@tkhai> (raw)
User may want to prohibit autoloading of some modules,
which happens when someone in kernel calls request_module().
For comparison, udev considers blacklist even if corresponding
hardware presents in the system. In-kernel request_module()
functionality is rather similar to udev's, so user may want
to disallow it too.
Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
---
kernel/kmod.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 0ac67a5..68a4ca4 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -71,7 +71,7 @@ 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[4]); /* check call_modprobe() */
kfree(info->argv);
}
@@ -85,7 +85,7 @@ static int call_modprobe(char *module_name, int wait)
NULL
};
- char **argv = kmalloc(sizeof(char *[5]), GFP_KERNEL);
+ char **argv = kmalloc(sizeof(char *[6]), GFP_KERNEL);
if (!argv)
goto out;
@@ -95,9 +95,10 @@ static int call_modprobe(char *module_name, int wait)
argv[0] = modprobe_path;
argv[1] = "-q";
- argv[2] = "--";
- argv[3] = module_name; /* check free_modprobe_argv() */
- argv[4] = NULL;
+ argv[2] = "-b";
+ argv[3] = "--";
+ argv[4] = module_name; /* check free_modprobe_argv() */
+ argv[5] = NULL;
info = call_usermodehelper_setup(modprobe_path, argv, envp, GFP_KERNEL,
NULL, free_modprobe_argv, NULL);
next reply other threads:[~2014-05-06 8:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 8:03 Kirill Tkhai [this message]
2014-05-06 17:31 ` [PATCH] kmod: Pass usermodehelper "-b" to use blacklist commands Oleg Nesterov
2014-05-06 22:54 ` Andrew Morton
2014-05-07 1:23 ` Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399363388.3718.59.camel@tkhai \
--to=ktkhai@parallels.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=tkhai@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.