aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/em_meta.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/em_meta.c')
-rw-r--r--net/sched/em_meta.c9
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
748static const struct nla_policy meta_policy[TCA_EM_META_MAX + 1] = {
749 [TCA_EM_META_HDR] = { .len = sizeof(struct tcf_meta_hdr) },
750};
751
748static int em_meta_change(struct tcf_proto *tp, void *data, int len, 752static 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