mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
Introduce STATIC_USERMODEHELPER to mediate call_usermodehelper()
Some usermode helper applications are defined at kernel build time, while others can be changed at runtime. To provide a sane way to filter these, add a new kernel option "STATIC_USERMODEHELPER". This option routes all call_usermodehelper() calls through this binary, no matter what the caller wishes to have called. The new binary (by default set to /sbin/usermode-helper, but can be changed through the STATIC_USERMODEHELPER_PATH option) can properly filter the requested programs to be run by the kernel by looking at the first argument that is passed to it. All other options should then be passed onto the proper program if so desired. To disable all call_usermodehelper() calls by the kernel, set STATIC_USERMODEHELPER_PATH to an empty string. Thanks to Neil Brown for the idea of this feature. Cc: NeilBrown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
377e7a27c0
commit
64e90a8acb
2 changed files with 49 additions and 0 deletions
|
|
@ -528,7 +528,12 @@ struct subprocess_info *call_usermodehelper_setup(const char *path, char **argv,
|
|||
goto out;
|
||||
|
||||
INIT_WORK(&sub_info->work, call_usermodehelper_exec_work);
|
||||
|
||||
#ifdef CONFIG_STATIC_USERMODEHELPER
|
||||
sub_info->path = CONFIG_STATIC_USERMODEHELPER_PATH;
|
||||
#else
|
||||
sub_info->path = path;
|
||||
#endif
|
||||
sub_info->argv = argv;
|
||||
sub_info->envp = envp;
|
||||
|
||||
|
|
@ -566,6 +571,15 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
|
|||
retval = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is no binary for us to call, then just return and get out of
|
||||
* here. This allows us to set STATIC_USERMODEHELPER_PATH to "" and
|
||||
* disable all call_usermodehelper() calls.
|
||||
*/
|
||||
if (strlen(sub_info->path) == 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Set the completion pointer only if there is a waiter.
|
||||
* This makes it possible to use umh_complete to free
|
||||
|
|
|
|||
Loading…
Reference in a new issue