mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
UPSTREAM: bpfilter: Take advantage of the facilities of struct pid
Instead of relying on the exit_umh cleanup callback use the fact a struct pid can be tested to see if a process still exists, and that struct pid has a wait queue that notifies when the process dies. 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]> Change-Id: Id9db45a4e902e36922c4f9bd83b80de71012545a Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Tashfin Shakeer Rhythm <[email protected]>
This commit is contained in:
parent
c65fbcec66
commit
99eec559b4
3 changed files with 15 additions and 18 deletions
|
|
@ -12,16 +12,14 @@
|
|||
struct bpfilter_umh_ops bpfilter_ops;
|
||||
EXPORT_SYMBOL_GPL(bpfilter_ops);
|
||||
|
||||
static void bpfilter_umh_cleanup(struct umd_info *info)
|
||||
void bpfilter_umh_cleanup(struct umd_info *info)
|
||||
{
|
||||
mutex_lock(&bpfilter_ops.lock);
|
||||
bpfilter_ops.stop = true;
|
||||
fput(info->pipe_to_umh);
|
||||
fput(info->pipe_from_umh);
|
||||
put_pid(info->tgid);
|
||||
info->tgid = NULL;
|
||||
mutex_unlock(&bpfilter_ops.lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bpfilter_umh_cleanup);
|
||||
|
||||
static int bpfilter_mbox_request(struct sock *sk, int optname,
|
||||
char __user *optval,
|
||||
|
|
@ -39,7 +37,11 @@ static int bpfilter_mbox_request(struct sock *sk, int optname,
|
|||
goto out;
|
||||
}
|
||||
}
|
||||
if (bpfilter_ops.stop) {
|
||||
if (bpfilter_ops.info.tgid &&
|
||||
thread_group_exited(bpfilter_ops.info.tgid))
|
||||
bpfilter_umh_cleanup(&bpfilter_ops.info);
|
||||
|
||||
if (!bpfilter_ops.info.tgid) {
|
||||
err = bpfilter_ops.start();
|
||||
if (err)
|
||||
goto out;
|
||||
|
|
@ -70,9 +72,8 @@ int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval,
|
|||
static int __init bpfilter_sockopt_init(void)
|
||||
{
|
||||
mutex_init(&bpfilter_ops.lock);
|
||||
bpfilter_ops.stop = true;
|
||||
bpfilter_ops.info.tgid = NULL;
|
||||
bpfilter_ops.info.driver_name = "bpfilter_umh";
|
||||
bpfilter_ops.info.cleanup = &bpfilter_umh_cleanup;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue