Commit 66e5b7e1948cdbdca2b0cc6ddc6d69ee84583fb4

Authored by Lucas De Marchi
Committed by Linus Torvalds
1 parent 907ed1328d

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>

Showing 2 changed files with 18 additions and 24 deletions Side-by-side Diff

include/linux/kmod.h
... ... @@ -67,9 +67,7 @@
67 67 };
68 68  
69 69 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);
73 71  
74 72 extern struct subprocess_info *
75 73 call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask,
... ... @@ -78,13 +76,6 @@
78 76  
79 77 extern int
80 78 call_usermodehelper_exec(struct subprocess_info *info, int wait);
81   -
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 79  
89 80 extern struct ctl_table usermodehelper_table[];
90 81  
... ... @@ -555,8 +555,8 @@
555 555 * call_usermodehelper_exec - start a usermode application
556 556 * @sub_info: information about the subprocessa
557 557 * @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
560 560 * from interrupt context.
561 561 *
562 562 * Runs a user-space application. The application is started
563 563  
564 564  
565 565  
... ... @@ -616,29 +616,32 @@
616 616 }
617 617 EXPORT_SYMBOL(call_usermodehelper_exec);
618 618  
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().
624 631 */
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)
629 633 {
630 634 struct subprocess_info *info;
631 635 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
632 636  
633 637 info = call_usermodehelper_setup(path, argv, envp, gfp_mask,
634   - init, cleanup, data);
635   -
  638 + NULL, NULL, NULL);
636 639 if (info == NULL)
637 640 return -ENOMEM;
638 641  
639 642 return call_usermodehelper_exec(info, wait);
640 643 }
641   -EXPORT_SYMBOL(call_usermodehelper_fns);
  644 +EXPORT_SYMBOL(call_usermodehelper);
642 645  
643 646 static int proc_cap_handler(struct ctl_table *table, int write,
644 647 void __user *buffer, size_t *lenp, loff_t *ppos)