diff options
Diffstat (limited to 'net/sched')
40 files changed, 263 insertions, 157 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 93fdf131bd75..5cfb160df063 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -127,7 +127,8 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | |||
127 | nest = nla_nest_start(skb, a->order); | 127 | nest = nla_nest_start(skb, a->order); |
128 | if (nest == NULL) | 128 | if (nest == NULL) |
129 | goto nla_put_failure; | 129 | goto nla_put_failure; |
130 | NLA_PUT_STRING(skb, TCA_KIND, a->ops->kind); | 130 | if (nla_put_string(skb, TCA_KIND, a->ops->kind)) |
131 | goto nla_put_failure; | ||
131 | for (i = 0; i < (hinfo->hmask + 1); i++) { | 132 | for (i = 0; i < (hinfo->hmask + 1); i++) { |
132 | p = hinfo->htab[tcf_hash(i, hinfo->hmask)]; | 133 | p = hinfo->htab[tcf_hash(i, hinfo->hmask)]; |
133 | 134 | ||
@@ -139,7 +140,8 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | |||
139 | p = s_p; | 140 | p = s_p; |
140 | } | 141 | } |
141 | } | 142 | } |
142 | NLA_PUT_U32(skb, TCA_FCNT, n_i); | 143 | if (nla_put_u32(skb, TCA_FCNT, n_i)) |
144 | goto nla_put_failure; | ||
143 | nla_nest_end(skb, nest); | 145 | nla_nest_end(skb, nest); |
144 | 146 | ||
145 | return n_i; | 147 | return n_i; |
@@ -437,7 +439,8 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
437 | if (a->ops == NULL || a->ops->dump == NULL) | 439 | if (a->ops == NULL || a->ops->dump == NULL) |
438 | return err; | 440 | return err; |
439 | 441 | ||
440 | NLA_PUT_STRING(skb, TCA_KIND, a->ops->kind); | 442 | if (nla_put_string(skb, TCA_KIND, a->ops->kind)) |
443 | goto nla_put_failure; | ||
441 | if (tcf_action_copy_stats(skb, a, 0)) | 444 | if (tcf_action_copy_stats(skb, a, 0)) |
442 | goto nla_put_failure; | 445 | goto nla_put_failure; |
443 | nest = nla_nest_start(skb, TCA_OPTIONS); | 446 | nest = nla_nest_start(skb, TCA_OPTIONS); |
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 453a73431ac4..882124ceb70c 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c | |||
@@ -550,11 +550,13 @@ static int tcf_csum_dump(struct sk_buff *skb, | |||
550 | }; | 550 | }; |
551 | struct tcf_t t; | 551 | struct tcf_t t; |
552 | 552 | ||
553 | NLA_PUT(skb, TCA_CSUM_PARMS, sizeof(opt), &opt); | 553 | if (nla_put(skb, TCA_CSUM_PARMS, sizeof(opt), &opt)) |
554 | goto nla_put_failure; | ||
554 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); | 555 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
555 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); | 556 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); |
556 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); | 557 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
557 | NLA_PUT(skb, TCA_CSUM_TM, sizeof(t), &t); | 558 | if (nla_put(skb, TCA_CSUM_TM, sizeof(t), &t)) |
559 | goto nla_put_failure; | ||
558 | 560 | ||
559 | return skb->len; | 561 | return skb->len; |
560 | 562 | ||
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index b77f5a06a658..f10fb8256442 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -162,7 +162,8 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int | |||
162 | }; | 162 | }; |
163 | struct tcf_t t; | 163 | struct tcf_t t; |
164 | 164 | ||
165 | NLA_PUT(skb, TCA_GACT_PARMS, sizeof(opt), &opt); | 165 | if (nla_put(skb, TCA_GACT_PARMS, sizeof(opt), &opt)) |
166 | goto nla_put_failure; | ||
166 | #ifdef CONFIG_GACT_PROB | 167 | #ifdef CONFIG_GACT_PROB |
167 | if (gact->tcfg_ptype) { | 168 | if (gact->tcfg_ptype) { |
168 | struct tc_gact_p p_opt = { | 169 | struct tc_gact_p p_opt = { |
@@ -171,13 +172,15 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int | |||
171 | .ptype = gact->tcfg_ptype, | 172 | .ptype = gact->tcfg_ptype, |
172 | }; | 173 | }; |
173 | 174 | ||
174 | NLA_PUT(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt); | 175 | if (nla_put(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt)) |
176 | goto nla_put_failure; | ||
175 | } | 177 | } |
176 | #endif | 178 | #endif |
177 | t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); | 179 | t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); |
178 | t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); | 180 | t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); |
179 | t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); | 181 | t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); |
180 | NLA_PUT(skb, TCA_GACT_TM, sizeof(t), &t); | 182 | if (nla_put(skb, TCA_GACT_TM, sizeof(t), &t)) |
183 | goto nla_put_failure; | ||
181 | return skb->len; | 184 | return skb->len; |
182 | 185 | ||
183 | nla_put_failure: | 186 | nla_put_failure: |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 60f8f616e8fa..0beba0e5312e 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -267,15 +267,17 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int | |||
267 | c.refcnt = ipt->tcf_refcnt - ref; | 267 | c.refcnt = ipt->tcf_refcnt - ref; |
268 | strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); | 268 | strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); |
269 | 269 | ||
270 | NLA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t); | 270 | if (nla_put(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t) || |
271 | NLA_PUT_U32(skb, TCA_IPT_INDEX, ipt->tcf_index); | 271 | nla_put_u32(skb, TCA_IPT_INDEX, ipt->tcf_index) || |
272 | NLA_PUT_U32(skb, TCA_IPT_HOOK, ipt->tcfi_hook); | 272 | nla_put_u32(skb, TCA_IPT_HOOK, ipt->tcfi_hook) || |
273 | NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c); | 273 | nla_put(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c) || |
274 | NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt->tcfi_tname); | 274 | nla_put_string(skb, TCA_IPT_TABLE, ipt->tcfi_tname)) |
275 | goto nla_put_failure; | ||
275 | tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); | 276 | tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); |
276 | tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse); | 277 | tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse); |
277 | tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires); | 278 | tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires); |
278 | NLA_PUT(skb, TCA_IPT_TM, sizeof (tm), &tm); | 279 | if (nla_put(skb, TCA_IPT_TM, sizeof (tm), &tm)) |
280 | goto nla_put_failure; | ||
279 | kfree(t); | 281 | kfree(t); |
280 | return skb->len; | 282 | return skb->len; |
281 | 283 | ||
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index e051398fdf6b..d583aea3b3df 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -227,11 +227,13 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, i | |||
227 | }; | 227 | }; |
228 | struct tcf_t t; | 228 | struct tcf_t t; |
229 | 229 | ||
230 | NLA_PUT(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt); | 230 | if (nla_put(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt)) |
231 | goto nla_put_failure; | ||
231 | t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install); | 232 | t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install); |
232 | t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse); | 233 | t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse); |
233 | t.expires = jiffies_to_clock_t(m->tcf_tm.expires); | 234 | t.expires = jiffies_to_clock_t(m->tcf_tm.expires); |
234 | NLA_PUT(skb, TCA_MIRRED_TM, sizeof(t), &t); | 235 | if (nla_put(skb, TCA_MIRRED_TM, sizeof(t), &t)) |
236 | goto nla_put_failure; | ||
235 | return skb->len; | 237 | return skb->len; |
236 | 238 | ||
237 | nla_put_failure: | 239 | nla_put_failure: |
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 001d1b354869..b5d029eb44f2 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c | |||
@@ -284,11 +284,13 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a, | |||
284 | }; | 284 | }; |
285 | struct tcf_t t; | 285 | struct tcf_t t; |
286 | 286 | ||
287 | NLA_PUT(skb, TCA_NAT_PARMS, sizeof(opt), &opt); | 287 | if (nla_put(skb, TCA_NAT_PARMS, sizeof(opt), &opt)) |
288 | goto nla_put_failure; | ||
288 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); | 289 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
289 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); | 290 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); |
290 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); | 291 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
291 | NLA_PUT(skb, TCA_NAT_TM, sizeof(t), &t); | 292 | if (nla_put(skb, TCA_NAT_TM, sizeof(t), &t)) |
293 | goto nla_put_failure; | ||
292 | 294 | ||
293 | return skb->len; | 295 | return skb->len; |
294 | 296 | ||
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 10d3aed86560..26aa2f6ce257 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -215,11 +215,13 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, | |||
215 | opt->refcnt = p->tcf_refcnt - ref; | 215 | opt->refcnt = p->tcf_refcnt - ref; |
216 | opt->bindcnt = p->tcf_bindcnt - bind; | 216 | opt->bindcnt = p->tcf_bindcnt - bind; |
217 | 217 | ||
218 | NLA_PUT(skb, TCA_PEDIT_PARMS, s, opt); | 218 | if (nla_put(skb, TCA_PEDIT_PARMS, s, opt)) |
219 | goto nla_put_failure; | ||
219 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); | 220 | t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); |
220 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); | 221 | t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); |
221 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); | 222 | t.expires = jiffies_to_clock_t(p->tcf_tm.expires); |
222 | NLA_PUT(skb, TCA_PEDIT_TM, sizeof(t), &t); | 223 | if (nla_put(skb, TCA_PEDIT_TM, sizeof(t), &t)) |
224 | goto nla_put_failure; | ||
223 | kfree(opt); | 225 | kfree(opt); |
224 | return skb->len; | 226 | return skb->len; |
225 | 227 | ||
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 6fb3f5af0f85..a9de23297d47 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -356,11 +356,14 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
356 | opt.rate = police->tcfp_R_tab->rate; | 356 | opt.rate = police->tcfp_R_tab->rate; |
357 | if (police->tcfp_P_tab) | 357 | if (police->tcfp_P_tab) |
358 | opt.peakrate = police->tcfp_P_tab->rate; | 358 | opt.peakrate = police->tcfp_P_tab->rate; |
359 | NLA_PUT(skb, TCA_POLICE_TBF, sizeof(opt), &opt); | 359 | if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt)) |
360 | if (police->tcfp_result) | 360 | goto nla_put_failure; |
361 | NLA_PUT_U32(skb, TCA_POLICE_RESULT, police->tcfp_result); | 361 | if (police->tcfp_result && |
362 | if (police->tcfp_ewma_rate) | 362 | nla_put_u32(skb, TCA_POLICE_RESULT, police->tcfp_result)) |
363 | NLA_PUT_U32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate); | 363 | goto nla_put_failure; |
364 | if (police->tcfp_ewma_rate && | ||
365 | nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate)) | ||
366 | goto nla_put_failure; | ||
364 | return skb->len; | 367 | return skb->len; |
365 | 368 | ||
366 | nla_put_failure: | 369 | nla_put_failure: |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 73e0a3ab4d55..3922f2a2821b 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -172,12 +172,14 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, | |||
172 | }; | 172 | }; |
173 | struct tcf_t t; | 173 | struct tcf_t t; |
174 | 174 | ||
175 | NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); | 175 | if (nla_put(skb, TCA_DEF_PARMS, sizeof(opt), &opt) || |
176 | NLA_PUT_STRING(skb, TCA_DEF_DATA, d->tcfd_defdata); | 176 | nla_put_string(skb, TCA_DEF_DATA, d->tcfd_defdata)) |
177 | goto nla_put_failure; | ||
177 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); | 178 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
178 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); | 179 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); |
179 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); | 180 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
180 | NLA_PUT(skb, TCA_DEF_TM, sizeof(t), &t); | 181 | if (nla_put(skb, TCA_DEF_TM, sizeof(t), &t)) |
182 | goto nla_put_failure; | ||
181 | return skb->len; | 183 | return skb->len; |
182 | 184 | ||
183 | nla_put_failure: | 185 | nla_put_failure: |
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 35dbbe91027e..476e0fac6712 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
@@ -166,20 +166,25 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a, | |||
166 | }; | 166 | }; |
167 | struct tcf_t t; | 167 | struct tcf_t t; |
168 | 168 | ||
169 | NLA_PUT(skb, TCA_SKBEDIT_PARMS, sizeof(opt), &opt); | 169 | if (nla_put(skb, TCA_SKBEDIT_PARMS, sizeof(opt), &opt)) |
170 | if (d->flags & SKBEDIT_F_PRIORITY) | 170 | goto nla_put_failure; |
171 | NLA_PUT(skb, TCA_SKBEDIT_PRIORITY, sizeof(d->priority), | 171 | if ((d->flags & SKBEDIT_F_PRIORITY) && |
172 | &d->priority); | 172 | nla_put(skb, TCA_SKBEDIT_PRIORITY, sizeof(d->priority), |
173 | if (d->flags & SKBEDIT_F_QUEUE_MAPPING) | 173 | &d->priority)) |
174 | NLA_PUT(skb, TCA_SKBEDIT_QUEUE_MAPPING, | 174 | goto nla_put_failure; |
175 | sizeof(d->queue_mapping), &d->queue_mapping); | 175 | if ((d->flags & SKBEDIT_F_QUEUE_MAPPING) && |
176 | if (d->flags & SKBEDIT_F_MARK) | 176 | nla_put(skb, TCA_SKBEDIT_QUEUE_MAPPING, |
177 | NLA_PUT(skb, TCA_SKBEDIT_MARK, sizeof(d->mark), | 177 | sizeof(d->queue_mapping), &d->queue_mapping)) |
178 | &d->mark); | 178 | goto nla_put_failure; |
179 | if ((d->flags & SKBEDIT_F_MARK) && | ||
180 | nla_put(skb, TCA_SKBEDIT_MARK, sizeof(d->mark), | ||
181 | &d->mark)) | ||
182 | goto nla_put_failure; | ||
179 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); | 183 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
180 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); | 184 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); |
181 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); | 185 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
182 | NLA_PUT(skb, TCA_SKBEDIT_TM, sizeof(t), &t); | 186 | if (nla_put(skb, TCA_SKBEDIT_TM, sizeof(t), &t)) |
187 | goto nla_put_failure; | ||
183 | return skb->len; | 188 | return skb->len; |
184 | 189 | ||
185 | nla_put_failure: | 190 | nla_put_failure: |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index a69d44f1dac5..f452f696b4b3 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -357,7 +357,8 @@ static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, | |||
357 | tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex; | 357 | tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex; |
358 | tcm->tcm_parent = tp->classid; | 358 | tcm->tcm_parent = tp->classid; |
359 | tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol); | 359 | tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol); |
360 | NLA_PUT_STRING(skb, TCA_KIND, tp->ops->kind); | 360 | if (nla_put_string(skb, TCA_KIND, tp->ops->kind)) |
361 | goto nla_put_failure; | ||
361 | tcm->tcm_handle = fh; | 362 | tcm->tcm_handle = fh; |
362 | if (RTM_DELTFILTER != event) { | 363 | if (RTM_DELTFILTER != event) { |
363 | tcm->tcm_handle = 0; | 364 | tcm->tcm_handle = 0; |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index ea1f70b5a5f4..590960a22a77 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -257,8 +257,9 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh, | |||
257 | if (nest == NULL) | 257 | if (nest == NULL) |
258 | goto nla_put_failure; | 258 | goto nla_put_failure; |
259 | 259 | ||
260 | if (f->res.classid) | 260 | if (f->res.classid && |
261 | NLA_PUT_U32(skb, TCA_BASIC_CLASSID, f->res.classid); | 261 | nla_put_u32(skb, TCA_BASIC_CLASSID, f->res.classid)) |
262 | goto nla_put_failure; | ||
262 | 263 | ||
263 | if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || | 264 | if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || |
264 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) | 265 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) |
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 1d8bd0dbcd1f..ccd08c8dc6a7 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -572,25 +572,32 @@ static int flow_dump(struct tcf_proto *tp, unsigned long fh, | |||
572 | if (nest == NULL) | 572 | if (nest == NULL) |
573 | goto nla_put_failure; | 573 | goto nla_put_failure; |
574 | 574 | ||
575 | NLA_PUT_U32(skb, TCA_FLOW_KEYS, f->keymask); | 575 | if (nla_put_u32(skb, TCA_FLOW_KEYS, f->keymask) || |
576 | NLA_PUT_U32(skb, TCA_FLOW_MODE, f->mode); | 576 | nla_put_u32(skb, TCA_FLOW_MODE, f->mode)) |
577 | goto nla_put_failure; | ||
577 | 578 | ||
578 | if (f->mask != ~0 || f->xor != 0) { | 579 | if (f->mask != ~0 || f->xor != 0) { |
579 | NLA_PUT_U32(skb, TCA_FLOW_MASK, f->mask); | 580 | if (nla_put_u32(skb, TCA_FLOW_MASK, f->mask) || |
580 | NLA_PUT_U32(skb, TCA_FLOW_XOR, f->xor); | 581 | nla_put_u32(skb, TCA_FLOW_XOR, f->xor)) |
582 | goto nla_put_failure; | ||
581 | } | 583 | } |
582 | if (f->rshift) | 584 | if (f->rshift && |
583 | NLA_PUT_U32(skb, TCA_FLOW_RSHIFT, f->rshift); | 585 | nla_put_u32(skb, TCA_FLOW_RSHIFT, f->rshift)) |
584 | if (f->addend) | 586 | goto nla_put_failure; |
585 | NLA_PUT_U32(skb, TCA_FLOW_ADDEND, f->addend); | 587 | if (f->addend && |
588 | nla_put_u32(skb, TCA_FLOW_ADDEND, f->addend)) | ||
589 | goto nla_put_failure; | ||
586 | 590 | ||
587 | if (f->divisor) | 591 | if (f->divisor && |
588 | NLA_PUT_U32(skb, TCA_FLOW_DIVISOR, f->divisor); | 592 | nla_put_u32(skb, TCA_FLOW_DIVISOR, f->divisor)) |
589 | if (f->baseclass) | 593 | goto nla_put_failure; |
590 | NLA_PUT_U32(skb, TCA_FLOW_BASECLASS, f->baseclass); | 594 | if (f->baseclass && |
595 | nla_put_u32(skb, TCA_FLOW_BASECLASS, f->baseclass)) | ||
596 | goto nla_put_failure; | ||
591 | 597 | ||
592 | if (f->perturb_period) | 598 | if (f->perturb_period && |
593 | NLA_PUT_U32(skb, TCA_FLOW_PERTURB, f->perturb_period / HZ); | 599 | nla_put_u32(skb, TCA_FLOW_PERTURB, f->perturb_period / HZ)) |
600 | goto nla_put_failure; | ||
594 | 601 | ||
595 | if (tcf_exts_dump(skb, &f->exts, &flow_ext_map) < 0) | 602 | if (tcf_exts_dump(skb, &f->exts, &flow_ext_map) < 0) |
596 | goto nla_put_failure; | 603 | goto nla_put_failure; |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 389af152ec45..8384a4797240 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -346,14 +346,17 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh, | |||
346 | if (nest == NULL) | 346 | if (nest == NULL) |
347 | goto nla_put_failure; | 347 | goto nla_put_failure; |
348 | 348 | ||
349 | if (f->res.classid) | 349 | if (f->res.classid && |
350 | NLA_PUT_U32(skb, TCA_FW_CLASSID, f->res.classid); | 350 | nla_put_u32(skb, TCA_FW_CLASSID, f->res.classid)) |
351 | goto nla_put_failure; | ||
351 | #ifdef CONFIG_NET_CLS_IND | 352 | #ifdef CONFIG_NET_CLS_IND |
352 | if (strlen(f->indev)) | 353 | if (strlen(f->indev) && |
353 | NLA_PUT_STRING(skb, TCA_FW_INDEV, f->indev); | 354 | nla_put_string(skb, TCA_FW_INDEV, f->indev)) |
355 | goto nla_put_failure; | ||
354 | #endif /* CONFIG_NET_CLS_IND */ | 356 | #endif /* CONFIG_NET_CLS_IND */ |
355 | if (head->mask != 0xFFFFFFFF) | 357 | if (head->mask != 0xFFFFFFFF && |
356 | NLA_PUT_U32(skb, TCA_FW_MASK, head->mask); | 358 | nla_put_u32(skb, TCA_FW_MASK, head->mask)) |
359 | goto nla_put_failure; | ||
357 | 360 | ||
358 | if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) | 361 | if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) |
359 | goto nla_put_failure; | 362 | goto nla_put_failure; |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 13ab66e9df58..36fec4227401 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -571,17 +571,21 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh, | |||
571 | 571 | ||
572 | if (!(f->handle & 0x8000)) { | 572 | if (!(f->handle & 0x8000)) { |
573 | id = f->id & 0xFF; | 573 | id = f->id & 0xFF; |
574 | NLA_PUT_U32(skb, TCA_ROUTE4_TO, id); | 574 | if (nla_put_u32(skb, TCA_ROUTE4_TO, id)) |
575 | goto nla_put_failure; | ||
575 | } | 576 | } |
576 | if (f->handle & 0x80000000) { | 577 | if (f->handle & 0x80000000) { |
577 | if ((f->handle >> 16) != 0xFFFF) | 578 | if ((f->handle >> 16) != 0xFFFF && |
578 | NLA_PUT_U32(skb, TCA_ROUTE4_IIF, f->iif); | 579 | nla_put_u32(skb, TCA_ROUTE4_IIF, f->iif)) |
580 | goto nla_put_failure; | ||
579 | } else { | 581 | } else { |
580 | id = f->id >> 16; | 582 | id = f->id >> 16; |
581 | NLA_PUT_U32(skb, TCA_ROUTE4_FROM, id); | 583 | if (nla_put_u32(skb, TCA_ROUTE4_FROM, id)) |
584 | goto nla_put_failure; | ||
582 | } | 585 | } |
583 | if (f->res.classid) | 586 | if (f->res.classid && |
584 | NLA_PUT_U32(skb, TCA_ROUTE4_CLASSID, f->res.classid); | 587 | nla_put_u32(skb, TCA_ROUTE4_CLASSID, f->res.classid)) |
588 | goto nla_put_failure; | ||
585 | 589 | ||
586 | if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) | 590 | if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) |
587 | goto nla_put_failure; | 591 | goto nla_put_failure; |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index b01427924f81..18ab93ec8d7e 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -615,18 +615,22 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh, | |||
615 | if (nest == NULL) | 615 | if (nest == NULL) |
616 | goto nla_put_failure; | 616 | goto nla_put_failure; |
617 | 617 | ||
618 | NLA_PUT(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst); | 618 | if (nla_put(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst)) |
619 | goto nla_put_failure; | ||
619 | pinfo.dpi = s->dpi; | 620 | pinfo.dpi = s->dpi; |
620 | pinfo.spi = f->spi; | 621 | pinfo.spi = f->spi; |
621 | pinfo.protocol = s->protocol; | 622 | pinfo.protocol = s->protocol; |
622 | pinfo.tunnelid = s->tunnelid; | 623 | pinfo.tunnelid = s->tunnelid; |
623 | pinfo.tunnelhdr = f->tunnelhdr; | 624 | pinfo.tunnelhdr = f->tunnelhdr; |
624 | pinfo.pad = 0; | 625 | pinfo.pad = 0; |
625 | NLA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); | 626 | if (nla_put(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo)) |
626 | if (f->res.classid) | 627 | goto nla_put_failure; |
627 | NLA_PUT_U32(skb, TCA_RSVP_CLASSID, f->res.classid); | 628 | if (f->res.classid && |
628 | if (((f->handle >> 8) & 0xFF) != 16) | 629 | nla_put_u32(skb, TCA_RSVP_CLASSID, f->res.classid)) |
629 | NLA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src); | 630 | goto nla_put_failure; |
631 | if (((f->handle >> 8) & 0xFF) != 16 && | ||
632 | nla_put(skb, TCA_RSVP_SRC, sizeof(f->src), f->src)) | ||
633 | goto nla_put_failure; | ||
630 | 634 | ||
631 | if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) | 635 | if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) |
632 | goto nla_put_failure; | 636 | goto nla_put_failure; |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index dbe199234c63..fe29420d0b0e 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -438,10 +438,11 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
438 | 438 | ||
439 | if (!fh) { | 439 | if (!fh) { |
440 | t->tcm_handle = ~0; /* whatever ... */ | 440 | t->tcm_handle = ~0; /* whatever ... */ |
441 | NLA_PUT_U32(skb, TCA_TCINDEX_HASH, p->hash); | 441 | if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) || |
442 | NLA_PUT_U16(skb, TCA_TCINDEX_MASK, p->mask); | 442 | nla_put_u16(skb, TCA_TCINDEX_MASK, p->mask) || |
443 | NLA_PUT_U32(skb, TCA_TCINDEX_SHIFT, p->shift); | 443 | nla_put_u32(skb, TCA_TCINDEX_SHIFT, p->shift) || |
444 | NLA_PUT_U32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through); | 444 | nla_put_u32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through)) |
445 | goto nla_put_failure; | ||
445 | nla_nest_end(skb, nest); | 446 | nla_nest_end(skb, nest); |
446 | } else { | 447 | } else { |
447 | if (p->perfect) { | 448 | if (p->perfect) { |
@@ -460,8 +461,9 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
460 | } | 461 | } |
461 | } | 462 | } |
462 | pr_debug("handle = %d\n", t->tcm_handle); | 463 | pr_debug("handle = %d\n", t->tcm_handle); |
463 | if (r->res.class) | 464 | if (r->res.class && |
464 | NLA_PUT_U32(skb, TCA_TCINDEX_CLASSID, r->res.classid); | 465 | nla_put_u32(skb, TCA_TCINDEX_CLASSID, r->res.classid)) |
466 | goto nla_put_failure; | ||
465 | 467 | ||
466 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) | 468 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) |
467 | goto nla_put_failure; | 469 | goto nla_put_failure; |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 939b627b4795..591b006a8c5a 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -733,36 +733,44 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | |||
733 | struct tc_u_hnode *ht = (struct tc_u_hnode *)fh; | 733 | struct tc_u_hnode *ht = (struct tc_u_hnode *)fh; |
734 | u32 divisor = ht->divisor + 1; | 734 | u32 divisor = ht->divisor + 1; |
735 | 735 | ||
736 | NLA_PUT_U32(skb, TCA_U32_DIVISOR, divisor); | 736 | if (nla_put_u32(skb, TCA_U32_DIVISOR, divisor)) |
737 | goto nla_put_failure; | ||
737 | } else { | 738 | } else { |
738 | NLA_PUT(skb, TCA_U32_SEL, | 739 | if (nla_put(skb, TCA_U32_SEL, |
739 | sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key), | 740 | sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key), |
740 | &n->sel); | 741 | &n->sel)) |
742 | goto nla_put_failure; | ||
741 | if (n->ht_up) { | 743 | if (n->ht_up) { |
742 | u32 htid = n->handle & 0xFFFFF000; | 744 | u32 htid = n->handle & 0xFFFFF000; |
743 | NLA_PUT_U32(skb, TCA_U32_HASH, htid); | 745 | if (nla_put_u32(skb, TCA_U32_HASH, htid)) |
746 | goto nla_put_failure; | ||
744 | } | 747 | } |
745 | if (n->res.classid) | 748 | if (n->res.classid && |
746 | NLA_PUT_U32(skb, TCA_U32_CLASSID, n->res.classid); | 749 | nla_put_u32(skb, TCA_U32_CLASSID, n->res.classid)) |
747 | if (n->ht_down) | 750 | goto nla_put_failure; |
748 | NLA_PUT_U32(skb, TCA_U32_LINK, n->ht_down->handle); | 751 | if (n->ht_down && |
752 | nla_put_u32(skb, TCA_U32_LINK, n->ht_down->handle)) | ||
753 | goto nla_put_failure; | ||
749 | 754 | ||
750 | #ifdef CONFIG_CLS_U32_MARK | 755 | #ifdef CONFIG_CLS_U32_MARK |
751 | if (n->mark.val || n->mark.mask) | 756 | if ((n->mark.val || n->mark.mask) && |
752 | NLA_PUT(skb, TCA_U32_MARK, sizeof(n->mark), &n->mark); | 757 | nla_put(skb, TCA_U32_MARK, sizeof(n->mark), &n->mark)) |
758 | goto nla_put_failure; | ||
753 | #endif | 759 | #endif |
754 | 760 | ||
755 | if (tcf_exts_dump(skb, &n->exts, &u32_ext_map) < 0) | 761 | if (tcf_exts_dump(skb, &n->exts, &u32_ext_map) < 0) |
756 | goto nla_put_failure; | 762 | goto nla_put_failure; |
757 | 763 | ||
758 | #ifdef CONFIG_NET_CLS_IND | 764 | #ifdef CONFIG_NET_CLS_IND |
759 | if (strlen(n->indev)) | 765 | if (strlen(n->indev) && |
760 | NLA_PUT_STRING(skb, TCA_U32_INDEV, n->indev); | 766 | nla_put_string(skb, TCA_U32_INDEV, n->indev)) |
767 | goto nla_put_failure; | ||
761 | #endif | 768 | #endif |
762 | #ifdef CONFIG_CLS_U32_PERF | 769 | #ifdef CONFIG_CLS_U32_PERF |
763 | NLA_PUT(skb, TCA_U32_PCNT, | 770 | if (nla_put(skb, TCA_U32_PCNT, |
764 | sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(u64), | 771 | sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(u64), |
765 | n->pf); | 772 | n->pf)) |
773 | goto nla_put_failure; | ||
766 | #endif | 774 | #endif |
767 | } | 775 | } |
768 | 776 | ||
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index 1363bf14e61b..4790c696cbce 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -585,8 +585,9 @@ static void meta_var_apply_extras(struct meta_value *v, | |||
585 | 585 | ||
586 | static int meta_var_dump(struct sk_buff *skb, struct meta_value *v, int tlv) | 586 | static int meta_var_dump(struct sk_buff *skb, struct meta_value *v, int tlv) |
587 | { | 587 | { |
588 | if (v->val && v->len) | 588 | if (v->val && v->len && |
589 | NLA_PUT(skb, tlv, v->len, (void *) v->val); | 589 | nla_put(skb, tlv, v->len, (void *) v->val)) |
590 | goto nla_put_failure; | ||
590 | return 0; | 591 | return 0; |
591 | 592 | ||
592 | nla_put_failure: | 593 | nla_put_failure: |
@@ -636,10 +637,13 @@ static void meta_int_apply_extras(struct meta_value *v, | |||
636 | 637 | ||
637 | static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv) | 638 | static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv) |
638 | { | 639 | { |
639 | if (v->len == sizeof(unsigned long)) | 640 | if (v->len == sizeof(unsigned long)) { |
640 | NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val); | 641 | if (nla_put(skb, tlv, sizeof(unsigned long), &v->val)) |
641 | else if (v->len == sizeof(u32)) | 642 | goto nla_put_failure; |
642 | NLA_PUT_U32(skb, tlv, v->val); | 643 | } else if (v->len == sizeof(u32)) { |
644 | if (nla_put_u32(skb, tlv, v->val)) | ||
645 | goto nla_put_failure; | ||
646 | } | ||
643 | 647 | ||
644 | return 0; | 648 | return 0; |
645 | 649 | ||
@@ -831,7 +835,8 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em) | |||
831 | memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left)); | 835 | memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left)); |
832 | memcpy(&hdr.right, &meta->rvalue.hdr, sizeof(hdr.right)); | 836 | memcpy(&hdr.right, &meta->rvalue.hdr, sizeof(hdr.right)); |
833 | 837 | ||
834 | NLA_PUT(skb, TCA_EM_META_HDR, sizeof(hdr), &hdr); | 838 | if (nla_put(skb, TCA_EM_META_HDR, sizeof(hdr), &hdr)) |
839 | goto nla_put_failure; | ||
835 | 840 | ||
836 | ops = meta_type_ops(&meta->lvalue); | 841 | ops = meta_type_ops(&meta->lvalue); |
837 | if (ops->dump(skb, &meta->lvalue, TCA_EM_META_LVALUE) < 0 || | 842 | if (ops->dump(skb, &meta->lvalue, TCA_EM_META_LVALUE) < 0 || |
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 88d93eb92507..aca233c2b848 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -441,7 +441,8 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | |||
441 | if (top_start == NULL) | 441 | if (top_start == NULL) |
442 | goto nla_put_failure; | 442 | goto nla_put_failure; |
443 | 443 | ||
444 | NLA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); | 444 | if (nla_put(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr)) |
445 | goto nla_put_failure; | ||
445 | 446 | ||
446 | list_start = nla_nest_start(skb, TCA_EMATCH_TREE_LIST); | 447 | list_start = nla_nest_start(skb, TCA_EMATCH_TREE_LIST); |
447 | if (list_start == NULL) | 448 | if (list_start == NULL) |
@@ -457,7 +458,8 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | |||
457 | .flags = em->flags | 458 | .flags = em->flags |
458 | }; | 459 | }; |
459 | 460 | ||
460 | NLA_PUT(skb, i + 1, sizeof(em_hdr), &em_hdr); | 461 | if (nla_put(skb, i + 1, sizeof(em_hdr), &em_hdr)) |
462 | goto nla_put_failure; | ||
461 | 463 | ||
462 | if (em->ops && em->ops->dump) { | 464 | if (em->ops && em->ops->dump) { |
463 | if (em->ops->dump(skb, em) < 0) | 465 | if (em->ops->dump(skb, em) < 0) |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 3d8981fde301..d2daefcc205f 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -426,7 +426,8 @@ static int qdisc_dump_stab(struct sk_buff *skb, struct qdisc_size_table *stab) | |||
426 | nest = nla_nest_start(skb, TCA_STAB); | 426 | nest = nla_nest_start(skb, TCA_STAB); |
427 | if (nest == NULL) | 427 | if (nest == NULL) |
428 | goto nla_put_failure; | 428 | goto nla_put_failure; |
429 | NLA_PUT(skb, TCA_STAB_BASE, sizeof(stab->szopts), &stab->szopts); | 429 | if (nla_put(skb, TCA_STAB_BASE, sizeof(stab->szopts), &stab->szopts)) |
430 | goto nla_put_failure; | ||
430 | nla_nest_end(skb, nest); | 431 | nla_nest_end(skb, nest); |
431 | 432 | ||
432 | return skb->len; | 433 | return skb->len; |
@@ -1201,7 +1202,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
1201 | tcm->tcm_parent = clid; | 1202 | tcm->tcm_parent = clid; |
1202 | tcm->tcm_handle = q->handle; | 1203 | tcm->tcm_handle = q->handle; |
1203 | tcm->tcm_info = atomic_read(&q->refcnt); | 1204 | tcm->tcm_info = atomic_read(&q->refcnt); |
1204 | NLA_PUT_STRING(skb, TCA_KIND, q->ops->id); | 1205 | if (nla_put_string(skb, TCA_KIND, q->ops->id)) |
1206 | goto nla_put_failure; | ||
1205 | if (q->ops->dump && q->ops->dump(q, skb) < 0) | 1207 | if (q->ops->dump && q->ops->dump(q, skb) < 0) |
1206 | goto nla_put_failure; | 1208 | goto nla_put_failure; |
1207 | q->qstats.qlen = q->q.qlen; | 1209 | q->qstats.qlen = q->q.qlen; |
@@ -1505,7 +1507,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1505 | tcm->tcm_parent = q->handle; | 1507 | tcm->tcm_parent = q->handle; |
1506 | tcm->tcm_handle = q->handle; | 1508 | tcm->tcm_handle = q->handle; |
1507 | tcm->tcm_info = 0; | 1509 | tcm->tcm_info = 0; |
1508 | NLA_PUT_STRING(skb, TCA_KIND, q->ops->id); | 1510 | if (nla_put_string(skb, TCA_KIND, q->ops->id)) |
1511 | goto nla_put_failure; | ||
1509 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) | 1512 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) |
1510 | goto nla_put_failure; | 1513 | goto nla_put_failure; |
1511 | 1514 | ||
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index e25e49061a0d..a77a4fbc069a 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -601,7 +601,8 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
601 | if (nest == NULL) | 601 | if (nest == NULL) |
602 | goto nla_put_failure; | 602 | goto nla_put_failure; |
603 | 603 | ||
604 | NLA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr); | 604 | if (nla_put(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr)) |
605 | goto nla_put_failure; | ||
605 | if (flow->vcc) { | 606 | if (flow->vcc) { |
606 | struct sockaddr_atmpvc pvc; | 607 | struct sockaddr_atmpvc pvc; |
607 | int state; | 608 | int state; |
@@ -610,15 +611,19 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
610 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; | 611 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; |
611 | pvc.sap_addr.vpi = flow->vcc->vpi; | 612 | pvc.sap_addr.vpi = flow->vcc->vpi; |
612 | pvc.sap_addr.vci = flow->vcc->vci; | 613 | pvc.sap_addr.vci = flow->vcc->vci; |
613 | NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc); | 614 | if (nla_put(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc)) |
615 | goto nla_put_failure; | ||
614 | state = ATM_VF2VS(flow->vcc->flags); | 616 | state = ATM_VF2VS(flow->vcc->flags); |
615 | NLA_PUT_U32(skb, TCA_ATM_STATE, state); | 617 | if (nla_put_u32(skb, TCA_ATM_STATE, state)) |
618 | goto nla_put_failure; | ||
619 | } | ||
620 | if (flow->excess) { | ||
621 | if (nla_put_u32(skb, TCA_ATM_EXCESS, flow->classid)) | ||
622 | goto nla_put_failure; | ||
623 | } else { | ||
624 | if (nla_put_u32(skb, TCA_ATM_EXCESS, 0)) | ||
625 | goto nla_put_failure; | ||
616 | } | 626 | } |
617 | if (flow->excess) | ||
618 | NLA_PUT_U32(skb, TCA_ATM_EXCESS, flow->classid); | ||
619 | else | ||
620 | NLA_PUT_U32(skb, TCA_ATM_EXCESS, 0); | ||
621 | |||
622 | nla_nest_end(skb, nest); | 627 | nla_nest_end(skb, nest); |
623 | return skb->len; | 628 | return skb->len; |
624 | 629 | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 24d94c097b35..6aabd77d1cfd 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1425,7 +1425,8 @@ static int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl) | |||
1425 | { | 1425 | { |
1426 | unsigned char *b = skb_tail_pointer(skb); | 1426 | unsigned char *b = skb_tail_pointer(skb); |
1427 | 1427 | ||
1428 | NLA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate); | 1428 | if (nla_put(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate)) |
1429 | goto nla_put_failure; | ||
1429 | return skb->len; | 1430 | return skb->len; |
1430 | 1431 | ||
1431 | nla_put_failure: | 1432 | nla_put_failure: |
@@ -1450,7 +1451,8 @@ static int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl) | |||
1450 | opt.minidle = (u32)(-cl->minidle); | 1451 | opt.minidle = (u32)(-cl->minidle); |
1451 | opt.offtime = cl->offtime; | 1452 | opt.offtime = cl->offtime; |
1452 | opt.change = ~0; | 1453 | opt.change = ~0; |
1453 | NLA_PUT(skb, TCA_CBQ_LSSOPT, sizeof(opt), &opt); | 1454 | if (nla_put(skb, TCA_CBQ_LSSOPT, sizeof(opt), &opt)) |
1455 | goto nla_put_failure; | ||
1454 | return skb->len; | 1456 | return skb->len; |
1455 | 1457 | ||
1456 | nla_put_failure: | 1458 | nla_put_failure: |
@@ -1468,7 +1470,8 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) | |||
1468 | opt.priority = cl->priority + 1; | 1470 | opt.priority = cl->priority + 1; |
1469 | opt.cpriority = cl->cpriority + 1; | 1471 | opt.cpriority = cl->cpriority + 1; |
1470 | opt.weight = cl->weight; | 1472 | opt.weight = cl->weight; |
1471 | NLA_PUT(skb, TCA_CBQ_WRROPT, sizeof(opt), &opt); | 1473 | if (nla_put(skb, TCA_CBQ_WRROPT, sizeof(opt), &opt)) |
1474 | goto nla_put_failure; | ||
1472 | return skb->len; | 1475 | return skb->len; |
1473 | 1476 | ||
1474 | nla_put_failure: | 1477 | nla_put_failure: |
@@ -1485,7 +1488,8 @@ static int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) | |||
1485 | opt.priority2 = cl->priority2 + 1; | 1488 | opt.priority2 = cl->priority2 + 1; |
1486 | opt.pad = 0; | 1489 | opt.pad = 0; |
1487 | opt.penalty = cl->penalty; | 1490 | opt.penalty = cl->penalty; |
1488 | NLA_PUT(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt); | 1491 | if (nla_put(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt)) |
1492 | goto nla_put_failure; | ||
1489 | return skb->len; | 1493 | return skb->len; |
1490 | 1494 | ||
1491 | nla_put_failure: | 1495 | nla_put_failure: |
@@ -1502,7 +1506,8 @@ static int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl) | |||
1502 | opt.split = cl->split ? cl->split->common.classid : 0; | 1506 | opt.split = cl->split ? cl->split->common.classid : 0; |
1503 | opt.defmap = cl->defmap; | 1507 | opt.defmap = cl->defmap; |
1504 | opt.defchange = ~0; | 1508 | opt.defchange = ~0; |
1505 | NLA_PUT(skb, TCA_CBQ_FOPT, sizeof(opt), &opt); | 1509 | if (nla_put(skb, TCA_CBQ_FOPT, sizeof(opt), &opt)) |
1510 | goto nla_put_failure; | ||
1506 | } | 1511 | } |
1507 | return skb->len; | 1512 | return skb->len; |
1508 | 1513 | ||
@@ -1521,7 +1526,8 @@ static int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) | |||
1521 | opt.police = cl->police; | 1526 | opt.police = cl->police; |
1522 | opt.__res1 = 0; | 1527 | opt.__res1 = 0; |
1523 | opt.__res2 = 0; | 1528 | opt.__res2 = 0; |
1524 | NLA_PUT(skb, TCA_CBQ_POLICE, sizeof(opt), &opt); | 1529 | if (nla_put(skb, TCA_CBQ_POLICE, sizeof(opt), &opt)) |
1530 | goto nla_put_failure; | ||
1525 | } | 1531 | } |
1526 | return skb->len; | 1532 | return skb->len; |
1527 | 1533 | ||
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index 7e267d7b9c75..81445cc8196f 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
@@ -515,8 +515,9 @@ static int choke_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
515 | if (opts == NULL) | 515 | if (opts == NULL) |
516 | goto nla_put_failure; | 516 | goto nla_put_failure; |
517 | 517 | ||
518 | NLA_PUT(skb, TCA_CHOKE_PARMS, sizeof(opt), &opt); | 518 | if (nla_put(skb, TCA_CHOKE_PARMS, sizeof(opt), &opt) || |
519 | NLA_PUT_U32(skb, TCA_CHOKE_MAX_P, q->parms.max_P); | 519 | nla_put_u32(skb, TCA_CHOKE_MAX_P, q->parms.max_P)) |
520 | goto nla_put_failure; | ||
520 | return nla_nest_end(skb, opts); | 521 | return nla_nest_end(skb, opts); |
521 | 522 | ||
522 | nla_put_failure: | 523 | nla_put_failure: |
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c index 6b7fe4a84f13..c2189879359b 100644 --- a/net/sched/sch_drr.c +++ b/net/sched/sch_drr.c | |||
@@ -260,7 +260,8 @@ static int drr_dump_class(struct Qdisc *sch, unsigned long arg, | |||
260 | nest = nla_nest_start(skb, TCA_OPTIONS); | 260 | nest = nla_nest_start(skb, TCA_OPTIONS); |
261 | if (nest == NULL) | 261 | if (nest == NULL) |
262 | goto nla_put_failure; | 262 | goto nla_put_failure; |
263 | NLA_PUT_U32(skb, TCA_DRR_QUANTUM, cl->quantum); | 263 | if (nla_put_u32(skb, TCA_DRR_QUANTUM, cl->quantum)) |
264 | goto nla_put_failure; | ||
264 | return nla_nest_end(skb, nest); | 265 | return nla_nest_end(skb, nest); |
265 | 266 | ||
266 | nla_put_failure: | 267 | nla_put_failure: |
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index 2c790204d042..389b856c6653 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -429,8 +429,9 @@ static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl, | |||
429 | opts = nla_nest_start(skb, TCA_OPTIONS); | 429 | opts = nla_nest_start(skb, TCA_OPTIONS); |
430 | if (opts == NULL) | 430 | if (opts == NULL) |
431 | goto nla_put_failure; | 431 | goto nla_put_failure; |
432 | NLA_PUT_U8(skb, TCA_DSMARK_MASK, p->mask[cl - 1]); | 432 | if (nla_put_u8(skb, TCA_DSMARK_MASK, p->mask[cl - 1]) || |
433 | NLA_PUT_U8(skb, TCA_DSMARK_VALUE, p->value[cl - 1]); | 433 | nla_put_u8(skb, TCA_DSMARK_VALUE, p->value[cl - 1])) |
434 | goto nla_put_failure; | ||
434 | 435 | ||
435 | return nla_nest_end(skb, opts); | 436 | return nla_nest_end(skb, opts); |
436 | 437 | ||
@@ -447,13 +448,16 @@ static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
447 | opts = nla_nest_start(skb, TCA_OPTIONS); | 448 | opts = nla_nest_start(skb, TCA_OPTIONS); |
448 | if (opts == NULL) | 449 | if (opts == NULL) |
449 | goto nla_put_failure; | 450 | goto nla_put_failure; |
450 | NLA_PUT_U16(skb, TCA_DSMARK_INDICES, p->indices); | 451 | if (nla_put_u16(skb, TCA_DSMARK_INDICES, p->indices)) |
452 | goto nla_put_failure; | ||
451 | 453 | ||
452 | if (p->default_index != NO_DEFAULT_INDEX) | 454 | if (p->default_index != NO_DEFAULT_INDEX && |
453 | NLA_PUT_U16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index); | 455 | nla_put_u16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index)) |
456 | goto nla_put_failure; | ||
454 | 457 | ||
455 | if (p->set_tc_index) | 458 | if (p->set_tc_index && |
456 | NLA_PUT_FLAG(skb, TCA_DSMARK_SET_TC_INDEX); | 459 | nla_put_flag(skb, TCA_DSMARK_SET_TC_INDEX)) |
460 | goto nla_put_failure; | ||
457 | 461 | ||
458 | return nla_nest_end(skb, opts); | 462 | return nla_nest_end(skb, opts); |
459 | 463 | ||
diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c index 66effe2da8e0..e15a9eb29087 100644 --- a/net/sched/sch_fifo.c +++ b/net/sched/sch_fifo.c | |||
@@ -85,7 +85,8 @@ static int fifo_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
85 | { | 85 | { |
86 | struct tc_fifo_qopt opt = { .limit = sch->limit }; | 86 | struct tc_fifo_qopt opt = { .limit = sch->limit }; |
87 | 87 | ||
88 | NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 88 | if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) |
89 | goto nla_put_failure; | ||
89 | return skb->len; | 90 | return skb->len; |
90 | 91 | ||
91 | nla_put_failure: | 92 | nla_put_failure: |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 67fc573e013a..0eb1202c22a6 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -512,7 +512,8 @@ static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) | |||
512 | struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; | 512 | struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; |
513 | 513 | ||
514 | memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); | 514 | memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); |
515 | NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 515 | if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) |
516 | goto nla_put_failure; | ||
516 | return skb->len; | 517 | return skb->len; |
517 | 518 | ||
518 | nla_put_failure: | 519 | nla_put_failure: |
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 0b15236be7b6..55e3310edc94 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
@@ -521,14 +521,16 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
521 | opts = nla_nest_start(skb, TCA_OPTIONS); | 521 | opts = nla_nest_start(skb, TCA_OPTIONS); |
522 | if (opts == NULL) | 522 | if (opts == NULL) |
523 | goto nla_put_failure; | 523 | goto nla_put_failure; |
524 | NLA_PUT(skb, TCA_GRED_DPS, sizeof(sopt), &sopt); | 524 | if (nla_put(skb, TCA_GRED_DPS, sizeof(sopt), &sopt)) |
525 | goto nla_put_failure; | ||
525 | 526 | ||
526 | for (i = 0; i < MAX_DPs; i++) { | 527 | for (i = 0; i < MAX_DPs; i++) { |
527 | struct gred_sched_data *q = table->tab[i]; | 528 | struct gred_sched_data *q = table->tab[i]; |
528 | 529 | ||
529 | max_p[i] = q ? q->parms.max_P : 0; | 530 | max_p[i] = q ? q->parms.max_P : 0; |
530 | } | 531 | } |
531 | NLA_PUT(skb, TCA_GRED_MAX_P, sizeof(max_p), max_p); | 532 | if (nla_put(skb, TCA_GRED_MAX_P, sizeof(max_p), max_p)) |
533 | goto nla_put_failure; | ||
532 | 534 | ||
533 | parms = nla_nest_start(skb, TCA_GRED_PARMS); | 535 | parms = nla_nest_start(skb, TCA_GRED_PARMS); |
534 | if (parms == NULL) | 536 | if (parms == NULL) |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 9bdca2e011e9..8db3e2c72827 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -1305,7 +1305,8 @@ hfsc_dump_sc(struct sk_buff *skb, int attr, struct internal_sc *sc) | |||
1305 | tsc.m1 = sm2m(sc->sm1); | 1305 | tsc.m1 = sm2m(sc->sm1); |
1306 | tsc.d = dx2d(sc->dx); | 1306 | tsc.d = dx2d(sc->dx); |
1307 | tsc.m2 = sm2m(sc->sm2); | 1307 | tsc.m2 = sm2m(sc->sm2); |
1308 | NLA_PUT(skb, attr, sizeof(tsc), &tsc); | 1308 | if (nla_put(skb, attr, sizeof(tsc), &tsc)) |
1309 | goto nla_put_failure; | ||
1309 | 1310 | ||
1310 | return skb->len; | 1311 | return skb->len; |
1311 | 1312 | ||
@@ -1573,7 +1574,8 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) | |||
1573 | } | 1574 | } |
1574 | 1575 | ||
1575 | qopt.defcls = q->defcls; | 1576 | qopt.defcls = q->defcls; |
1576 | NLA_PUT(skb, TCA_OPTIONS, sizeof(qopt), &qopt); | 1577 | if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt)) |
1578 | goto nla_put_failure; | ||
1577 | return skb->len; | 1579 | return skb->len; |
1578 | 1580 | ||
1579 | nla_put_failure: | 1581 | nla_put_failure: |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 29b942ce9e82..2ea6f196e3c8 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1051,7 +1051,8 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
1051 | nest = nla_nest_start(skb, TCA_OPTIONS); | 1051 | nest = nla_nest_start(skb, TCA_OPTIONS); |
1052 | if (nest == NULL) | 1052 | if (nest == NULL) |
1053 | goto nla_put_failure; | 1053 | goto nla_put_failure; |
1054 | NLA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt); | 1054 | if (nla_put(skb, TCA_HTB_INIT, sizeof(gopt), &gopt)) |
1055 | goto nla_put_failure; | ||
1055 | nla_nest_end(skb, nest); | 1056 | nla_nest_end(skb, nest); |
1056 | 1057 | ||
1057 | spin_unlock_bh(root_lock); | 1058 | spin_unlock_bh(root_lock); |
@@ -1090,7 +1091,8 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1090 | opt.quantum = cl->quantum; | 1091 | opt.quantum = cl->quantum; |
1091 | opt.prio = cl->prio; | 1092 | opt.prio = cl->prio; |
1092 | opt.level = cl->level; | 1093 | opt.level = cl->level; |
1093 | NLA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt); | 1094 | if (nla_put(skb, TCA_HTB_PARMS, sizeof(opt), &opt)) |
1095 | goto nla_put_failure; | ||
1094 | 1096 | ||
1095 | nla_nest_end(skb, nest); | 1097 | nla_nest_end(skb, nest); |
1096 | spin_unlock_bh(root_lock); | 1098 | spin_unlock_bh(root_lock); |
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 28de43092330..d1831ca966d4 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c | |||
@@ -247,7 +247,8 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
247 | opt.offset[i] = dev->tc_to_txq[i].offset; | 247 | opt.offset[i] = dev->tc_to_txq[i].offset; |
248 | } | 248 | } |
249 | 249 | ||
250 | NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 250 | if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) |
251 | goto nla_put_failure; | ||
251 | 252 | ||
252 | return skb->len; | 253 | return skb->len; |
253 | nla_put_failure: | 254 | nla_put_failure: |
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c index 49131d7a7446..2a2b096d9a66 100644 --- a/net/sched/sch_multiq.c +++ b/net/sched/sch_multiq.c | |||
@@ -284,7 +284,8 @@ static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
284 | opt.bands = q->bands; | 284 | opt.bands = q->bands; |
285 | opt.max_bands = q->max_bands; | 285 | opt.max_bands = q->max_bands; |
286 | 286 | ||
287 | NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 287 | if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) |
288 | goto nla_put_failure; | ||
288 | 289 | ||
289 | return skb->len; | 290 | return skb->len; |
290 | 291 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 5da548fa7ae9..110973145a4b 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -834,7 +834,8 @@ static int dump_loss_model(const struct netem_sched_data *q, | |||
834 | .p23 = q->clg.a5, | 834 | .p23 = q->clg.a5, |
835 | }; | 835 | }; |
836 | 836 | ||
837 | NLA_PUT(skb, NETEM_LOSS_GI, sizeof(gi), &gi); | 837 | if (nla_put(skb, NETEM_LOSS_GI, sizeof(gi), &gi)) |
838 | goto nla_put_failure; | ||
838 | break; | 839 | break; |
839 | } | 840 | } |
840 | case CLG_GILB_ELL: { | 841 | case CLG_GILB_ELL: { |
@@ -845,7 +846,8 @@ static int dump_loss_model(const struct netem_sched_data *q, | |||
845 | .k1 = q->clg.a4, | 846 | .k1 = q->clg.a4, |
846 | }; | 847 | }; |
847 | 848 | ||
848 | NLA_PUT(skb, NETEM_LOSS_GE, sizeof(ge), &ge); | 849 | if (nla_put(skb, NETEM_LOSS_GE, sizeof(ge), &ge)) |
850 | goto nla_put_failure; | ||
849 | break; | 851 | break; |
850 | } | 852 | } |
851 | } | 853 | } |
@@ -874,26 +876,31 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
874 | qopt.loss = q->loss; | 876 | qopt.loss = q->loss; |
875 | qopt.gap = q->gap; | 877 | qopt.gap = q->gap; |
876 | qopt.duplicate = q->duplicate; | 878 | qopt.duplicate = q->duplicate; |
877 | NLA_PUT(skb, TCA_OPTIONS, sizeof(qopt), &qopt); | 879 | if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt)) |
880 | goto nla_put_failure; | ||
878 | 881 | ||
879 | cor.delay_corr = q->delay_cor.rho; | 882 | cor.delay_corr = q->delay_cor.rho; |
880 | cor.loss_corr = q->loss_cor.rho; | 883 | cor.loss_corr = q->loss_cor.rho; |
881 | cor.dup_corr = q->dup_cor.rho; | 884 | cor.dup_corr = q->dup_cor.rho; |
882 | NLA_PUT(skb, TCA_NETEM_CORR, sizeof(cor), &cor); | 885 | if (nla_put(skb, TCA_NETEM_CORR, sizeof(cor), &cor)) |
886 | goto nla_put_failure; | ||
883 | 887 | ||
884 | reorder.probability = q->reorder; | 888 | reorder.probability = q->reorder; |
885 | reorder.correlation = q->reorder_cor.rho; | 889 | reorder.correlation = q->reorder_cor.rho; |
886 | NLA_PUT(skb, TCA_NETEM_REORDER, sizeof(reorder), &reorder); | 890 | if (nla_put(skb, TCA_NETEM_REORDER, sizeof(reorder), &reorder)) |
891 | goto nla_put_failure; | ||
887 | 892 | ||
888 | corrupt.probability = q->corrupt; | 893 | corrupt.probability = q->corrupt; |
889 | corrupt.correlation = q->corrupt_cor.rho; | 894 | corrupt.correlation = q->corrupt_cor.rho; |
890 | NLA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); | 895 | if (nla_put(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt)) |
896 | goto nla_put_failure; | ||
891 | 897 | ||
892 | rate.rate = q->rate; | 898 | rate.rate = q->rate; |
893 | rate.packet_overhead = q->packet_overhead; | 899 | rate.packet_overhead = q->packet_overhead; |
894 | rate.cell_size = q->cell_size; | 900 | rate.cell_size = q->cell_size; |
895 | rate.cell_overhead = q->cell_overhead; | 901 | rate.cell_overhead = q->cell_overhead; |
896 | NLA_PUT(skb, TCA_NETEM_RATE, sizeof(rate), &rate); | 902 | if (nla_put(skb, TCA_NETEM_RATE, sizeof(rate), &rate)) |
903 | goto nla_put_failure; | ||
897 | 904 | ||
898 | if (dump_loss_model(q, skb) != 0) | 905 | if (dump_loss_model(q, skb) != 0) |
899 | goto nla_put_failure; | 906 | goto nla_put_failure; |
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index b5d56a22b1d2..79359b69ad8d 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -247,7 +247,8 @@ static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
247 | opt.bands = q->bands; | 247 | opt.bands = q->bands; |
248 | memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX + 1); | 248 | memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX + 1); |
249 | 249 | ||
250 | NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 250 | if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) |
251 | goto nla_put_failure; | ||
251 | 252 | ||
252 | return skb->len; | 253 | return skb->len; |
253 | 254 | ||
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c index e68cb440756a..9af01f3df18c 100644 --- a/net/sched/sch_qfq.c +++ b/net/sched/sch_qfq.c | |||
@@ -429,8 +429,9 @@ static int qfq_dump_class(struct Qdisc *sch, unsigned long arg, | |||
429 | nest = nla_nest_start(skb, TCA_OPTIONS); | 429 | nest = nla_nest_start(skb, TCA_OPTIONS); |
430 | if (nest == NULL) | 430 | if (nest == NULL) |
431 | goto nla_put_failure; | 431 | goto nla_put_failure; |
432 | NLA_PUT_U32(skb, TCA_QFQ_WEIGHT, ONE_FP/cl->inv_w); | 432 | if (nla_put_u32(skb, TCA_QFQ_WEIGHT, ONE_FP/cl->inv_w) || |
433 | NLA_PUT_U32(skb, TCA_QFQ_LMAX, cl->lmax); | 433 | nla_put_u32(skb, TCA_QFQ_LMAX, cl->lmax)) |
434 | goto nla_put_failure; | ||
434 | return nla_nest_end(skb, nest); | 435 | return nla_nest_end(skb, nest); |
435 | 436 | ||
436 | nla_put_failure: | 437 | nla_put_failure: |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index a5cc3012cf42..633e32defdcc 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -272,8 +272,9 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
272 | opts = nla_nest_start(skb, TCA_OPTIONS); | 272 | opts = nla_nest_start(skb, TCA_OPTIONS); |
273 | if (opts == NULL) | 273 | if (opts == NULL) |
274 | goto nla_put_failure; | 274 | goto nla_put_failure; |
275 | NLA_PUT(skb, TCA_RED_PARMS, sizeof(opt), &opt); | 275 | if (nla_put(skb, TCA_RED_PARMS, sizeof(opt), &opt) || |
276 | NLA_PUT_U32(skb, TCA_RED_MAX_P, q->parms.max_P); | 276 | nla_put_u32(skb, TCA_RED_MAX_P, q->parms.max_P)) |
277 | goto nla_put_failure; | ||
277 | return nla_nest_end(skb, opts); | 278 | return nla_nest_end(skb, opts); |
278 | 279 | ||
279 | nla_put_failure: | 280 | nla_put_failure: |
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c index d7eea99333e9..74305c883bd3 100644 --- a/net/sched/sch_sfb.c +++ b/net/sched/sch_sfb.c | |||
@@ -570,7 +570,8 @@ static int sfb_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
570 | 570 | ||
571 | sch->qstats.backlog = q->qdisc->qstats.backlog; | 571 | sch->qstats.backlog = q->qdisc->qstats.backlog; |
572 | opts = nla_nest_start(skb, TCA_OPTIONS); | 572 | opts = nla_nest_start(skb, TCA_OPTIONS); |
573 | NLA_PUT(skb, TCA_SFB_PARMS, sizeof(opt), &opt); | 573 | if (nla_put(skb, TCA_SFB_PARMS, sizeof(opt), &opt)) |
574 | goto nla_put_failure; | ||
574 | return nla_nest_end(skb, opts); | 575 | return nla_nest_end(skb, opts); |
575 | 576 | ||
576 | nla_put_failure: | 577 | nla_put_failure: |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 02a21abea65e..d3a1bc26dbfc 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -812,7 +812,8 @@ static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
812 | memcpy(&opt.stats, &q->stats, sizeof(opt.stats)); | 812 | memcpy(&opt.stats, &q->stats, sizeof(opt.stats)); |
813 | opt.flags = q->flags; | 813 | opt.flags = q->flags; |
814 | 814 | ||
815 | NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 815 | if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) |
816 | goto nla_put_failure; | ||
816 | 817 | ||
817 | return skb->len; | 818 | return skb->len; |
818 | 819 | ||
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index b8e156319d7b..4b056c15e90c 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -359,7 +359,8 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
359 | memset(&opt.peakrate, 0, sizeof(opt.peakrate)); | 359 | memset(&opt.peakrate, 0, sizeof(opt.peakrate)); |
360 | opt.mtu = q->mtu; | 360 | opt.mtu = q->mtu; |
361 | opt.buffer = q->buffer; | 361 | opt.buffer = q->buffer; |
362 | NLA_PUT(skb, TCA_TBF_PARMS, sizeof(opt), &opt); | 362 | if (nla_put(skb, TCA_TBF_PARMS, sizeof(opt), &opt)) |
363 | goto nla_put_failure; | ||
363 | 364 | ||
364 | nla_nest_end(skb, nest); | 365 | nla_nest_end(skb, nest); |
365 | return skb->len; | 366 | return skb->len; |