diff options
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r-- | net/sched/cls_api.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 5fd0c28ef79a..bb2c523f8158 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -85,7 +85,7 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | |||
85 | int rc = -ENOENT; | 85 | int rc = -ENOENT; |
86 | 86 | ||
87 | write_lock(&cls_mod_lock); | 87 | write_lock(&cls_mod_lock); |
88 | for (tp = &tcf_proto_base; (t=*tp) != NULL; tp = &t->next) | 88 | for (tp = &tcf_proto_base; (t = *tp) != NULL; tp = &t->next) |
89 | if (t == ops) | 89 | if (t == ops) |
90 | break; | 90 | break; |
91 | 91 | ||
@@ -111,7 +111,7 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp) | |||
111 | u32 first = TC_H_MAKE(0xC0000000U, 0U); | 111 | u32 first = TC_H_MAKE(0xC0000000U, 0U); |
112 | 112 | ||
113 | if (tp) | 113 | if (tp) |
114 | first = tp->prio-1; | 114 | first = tp->prio - 1; |
115 | 115 | ||
116 | return first; | 116 | return first; |
117 | } | 117 | } |
@@ -149,7 +149,8 @@ replay: | |||
149 | 149 | ||
150 | if (prio == 0) { | 150 | if (prio == 0) { |
151 | /* If no priority is given, user wants we allocated it. */ | 151 | /* If no priority is given, user wants we allocated it. */ |
152 | if (n->nlmsg_type != RTM_NEWTFILTER || !(n->nlmsg_flags&NLM_F_CREATE)) | 152 | if (n->nlmsg_type != RTM_NEWTFILTER || |
153 | !(n->nlmsg_flags & NLM_F_CREATE)) | ||
153 | return -ENOENT; | 154 | return -ENOENT; |
154 | prio = TC_H_MAKE(0x80000000U, 0U); | 155 | prio = TC_H_MAKE(0x80000000U, 0U); |
155 | } | 156 | } |
@@ -176,7 +177,8 @@ replay: | |||
176 | } | 177 | } |
177 | 178 | ||
178 | /* Is it classful? */ | 179 | /* Is it classful? */ |
179 | if ((cops = q->ops->cl_ops) == NULL) | 180 | cops = q->ops->cl_ops; |
181 | if (!cops) | ||
180 | return -EINVAL; | 182 | return -EINVAL; |
181 | 183 | ||
182 | if (cops->tcf_chain == NULL) | 184 | if (cops->tcf_chain == NULL) |
@@ -196,10 +198,11 @@ replay: | |||
196 | goto errout; | 198 | goto errout; |
197 | 199 | ||
198 | /* Check the chain for existence of proto-tcf with this priority */ | 200 | /* Check the chain for existence of proto-tcf with this priority */ |
199 | for (back = chain; (tp=*back) != NULL; back = &tp->next) { | 201 | for (back = chain; (tp = *back) != NULL; back = &tp->next) { |
200 | if (tp->prio >= prio) { | 202 | if (tp->prio >= prio) { |
201 | if (tp->prio == prio) { | 203 | if (tp->prio == prio) { |
202 | if (!nprio || (tp->protocol != protocol && protocol)) | 204 | if (!nprio || |
205 | (tp->protocol != protocol && protocol)) | ||
203 | goto errout; | 206 | goto errout; |
204 | } else | 207 | } else |
205 | tp = NULL; | 208 | tp = NULL; |
@@ -216,7 +219,8 @@ replay: | |||
216 | goto errout; | 219 | goto errout; |
217 | 220 | ||
218 | err = -ENOENT; | 221 | err = -ENOENT; |
219 | if (n->nlmsg_type != RTM_NEWTFILTER || !(n->nlmsg_flags&NLM_F_CREATE)) | 222 | if (n->nlmsg_type != RTM_NEWTFILTER || |
223 | !(n->nlmsg_flags & NLM_F_CREATE)) | ||
220 | goto errout; | 224 | goto errout; |
221 | 225 | ||
222 | 226 | ||
@@ -420,7 +424,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
420 | 424 | ||
421 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 425 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) |
422 | return skb->len; | 426 | return skb->len; |
423 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) | 427 | dev = __dev_get_by_index(net, tcm->tcm_ifindex); |
428 | if (!dev) | ||
424 | return skb->len; | 429 | return skb->len; |
425 | 430 | ||
426 | if (!tcm->tcm_parent) | 431 | if (!tcm->tcm_parent) |
@@ -429,7 +434,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
429 | q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent)); | 434 | q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent)); |
430 | if (!q) | 435 | if (!q) |
431 | goto out; | 436 | goto out; |
432 | if ((cops = q->ops->cl_ops) == NULL) | 437 | cops = q->ops->cl_ops; |
438 | if (!cops) | ||
433 | goto errout; | 439 | goto errout; |
434 | if (cops->tcf_chain == NULL) | 440 | if (cops->tcf_chain == NULL) |
435 | goto errout; | 441 | goto errout; |
@@ -444,8 +450,9 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
444 | 450 | ||
445 | s_t = cb->args[0]; | 451 | s_t = cb->args[0]; |
446 | 452 | ||
447 | for (tp=*chain, t=0; tp; tp = tp->next, t++) { | 453 | for (tp = *chain, t = 0; tp; tp = tp->next, t++) { |
448 | if (t < s_t) continue; | 454 | if (t < s_t) |
455 | continue; | ||
449 | if (TC_H_MAJ(tcm->tcm_info) && | 456 | if (TC_H_MAJ(tcm->tcm_info) && |
450 | TC_H_MAJ(tcm->tcm_info) != tp->prio) | 457 | TC_H_MAJ(tcm->tcm_info) != tp->prio) |
451 | continue; | 458 | continue; |
@@ -468,10 +475,10 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
468 | arg.skb = skb; | 475 | arg.skb = skb; |
469 | arg.cb = cb; | 476 | arg.cb = cb; |
470 | arg.w.stop = 0; | 477 | arg.w.stop = 0; |
471 | arg.w.skip = cb->args[1]-1; | 478 | arg.w.skip = cb->args[1] - 1; |
472 | arg.w.count = 0; | 479 | arg.w.count = 0; |
473 | tp->ops->walk(tp, &arg.w); | 480 | tp->ops->walk(tp, &arg.w); |
474 | cb->args[1] = arg.w.count+1; | 481 | cb->args[1] = arg.w.count + 1; |
475 | if (arg.w.stop) | 482 | if (arg.w.stop) |
476 | break; | 483 | break; |
477 | } | 484 | } |