diff mbox

[net] tc: act_bpf: fix memory leak

Message ID 1436901319-705-1-git-send-email-ast@plumgrid.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Alexei Starovoitov July 14, 2015, 7:15 p.m. UTC
prog->bpf_ops is populated when act_bpf is used with classic BPF and
prog->bpf_name is optionally used with extended BPF.
Fix memory leak when act_bpf is released.

Fixes: d23b8ad8ab23 ("tc: add BPF based action")
Fixes: a8cb5f556b56 ("act_bpf: add initial eBPF support for actions")
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---
 net/sched/act_bpf.c |    3 +++
 1 file changed, 3 insertions(+)

Comments

David Miller July 16, 2015, 4:37 a.m. UTC | #1
From: Alexei Starovoitov <ast@plumgrid.com>
Date: Tue, 14 Jul 2015 12:15:19 -0700

> prog->bpf_ops is populated when act_bpf is used with classic BPF and
> prog->bpf_name is optionally used with extended BPF.
> Fix memory leak when act_bpf is released.
> 
> Fixes: d23b8ad8ab23 ("tc: add BPF based action")
> Fixes: a8cb5f556b56 ("act_bpf: add initial eBPF support for actions")
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 1d56903fd4c7..1df78289e248 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -339,6 +339,9 @@  static void tcf_bpf_cleanup(struct tc_action *act, int bind)
 		bpf_prog_put(prog->filter);
 	else
 		bpf_prog_destroy(prog->filter);
+
+	kfree(prog->bpf_ops);
+	kfree(prog->bpf_name);
 }
 
 static struct tc_action_ops act_bpf_ops __read_mostly = {