Skip to content

Commit

Permalink
net: act_bpf: fix size mismatch on filter preparation
Browse files Browse the repository at this point in the history
Similarly as in cls_bpf, also this code needs to reject mismatches.

Reference: http://article.gmane.org/gmane.linux.network/347406
Fixes: d23b8ad ("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>
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed Jan 27, 2015
1 parent 1c1bc6b commit fd3e646
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/sched/act_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
return -EINVAL;

bpf_size = bpf_num_ops * sizeof(*bpf_ops);
if (bpf_size != nla_len(tb[TCA_ACT_BPF_OPS]))
return -EINVAL;

bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
if (!bpf_ops)
return -ENOMEM;
Expand Down

0 comments on commit fd3e646

Please sign in to comment.