aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_skbedit.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-03-29 05:11:39 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-01 18:11:37 -0400
commit1b34ec43c9b3de44a5420841ab293d1b2035a94c (patch)
tree8d6cf966c813e0e61001655179b5ef8e5f1b54b3 /net/sched/act_skbedit.c
parent9360ffd1859720f6520cf59241909b74dae369d0 (diff)
pkt_sched: Stop using NLA_PUT*().
These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_skbedit.c')
-rw-r--r--net/sched/act_skbedit.c27
1 files changed, 16 insertions, 11 deletions
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
185nla_put_failure: 190nla_put_failure: