diff options
Diffstat (limited to 'net/sched/sch_tbf.c')
-rw-r--r-- | net/sched/sch_tbf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index b7a185dc3def..0b7d78f59d8c 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -270,6 +270,12 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct Qdisc *sch, u32 limit) | |||
270 | return NULL; | 270 | return NULL; |
271 | } | 271 | } |
272 | 272 | ||
273 | static const struct nla_policy tbf_policy[TCA_TBF_MAX + 1] = { | ||
274 | [TCA_TBF_PARMS] = { .len = sizeof(struct tc_tbf_qopt) }, | ||
275 | [TCA_TBF_RTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, | ||
276 | [TCA_TBF_PTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, | ||
277 | }; | ||
278 | |||
273 | static int tbf_change(struct Qdisc* sch, struct nlattr *opt) | 279 | static int tbf_change(struct Qdisc* sch, struct nlattr *opt) |
274 | { | 280 | { |
275 | int err; | 281 | int err; |
@@ -281,13 +287,12 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt) | |||
281 | struct Qdisc *child = NULL; | 287 | struct Qdisc *child = NULL; |
282 | int max_size,n; | 288 | int max_size,n; |
283 | 289 | ||
284 | err = nla_parse_nested(tb, TCA_TBF_PTAB, opt, NULL); | 290 | err = nla_parse_nested(tb, TCA_TBF_PTAB, opt, tbf_policy); |
285 | if (err < 0) | 291 | if (err < 0) |
286 | return err; | 292 | return err; |
287 | 293 | ||
288 | err = -EINVAL; | 294 | err = -EINVAL; |
289 | if (tb[TCA_TBF_PARMS] == NULL || | 295 | if (tb[TCA_TBF_PARMS] == NULL) |
290 | nla_len(tb[TCA_TBF_PARMS]) < sizeof(*qopt)) | ||
291 | goto done; | 296 | goto done; |
292 | 297 | ||
293 | qopt = nla_data(tb[TCA_TBF_PARMS]); | 298 | qopt = nla_data(tb[TCA_TBF_PARMS]); |