From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>, Thomas Graf <tgraf@suug.ch>
Cc: netdev@vger.kernel.org
Subject: [PATCH] tc: oops in em_meta
Date: Fri, 25 Jan 2008 15:00:57 -0800 [thread overview]
Message-ID: <20080125150057.41776614@deepthought> (raw)
If userspace passes a unknown match index into em_meta, then em_meta_change
will return an error and the data for the match will not be set. This then
causes an null pointer dereference when the cleanup is done in the error
path via tcf_em_tree_destroy. Since the tree structure comes kzalloc,
it is initialized to NULL.
Discovered when testing a new version of tc command against an accidental
older kernel.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
Patch against net-2.6.25 tree, should be backported to earlier
stable kernels as well.
--- a/net/sched/em_meta.c 2008-01-25 14:52:08.000000000 -0800
+++ b/net/sched/em_meta.c 2008-01-25 14:52:26.000000000 -0800
@@ -735,11 +735,13 @@ static int em_meta_match(struct sk_buff
static inline void meta_delete(struct meta_match *meta)
{
- struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
+ if (meta) {
+ struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
- if (ops && ops->destroy) {
- ops->destroy(&meta->lvalue);
- ops->destroy(&meta->rvalue);
+ if (ops && ops->destroy) {
+ ops->destroy(&meta->lvalue);
+ ops->destroy(&meta->rvalue);
+ }
}
kfree(meta);
reply other threads:[~2008-01-25 23:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080125150057.41776614@deepthought \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--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).