提交 fd3e646c 编写于 作者: D Daniel Borkmann 提交者: David S. Miller

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: d23b8ad8 ("tc: add BPF based action")
Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
Acked-by: NJiri Pirko <jiri@resnulli.us>
Acked-by: NAlexei Starovoitov <ast@plumgrid.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1c1bc6bd
...@@ -122,6 +122,9 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla, ...@@ -122,6 +122,9 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
return -EINVAL; return -EINVAL;
bpf_size = bpf_num_ops * sizeof(*bpf_ops); 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); bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
if (!bpf_ops) if (!bpf_ops)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册