Commit 785ce914 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[PKT_SCHED]: act_api.c: remove checks for impossible conditions

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76d2d42c
...@@ -191,26 +191,18 @@ void tcf_action_destroy(struct tc_action *act, int bind) ...@@ -191,26 +191,18 @@ void tcf_action_destroy(struct tc_action *act, int bind)
{ {
struct tc_action *a; struct tc_action *a;
for (a = act; act; a = act) { for (a = act; a; a = act) {
if (a && a->ops && a->ops->cleanup) { if (a->ops && a->ops->cleanup) {
DPRINTK("tcf_action_destroy destroying %p next %p\n", DPRINTK("tcf_action_destroy destroying %p next %p\n",
a, a->next ? a->next : NULL); a, a->next);
act = act->next;
if (a->ops->cleanup(a, bind) == ACT_P_DELETED) if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
module_put(a->ops->owner); module_put(a->ops->owner);
act = act->next;
a->ops = NULL;
kfree(a); kfree(a);
} else { /*FIXME: Remove later - catch insertion bugs*/ } else { /*FIXME: Remove later - catch insertion bugs*/
printk("tcf_action_destroy: BUG? destroying NULL ops\n"); printk("tcf_action_destroy: BUG? destroying NULL ops\n");
if (a) { act = act->next;
act = act->next; kfree(a);
kfree(a);
} else {
printk("tcf_action_destroy: BUG? destroying "
"NULL action!\n");
break;
}
} }
} }
} }
...@@ -220,7 +212,7 @@ tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref) ...@@ -220,7 +212,7 @@ tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
{ {
int err = -EINVAL; int err = -EINVAL;
if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL)) if (a->ops == NULL || a->ops->dump == NULL)
return err; return err;
return a->ops->dump(skb, a, bind, ref); return a->ops->dump(skb, a, bind, ref);
} }
...@@ -232,8 +224,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) ...@@ -232,8 +224,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct rtattr *r; struct rtattr *r;
if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL) || if (a->ops == NULL || a->ops->dump == NULL)
(a->ops->kind == NULL))
return err; return err;
RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
...@@ -563,14 +554,9 @@ static void cleanup_a(struct tc_action *act) ...@@ -563,14 +554,9 @@ static void cleanup_a(struct tc_action *act)
{ {
struct tc_action *a; struct tc_action *a;
for (a = act; act; a = act) { for (a = act; a; a = act) {
if (a) { act = a->next;
act = act->next; kfree(a);
a->ops = NULL;
a->priv = NULL;
kfree(a);
} else
printk("cleanup_a: BUG? empty action\n");
} }
} }
...@@ -715,7 +701,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event) ...@@ -715,7 +701,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)
if (tb[i] == NULL) if (tb[i] == NULL)
break; break;
act = create_a(i+1); act = create_a(i+1);
if (a != NULL && a != act) { if (a != NULL) {
a->next = act; a->next = act;
a = act; a = act;
} else } else
...@@ -826,14 +812,9 @@ tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr) ...@@ -826,14 +812,9 @@ tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr)
* stays intact * stays intact
* */ * */
ret = tcf_add_notify(act, pid, seq, RTM_NEWACTION, n->nlmsg_flags); ret = tcf_add_notify(act, pid, seq, RTM_NEWACTION, n->nlmsg_flags);
for (a = act; act; a = act) { for (a = act; a; a = act) {
if (a) { act = a->next;
act = act->next; kfree(a);
a->ops = NULL;
a->priv = NULL;
kfree(a);
} else
printk("tcf_action_add: BUG? empty action\n");
} }
done: done:
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment