diff options
Diffstat (limited to 'net/sched/cls_route.c')
-rw-r--r-- | net/sched/cls_route.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index ae97238c57ad..f7e7d3955d28 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -323,6 +323,13 @@ static int route4_delete(struct tcf_proto *tp, unsigned long arg) | |||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | static const struct nla_policy route4_policy[TCA_ROUTE4_MAX + 1] = { | ||
327 | [TCA_ROUTE4_CLASSID] = { .type = NLA_U32 }, | ||
328 | [TCA_ROUTE4_TO] = { .type = NLA_U32 }, | ||
329 | [TCA_ROUTE4_FROM] = { .type = NLA_U32 }, | ||
330 | [TCA_ROUTE4_IIF] = { .type = NLA_U32 }, | ||
331 | }; | ||
332 | |||
326 | static int route4_set_parms(struct tcf_proto *tp, unsigned long base, | 333 | static int route4_set_parms(struct tcf_proto *tp, unsigned long base, |
327 | struct route4_filter *f, u32 handle, struct route4_head *head, | 334 | struct route4_filter *f, u32 handle, struct route4_head *head, |
328 | struct nlattr **tb, struct nlattr *est, int new) | 335 | struct nlattr **tb, struct nlattr *est, int new) |
@@ -339,15 +346,9 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base, | |||
339 | return err; | 346 | return err; |
340 | 347 | ||
341 | err = -EINVAL; | 348 | err = -EINVAL; |
342 | if (tb[TCA_ROUTE4_CLASSID]) | ||
343 | if (nla_len(tb[TCA_ROUTE4_CLASSID]) < sizeof(u32)) | ||
344 | goto errout; | ||
345 | |||
346 | if (tb[TCA_ROUTE4_TO]) { | 349 | if (tb[TCA_ROUTE4_TO]) { |
347 | if (new && handle & 0x8000) | 350 | if (new && handle & 0x8000) |
348 | goto errout; | 351 | goto errout; |
349 | if (nla_len(tb[TCA_ROUTE4_TO]) < sizeof(u32)) | ||
350 | goto errout; | ||
351 | to = nla_get_u32(tb[TCA_ROUTE4_TO]); | 352 | to = nla_get_u32(tb[TCA_ROUTE4_TO]); |
352 | if (to > 0xFF) | 353 | if (to > 0xFF) |
353 | goto errout; | 354 | goto errout; |
@@ -357,15 +358,11 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base, | |||
357 | if (tb[TCA_ROUTE4_FROM]) { | 358 | if (tb[TCA_ROUTE4_FROM]) { |
358 | if (tb[TCA_ROUTE4_IIF]) | 359 | if (tb[TCA_ROUTE4_IIF]) |
359 | goto errout; | 360 | goto errout; |
360 | if (nla_len(tb[TCA_ROUTE4_FROM]) < sizeof(u32)) | ||
361 | goto errout; | ||
362 | id = nla_get_u32(tb[TCA_ROUTE4_FROM]); | 361 | id = nla_get_u32(tb[TCA_ROUTE4_FROM]); |
363 | if (id > 0xFF) | 362 | if (id > 0xFF) |
364 | goto errout; | 363 | goto errout; |
365 | nhandle |= id << 16; | 364 | nhandle |= id << 16; |
366 | } else if (tb[TCA_ROUTE4_IIF]) { | 365 | } else if (tb[TCA_ROUTE4_IIF]) { |
367 | if (nla_len(tb[TCA_ROUTE4_IIF]) < sizeof(u32)) | ||
368 | goto errout; | ||
369 | id = nla_get_u32(tb[TCA_ROUTE4_IIF]); | 366 | id = nla_get_u32(tb[TCA_ROUTE4_IIF]); |
370 | if (id > 0x7FFF) | 367 | if (id > 0x7FFF) |
371 | goto errout; | 368 | goto errout; |
@@ -440,7 +437,7 @@ static int route4_change(struct tcf_proto *tp, unsigned long base, | |||
440 | if (opt == NULL) | 437 | if (opt == NULL) |
441 | return handle ? -EINVAL : 0; | 438 | return handle ? -EINVAL : 0; |
442 | 439 | ||
443 | err = nla_parse_nested(tb, TCA_ROUTE4_MAX, opt, NULL); | 440 | err = nla_parse_nested(tb, TCA_ROUTE4_MAX, opt, route4_policy); |
444 | if (err < 0) | 441 | if (err < 0) |
445 | return err; | 442 | return err; |
446 | 443 | ||