diff options
Diffstat (limited to 'net/sched/ematch.c')
-rw-r--r-- | net/sched/ematch.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index daa9c4e7e81d..74ff918455a2 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -282,6 +282,11 @@ errout: | |||
282 | return err; | 282 | return err; |
283 | } | 283 | } |
284 | 284 | ||
285 | static const struct nla_policy em_policy[TCA_EMATCH_TREE_MAX + 1] = { | ||
286 | [TCA_EMATCH_TREE_HDR] = { .len = sizeof(struct tcf_ematch_tree_hdr) }, | ||
287 | [TCA_EMATCH_TREE_LIST] = { .type = NLA_NESTED }, | ||
288 | }; | ||
289 | |||
285 | /** | 290 | /** |
286 | * tcf_em_tree_validate - validate ematch config TLV and build ematch tree | 291 | * tcf_em_tree_validate - validate ematch config TLV and build ematch tree |
287 | * | 292 | * |
@@ -312,7 +317,7 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla, | |||
312 | return 0; | 317 | return 0; |
313 | } | 318 | } |
314 | 319 | ||
315 | err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, NULL); | 320 | err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy); |
316 | if (err < 0) | 321 | if (err < 0) |
317 | goto errout; | 322 | goto errout; |
318 | 323 | ||
@@ -323,10 +328,6 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla, | |||
323 | if (rt_hdr == NULL || rt_list == NULL) | 328 | if (rt_hdr == NULL || rt_list == NULL) |
324 | goto errout; | 329 | goto errout; |
325 | 330 | ||
326 | if (nla_len(rt_hdr) < sizeof(*tree_hdr) || | ||
327 | nla_len(rt_list) < sizeof(*rt_match)) | ||
328 | goto errout; | ||
329 | |||
330 | tree_hdr = nla_data(rt_hdr); | 331 | tree_hdr = nla_data(rt_hdr); |
331 | memcpy(&tree->hdr, tree_hdr, sizeof(*tree_hdr)); | 332 | memcpy(&tree->hdr, tree_hdr, sizeof(*tree_hdr)); |
332 | 333 | ||