aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/ematch.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2014-10-06 00:27:53 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-06 18:02:32 -0400
commit82a470f1119eb7d2e4941b915bf9cd6fd8d54494 (patch)
treed16362829e33070f8367876205659fbf271ecfc2 /net/sched/ematch.c
parentfcbeb976d7ce783fd58e63e61c196d9a8912b3be (diff)
net: sched: remove tcf_proto from ematch calls
This removes the tcf_proto argument from the ematch code paths that only need it to reference the net namespace. This allows simplifying qdisc code paths especially when we need to tear down the ematch from an RCU callback. In this case we can not guarentee that the tcf_proto structure is still valid. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Acked-by: Cong Wang <cwang@twopensource.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/ematch.c')
-rw-r--r--net/sched/ematch.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index ad57f4444b9c..8250c36543d8 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -178,6 +178,7 @@ static int tcf_em_validate(struct tcf_proto *tp,
178 struct tcf_ematch_hdr *em_hdr = nla_data(nla); 178 struct tcf_ematch_hdr *em_hdr = nla_data(nla);
179 int data_len = nla_len(nla) - sizeof(*em_hdr); 179 int data_len = nla_len(nla) - sizeof(*em_hdr);
180 void *data = (void *) em_hdr + sizeof(*em_hdr); 180 void *data = (void *) em_hdr + sizeof(*em_hdr);
181 struct net *net = dev_net(qdisc_dev(tp->q));
181 182
182 if (!TCF_EM_REL_VALID(em_hdr->flags)) 183 if (!TCF_EM_REL_VALID(em_hdr->flags))
183 goto errout; 184 goto errout;
@@ -240,7 +241,7 @@ static int tcf_em_validate(struct tcf_proto *tp,
240 goto errout; 241 goto errout;
241 242
242 if (em->ops->change) { 243 if (em->ops->change) {
243 err = em->ops->change(tp, data, data_len, em); 244 err = em->ops->change(net, data, data_len, em);
244 if (err < 0) 245 if (err < 0)
245 goto errout; 246 goto errout;
246 } else if (data_len > 0) { 247 } else if (data_len > 0) {
@@ -271,6 +272,7 @@ static int tcf_em_validate(struct tcf_proto *tp,
271 em->matchid = em_hdr->matchid; 272 em->matchid = em_hdr->matchid;
272 em->flags = em_hdr->flags; 273 em->flags = em_hdr->flags;
273 em->datalen = data_len; 274 em->datalen = data_len;
275 em->net = net;
274 276
275 err = 0; 277 err = 0;
276errout: 278errout:
@@ -378,7 +380,7 @@ errout:
378 return err; 380 return err;
379 381
380errout_abort: 382errout_abort:
381 tcf_em_tree_destroy(tp, tree); 383 tcf_em_tree_destroy(tree);
382 return err; 384 return err;
383} 385}
384EXPORT_SYMBOL(tcf_em_tree_validate); 386EXPORT_SYMBOL(tcf_em_tree_validate);
@@ -393,7 +395,7 @@ EXPORT_SYMBOL(tcf_em_tree_validate);
393 * tcf_em_tree_validate()/tcf_em_tree_change(). You must ensure that 395 * tcf_em_tree_validate()/tcf_em_tree_change(). You must ensure that
394 * the ematch tree is not in use before calling this function. 396 * the ematch tree is not in use before calling this function.
395 */ 397 */
396void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) 398void tcf_em_tree_destroy(struct tcf_ematch_tree *tree)
397{ 399{
398 int i; 400 int i;
399 401
@@ -405,7 +407,7 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree)
405 407
406 if (em->ops) { 408 if (em->ops) {
407 if (em->ops->destroy) 409 if (em->ops->destroy)
408 em->ops->destroy(tp, em); 410 em->ops->destroy(em);
409 else if (!tcf_em_is_simple(em)) 411 else if (!tcf_em_is_simple(em))
410 kfree((void *) em->data); 412 kfree((void *) em->data);
411 module_put(em->ops->owner); 413 module_put(em->ops->owner);