From: Patrick McHardy <kaber@trash.net>
To: Thomas Graf <tgraf@suug.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org, hadi@cyberus.ca
Subject: Re: [PATCH 1/3] [PKT_SCHED]: Fix illegal memory dereferences when dumping actions
Date: Wed, 05 Jul 2006 01:42:46 +0200 [thread overview]
Message-ID: <44AAFCF6.9000706@trash.net> (raw)
In-Reply-To: <20060704220549.952720000@postel.suug.ch>
Thomas Graf wrote:
> 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>
>
> Index: net-2.6.git/net/sched/act_api.c
> ===================================================================
> --- net-2.6.git.orig/net/sched/act_api.c
> +++ net-2.6.git/net/sched/act_api.c
> @@ -776,7 +776,7 @@ replay:
> return ret;
> }
>
> -static char *
> +static struct rtattr *
> find_dump_kind(struct nlmsghdr *n)
> {
> struct rtattr *tb1, *tb2[TCA_ACT_MAX+1];
> @@ -804,7 +804,7 @@ find_dump_kind(struct nlmsghdr *n)
> return NULL;
> kind = tb2[TCA_ACT_KIND-1];
>
> - return (char *) RTA_DATA(kind);
> + return kind;
> }
>
> static int
> @@ -817,16 +817,15 @@ tc_dump_action(struct sk_buff *skb, stru
> 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;
> }
>
> @@ -834,7 +833,7 @@ tc_dump_action(struct sk_buff *skb, stru
> 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;
> }
Can't we just get rid of these printks? This seems like a good
opportunity.
next prev parent reply other threads:[~2006-07-04 23:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-04 22:05 [PATCH 0/3] Action API fixes Thomas Graf
2006-07-04 22:00 ` [PATCH 1/3] [PKT_SCHED]: Fix illegal memory dereferences when dumping actions Thomas Graf
2006-07-04 23:42 ` Patrick McHardy [this message]
2006-07-05 1:49 ` jamal
2006-07-05 9:09 ` Thomas Graf
2006-07-05 1:34 ` jamal
2006-07-04 22:00 ` [PATCH 2/3] [PKT_SCHED]: Return ENOENT if action module is unavailable Thomas Graf
2006-07-05 1:40 ` jamal
2006-07-04 22:00 ` [PATCH 3/3] [PKT_SCHED]: Fix error handling while dumping actions Thomas Graf
2006-07-05 1:47 ` jamal
2006-07-05 13:35 ` jamal
2006-07-05 13:54 ` Thomas Graf
2006-07-05 14:00 ` jamal
2006-07-06 3:47 ` [PATCH 0/3] Action API fixes David Miller
2006-07-06 12:03 ` jamal
2006-07-06 12:27 ` jamal
2006-07-06 12:45 ` Thomas Graf
2006-07-06 12:53 ` jamal
2006-07-07 6:56 ` David Miller
2006-07-07 6:54 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44AAFCF6.9000706@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=netdev@vger.kernel.org \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).