Skip to content

Commit 66e5b7e

Browse files
Lucas De Marchitorvalds
authored andcommitted
kmod: remove call_usermodehelper_fns()
This function suffers from not being able to determine if the cleanup is called in case it returns -ENOMEM. Nobody is using it anymore, so let's remove it. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi> Cc: Oleg Nesterov <oleg@redhat.com> Cc: David Howells <dhowells@redhat.com> Cc: James Morris <james.l.morris@oracle.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Tejun Heo <tj@kernel.org> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 907ed13 commit 66e5b7e

2 files changed

Lines changed: 18 additions & 24 deletions

File tree

‎include/linux/kmod.h‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ struct subprocess_info {
6767
};
6868

6969
extern int
70-
call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
71-
int (*init)(struct subprocess_info *info, struct cred *new),
72-
void (*cleanup)(struct subprocess_info *), void *data);
70+
call_usermodehelper(char *path, char **argv, char **envp, int wait);
7371

7472
extern struct subprocess_info *
7573
call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask,
@@ -79,13 +77,6 @@ call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask,
7977
extern int
8078
call_usermodehelper_exec(struct subprocess_info *info, int wait);
8179

82-
static inline int
83-
call_usermodehelper(char *path, char **argv, char **envp, int wait)
84-
{
85-
return call_usermodehelper_fns(path, argv, envp, wait,
86-
NULL, NULL, NULL);
87-
}
88-
8980
extern struct ctl_table usermodehelper_table[];
9081

9182
enum umh_disable_depth {

‎kernel/kmod.c‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,8 @@ EXPORT_SYMBOL(call_usermodehelper_setup);
555555
* call_usermodehelper_exec - start a usermode application
556556
* @sub_info: information about the subprocessa
557557
* @wait: wait for the application to finish and return status.
558-
* when -1 don't wait at all, but you get no useful error back when
559-
* the program couldn't be exec'ed. This makes it safe to call
558+
* when UMH_NO_WAIT don't wait at all, but you get no useful error back
559+
* when the program couldn't be exec'ed. This makes it safe to call
560560
* from interrupt context.
561561
*
562562
* Runs a user-space application. The application is started
@@ -616,29 +616,32 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
616616
}
617617
EXPORT_SYMBOL(call_usermodehelper_exec);
618618

619-
/*
620-
* call_usermodehelper_fns() will not run the caller-provided cleanup function
621-
* if a memory allocation failure is experienced. So the caller might need to
622-
* check the call_usermodehelper_fns() return value: if it is -ENOMEM, perform
623-
* the necessaary cleanup within the caller.
619+
/**
620+
* call_usermodehelper() - prepare and start a usermode application
621+
* @path: path to usermode executable
622+
* @argv: arg vector for process
623+
* @envp: environment for process
624+
* @wait: wait for the application to finish and return status.
625+
* when UMH_NO_WAIT don't wait at all, but you get no useful error back
626+
* when the program couldn't be exec'ed. This makes it safe to call
627+
* from interrupt context.
628+
*
629+
* This function is the equivalent to use call_usermodehelper_setup() and
630+
* call_usermodehelper_exec().
624631
*/
625-
int call_usermodehelper_fns(
626-
char *path, char **argv, char **envp, int wait,
627-
int (*init)(struct subprocess_info *info, struct cred *new),
628-
void (*cleanup)(struct subprocess_info *), void *data)
632+
int call_usermodehelper(char *path, char **argv, char **envp, int wait)
629633
{
630634
struct subprocess_info *info;
631635
gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
632636

633637
info = call_usermodehelper_setup(path, argv, envp, gfp_mask,
634-
init, cleanup, data);
635-
638+
NULL, NULL, NULL);
636639
if (info == NULL)
637640
return -ENOMEM;
638641

639642
return call_usermodehelper_exec(info, wait);
640643
}
641-
EXPORT_SYMBOL(call_usermodehelper_fns);
644+
EXPORT_SYMBOL(call_usermodehelper);
642645

643646
static int proc_cap_handler(struct ctl_table *table, int write,
644647
void __user *buffer, size_t *lenp, loff_t *ppos)

0 commit comments

Comments
 (0)