aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2015-01-22 04:58:19 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-26 19:08:55 -0500
commitfd3e646c87ab3f2ba98aa25394581af27cc78dc5 (patch)
tree128691c3cc72ec24880bf538eddf81283d8fb0be
parent1c1bc6bdb7f529eb3383b6e34a0ea327d7e9f615 (diff)
net: act_bpf: fix size mismatch on filter preparation
Similarly as in cls_bpf, also this code needs to reject mismatches. Reference: http://article.gmane.org/gmane.linux.network/347406 Fixes: d23b8ad8ab23 ("tc: add BPF based action") Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Acked-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/act_bpf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 1bd257e473a9..82c5d7fc1988 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -122,6 +122,9 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
122 return -EINVAL; 122 return -EINVAL;
123 123
124 bpf_size = bpf_num_ops * sizeof(*bpf_ops); 124 bpf_size = bpf_num_ops * sizeof(*bpf_ops);
125 if (bpf_size != nla_len(tb[TCA_ACT_BPF_OPS]))
126 return -EINVAL;
127
125 bpf_ops = kzalloc(bpf_size, GFP_KERNEL); 128 bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
126 if (!bpf_ops) 129 if (!bpf_ops)
127 return -ENOMEM; 130 return -ENOMEM;