diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-23 23:36:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:11:24 -0500 |
commit | 7a9c1bd409d3522806d492aa573c1cc5384ca620 (patch) | |
tree | 5226c9086d9f4418f91032bedae11cc0aba9c50d /net/sched/em_meta.c | |
parent | 53b2bf3f8a652c9c8e86831f94ae2c5767ea54d7 (diff) |
[NET_SCHED]: Use nla_policy for attribute validation in ematches
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/em_meta.c')
-rw-r--r-- | net/sched/em_meta.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index d9f487d813c4..a1e5619b1876 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -745,6 +745,10 @@ static inline int meta_is_supported(struct meta_value *val) | |||
745 | return (!meta_id(val) || meta_ops(val)->get); | 745 | return (!meta_id(val) || meta_ops(val)->get); |
746 | } | 746 | } |
747 | 747 | ||
748 | static const struct nla_policy meta_policy[TCA_EM_META_MAX + 1] = { | ||
749 | [TCA_EM_META_HDR] = { .len = sizeof(struct tcf_meta_hdr) }, | ||
750 | }; | ||
751 | |||
748 | static int em_meta_change(struct tcf_proto *tp, void *data, int len, | 752 | static int em_meta_change(struct tcf_proto *tp, void *data, int len, |
749 | struct tcf_ematch *m) | 753 | struct tcf_ematch *m) |
750 | { | 754 | { |
@@ -753,13 +757,12 @@ static int em_meta_change(struct tcf_proto *tp, void *data, int len, | |||
753 | struct tcf_meta_hdr *hdr; | 757 | struct tcf_meta_hdr *hdr; |
754 | struct meta_match *meta = NULL; | 758 | struct meta_match *meta = NULL; |
755 | 759 | ||
756 | err = nla_parse(tb, TCA_EM_META_MAX, data, len, NULL); | 760 | err = nla_parse(tb, TCA_EM_META_MAX, data, len, meta_policy); |
757 | if (err < 0) | 761 | if (err < 0) |
758 | goto errout; | 762 | goto errout; |
759 | 763 | ||
760 | err = -EINVAL; | 764 | err = -EINVAL; |
761 | if (tb[TCA_EM_META_HDR] == NULL || | 765 | if (tb[TCA_EM_META_HDR] == NULL) |
762 | nla_len(tb[TCA_EM_META_HDR]) < sizeof(*hdr)) | ||
763 | goto errout; | 766 | goto errout; |
764 | hdr = nla_data(tb[TCA_EM_META_HDR]); | 767 | hdr = nla_data(tb[TCA_EM_META_HDR]); |
765 | 768 | ||