diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-23 23:36:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:11:23 -0500 |
commit | 53b2bf3f8a652c9c8e86831f94ae2c5767ea54d7 (patch) | |
tree | eba61efed08a932766a32b0b6a60e766f8b44bcb /net/sched/act_mirred.c | |
parent | 6fa8c0144b770dac941cf2c15053b6e24f046c8a (diff) |
[NET_SCHED]: Use nla_policy for attribute validation in actions
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_mirred.c')
-rw-r--r-- | net/sched/act_mirred.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 6cb5e30dcf8c..1aff005d95cd 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -54,6 +54,10 @@ static inline int tcf_mirred_release(struct tcf_mirred *m, int bind) | |||
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = { | ||
58 | [TCA_MIRRED_PARMS] = { .len = sizeof(struct tc_mirred) }, | ||
59 | }; | ||
60 | |||
57 | static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est, | 61 | static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est, |
58 | struct tc_action *a, int ovr, int bind) | 62 | struct tc_action *a, int ovr, int bind) |
59 | { | 63 | { |
@@ -68,12 +72,11 @@ static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est, | |||
68 | if (nla == NULL) | 72 | if (nla == NULL) |
69 | return -EINVAL; | 73 | return -EINVAL; |
70 | 74 | ||
71 | err = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, NULL); | 75 | err = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy); |
72 | if (err < 0) | 76 | if (err < 0) |
73 | return err; | 77 | return err; |
74 | 78 | ||
75 | if (tb[TCA_MIRRED_PARMS] == NULL || | 79 | if (tb[TCA_MIRRED_PARMS] == NULL) |
76 | nla_len(tb[TCA_MIRRED_PARMS]) < sizeof(*parm)) | ||
77 | return -EINVAL; | 80 | return -EINVAL; |
78 | parm = nla_data(tb[TCA_MIRRED_PARMS]); | 81 | parm = nla_data(tb[TCA_MIRRED_PARMS]); |
79 | 82 | ||