aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-02-07 21:13:00 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-07 21:13:00 -0500
commit04f217aca4d803fe72c2c54fe460d68f5233ce52 (patch)
treea272e05b77afa50d868b08ce79daa22808aeef01 /net/sched
parent4e881a217bd1403960eb8f32297ba9d226c6d5ae (diff)
[TC]: oops in em_meta
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/em_meta.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index 2a7e648fbcf4..d417ec8e3ca3 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -735,11 +735,13 @@ static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m,
735 735
736static inline void meta_delete(struct meta_match *meta) 736static inline void meta_delete(struct meta_match *meta)
737{ 737{
738 struct meta_type_ops *ops = meta_type_ops(&meta->lvalue); 738 if (meta) {
739 struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
739 740
740 if (ops && ops->destroy) { 741 if (ops && ops->destroy) {
741 ops->destroy(&meta->lvalue); 742 ops->destroy(&meta->lvalue);
742 ops->destroy(&meta->rvalue); 743 ops->destroy(&meta->rvalue);
744 }
743 } 745 }
744 746
745 kfree(meta); 747 kfree(meta);