projects
/
cascardo
/
ovs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cffabec
)
datapath: Fix buffer overrun in mask array realloc.
author
Pravin B Shelar
<pshelar@nicira.com>
Fri, 25 Jul 2014 23:22:46 +0000
(16:22 -0700)
committer
Pravin B Shelar
<pshelar@nicira.com>
Fri, 25 Jul 2014 23:40:20 +0000
(16:40 -0700)
mask realloc copies elements from old array to new array. When
shrinking array it can go beyond allocated memory.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
datapath/flow_table.c
patch
|
blob
|
history
diff --git
a/datapath/flow_table.c
b/datapath/flow_table.c
index
765930e
..
21f67bf
100644
(file)
--- a/
datapath/flow_table.c
+++ b/
datapath/flow_table.c
@@
-247,9
+247,10
@@
static int tbl_mask_array_realloc(struct flow_table *tbl, int size)
if (old) {
int i;
- for (i = 0; i <
old->max
; i++)
+ for (i = 0; i <
min(old->max, new->max)
; i++)
new->masks[i] = old->masks[i];
+ BUG_ON(old->count > new->max);
new->count = old->count;
}
rcu_assign_pointer(tbl->mask_array, new);