|
@@ -623,7 +623,7 @@ static void bpf_prog_uncharge_memlock(struct bpf_prog *prog)
|
|
free_uid(user);
|
|
free_uid(user);
|
|
}
|
|
}
|
|
|
|
|
|
-static void __prog_put_common(struct rcu_head *rcu)
|
|
|
|
|
|
+static void __bpf_prog_put_rcu(struct rcu_head *rcu)
|
|
{
|
|
{
|
|
struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu);
|
|
struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu);
|
|
|
|
|
|
@@ -632,17 +632,10 @@ static void __prog_put_common(struct rcu_head *rcu)
|
|
bpf_prog_free(aux->prog);
|
|
bpf_prog_free(aux->prog);
|
|
}
|
|
}
|
|
|
|
|
|
-/* version of bpf_prog_put() that is called after a grace period */
|
|
|
|
-void bpf_prog_put_rcu(struct bpf_prog *prog)
|
|
|
|
-{
|
|
|
|
- if (atomic_dec_and_test(&prog->aux->refcnt))
|
|
|
|
- call_rcu(&prog->aux->rcu, __prog_put_common);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void bpf_prog_put(struct bpf_prog *prog)
|
|
void bpf_prog_put(struct bpf_prog *prog)
|
|
{
|
|
{
|
|
if (atomic_dec_and_test(&prog->aux->refcnt))
|
|
if (atomic_dec_and_test(&prog->aux->refcnt))
|
|
- __prog_put_common(&prog->aux->rcu);
|
|
|
|
|
|
+ call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(bpf_prog_put);
|
|
EXPORT_SYMBOL_GPL(bpf_prog_put);
|
|
|
|
|
|
@@ -650,7 +643,7 @@ static int bpf_prog_release(struct inode *inode, struct file *filp)
|
|
{
|
|
{
|
|
struct bpf_prog *prog = filp->private_data;
|
|
struct bpf_prog *prog = filp->private_data;
|
|
|
|
|
|
- bpf_prog_put_rcu(prog);
|
|
|
|
|
|
+ bpf_prog_put(prog);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|