Skip to content

Commit 8c2f526

Browse files
committed
umd: Remove exit_umh
The bpfilter code no longer uses the umd_info.cleanup callback. This callback is what exit_umh exists to call. So remove exit_umh and all of it's associated booking. v1: https://lkml.kernel.org/r/[email protected] v2: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Reviewed-by: Greg Kroah-Hartman <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent e80eb1d commit 8c2f526

File tree

4 files changed

+0
-48
lines changed

4 files changed

+0
-48
lines changed

include/linux/sched.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,6 @@ extern struct pid *cad_pid;
15111511
#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
15121512
#define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */
15131513
#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1514-
#define PF_UMH 0x02000000 /* I'm an Usermodehelper process */
15151514
#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */
15161515
#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
15171516
#define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */

include/linux/usermode_driver.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,10 @@
44
#include <linux/umh.h>
55
#include <linux/path.h>
66

7-
#ifdef CONFIG_BPFILTER
8-
void __exit_umh(struct task_struct *tsk);
9-
10-
static inline void exit_umh(struct task_struct *tsk)
11-
{
12-
if (unlikely(tsk->flags & PF_UMH))
13-
__exit_umh(tsk);
14-
}
15-
#else
16-
static inline void exit_umh(struct task_struct *tsk)
17-
{
18-
}
19-
#endif
20-
217
struct umd_info {
228
const char *driver_name;
239
struct file *pipe_to_umh;
2410
struct file *pipe_from_umh;
25-
struct list_head list;
26-
void (*cleanup)(struct umd_info *info);
2711
struct path wd;
2812
struct pid *tgid;
2913
};

kernel/exit.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
#include <linux/random.h>
6464
#include <linux/rcuwait.h>
6565
#include <linux/compat.h>
66-
#include <linux/usermode_driver.h>
6766

6867
#include <linux/uaccess.h>
6968
#include <asm/unistd.h>
@@ -805,8 +804,6 @@ void __noreturn do_exit(long code)
805804
exit_task_namespaces(tsk);
806805
exit_task_work(tsk);
807806
exit_thread(tsk);
808-
if (group_dead)
809-
exit_umh(tsk);
810807

811808
/*
812809
* Flush inherited counters to the parent - before the parent

kernel/usermode_driver.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
#include <linux/task_work.h>
1010
#include <linux/usermode_driver.h>
1111

12-
static LIST_HEAD(umh_list);
13-
static DEFINE_MUTEX(umh_list_lock);
14-
1512
static struct vfsmount *blob_to_mnt(const void *data, size_t len, const char *name)
1613
{
1714
struct file_system_type *type;
@@ -134,7 +131,6 @@ static int umd_setup(struct subprocess_info *info, struct cred *new)
134131
umd_info->pipe_to_umh = to_umh[1];
135132
umd_info->pipe_from_umh = from_umh[0];
136133
umd_info->tgid = get_pid(task_tgid(current));
137-
current->flags |= PF_UMH;
138134
return 0;
139135
}
140136

@@ -182,35 +178,11 @@ int fork_usermode_driver(struct umd_info *info)
182178
goto out;
183179

184180
err = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC);
185-
if (!err) {
186-
mutex_lock(&umh_list_lock);
187-
list_add(&info->list, &umh_list);
188-
mutex_unlock(&umh_list_lock);
189-
}
190181
out:
191182
if (argv)
192183
argv_free(argv);
193184
return err;
194185
}
195186
EXPORT_SYMBOL_GPL(fork_usermode_driver);
196187

197-
void __exit_umh(struct task_struct *tsk)
198-
{
199-
struct umd_info *info;
200-
struct pid *tgid = task_tgid(tsk);
201-
202-
mutex_lock(&umh_list_lock);
203-
list_for_each_entry(info, &umh_list, list) {
204-
if (info->tgid == tgid) {
205-
list_del(&info->list);
206-
mutex_unlock(&umh_list_lock);
207-
goto out;
208-
}
209-
}
210-
mutex_unlock(&umh_list_lock);
211-
return;
212-
out:
213-
if (info->cleanup)
214-
info->cleanup(info);
215-
}
216188

0 commit comments

Comments
 (0)