diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-11-07 15:31:14 +0100 |
---|---|---|
committer | Adrian Bunk <bunk@stusta.de> | 2006-11-07 15:31:14 +0100 |
commit | f6dde50d9deb831fdc89f06cc453c5cb87669972 (patch) | |
tree | 59f8b910bc0384e6614e1451dd79e79a00ee43fe | |
parent | 118d32a5f209230c66a3b7d3874d1d5846ceb630 (diff) |
PKT_SCHED: Fix illegal memory dereferences when dumping actions
The TCA_ACT_KIND attribute is used without checking its
availability when dumping actions therefore leading to a
value of 0x4 being dereferenced.
The use of strcmp() in tc_lookup_action_n() isn't safe
when fed with string from an attribute without enforcing
proper NUL termination.
Both bugs can be triggered with malformed netlink message
and don't require any privileges.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
-rw-r--r-- | net/sched/act_api.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 4a1d29be0f5..073b597879e 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -779,7 +779,7 @@ replay: return ret; } -static char * +static struct rtattr * find_dump_kind(struct nlmsghdr *n) { struct rtattr *tb1, *tb2[TCA_ACT_MAX+1]; @@ -807,7 +807,7 @@ find_dump_kind(struct nlmsghdr *n) return NULL; kind = tb2[TCA_ACT_KIND-1]; - return (char *) RTA_DATA(kind); + return kind; } static int @@ -820,16 +820,15 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) struct tc_action a; int ret = 0; 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) { printk("tc_dump_action: action bad kind\n"); return 0; } - a_o = tc_lookup_action_n(kind); + a_o = tc_lookup_action(kind); if (a_o == NULL) { - printk("failed to find %s\n", kind); return 0; } @@ -837,7 +836,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) a.ops = a_o; 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; } |