Commit 075d6adf authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [PKT_SCHED]: Fix error handling while dumping actions
  [PKT_SCHED]: Return ENOENT if action module is unavailable
  [PKT_SCHED]: Fix illegal memory dereferences when dumping actions
parents e2a305ec 4fe683f5
...@@ -250,15 +250,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref) ...@@ -250,15 +250,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref)
RTA_PUT(skb, a->order, 0, NULL); RTA_PUT(skb, a->order, 0, NULL);
err = tcf_action_dump_1(skb, a, bind, ref); err = tcf_action_dump_1(skb, a, bind, ref);
if (err < 0) if (err < 0)
goto rtattr_failure; goto errout;
r->rta_len = skb->tail - (u8*)r; r->rta_len = skb->tail - (u8*)r;
} }
return 0; return 0;
rtattr_failure: rtattr_failure:
err = -EINVAL;
errout:
skb_trim(skb, b - skb->data); skb_trim(skb, b - skb->data);
return -err; return err;
} }
struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
...@@ -305,6 +307,7 @@ struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, ...@@ -305,6 +307,7 @@ struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
goto err_mod; goto err_mod;
} }
#endif #endif
*err = -ENOENT;
goto err_out; goto err_out;
} }
...@@ -776,7 +779,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) ...@@ -776,7 +779,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
return ret; return ret;
} }
static char * static struct rtattr *
find_dump_kind(struct nlmsghdr *n) find_dump_kind(struct nlmsghdr *n)
{ {
struct rtattr *tb1, *tb2[TCA_ACT_MAX+1]; struct rtattr *tb1, *tb2[TCA_ACT_MAX+1];
...@@ -804,7 +807,7 @@ find_dump_kind(struct nlmsghdr *n) ...@@ -804,7 +807,7 @@ find_dump_kind(struct nlmsghdr *n)
return NULL; return NULL;
kind = tb2[TCA_ACT_KIND-1]; kind = tb2[TCA_ACT_KIND-1];
return (char *) RTA_DATA(kind); return kind;
} }
static int static int
...@@ -817,16 +820,15 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -817,16 +820,15 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
struct tc_action a; struct tc_action a;
int ret = 0; int ret = 0;
struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh); struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
char *kind = find_dump_kind(cb->nlh); struct rtattr *kind = find_dump_kind(cb->nlh);
if (kind == NULL) { if (kind == NULL) {
printk("tc_dump_action: action bad kind\n"); printk("tc_dump_action: action bad kind\n");
return 0; return 0;
} }
a_o = tc_lookup_action_n(kind); a_o = tc_lookup_action(kind);
if (a_o == NULL) { if (a_o == NULL) {
printk("failed to find %s\n", kind);
return 0; return 0;
} }
...@@ -834,7 +836,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -834,7 +836,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
a.ops = a_o; a.ops = a_o;
if (a_o->walk == NULL) { if (a_o->walk == NULL) {
printk("tc_dump_action: %s !capable of dumping table\n", kind); printk("tc_dump_action: %s !capable of dumping table\n", a_o->kind);
goto rtattr_failure; goto rtattr_failure;
} }
......
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