projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
24d7bb3
)
[PATCH] bridge: fix possible overflow in get_fdb_entries
author
Chris Wright
<
[email protected]
>
Mon, 20 Nov 2006 23:02:49 +0000
(15:02 -0800)
committer
Linus Torvalds
<
[email protected]
>
Wed, 29 Nov 2006 01:26:50 +0000
(17:26 -0800)
Make sure to properly clamp maxnum to avoid overflow
Signed-off-by: Chris Wright <
[email protected]
>
Acked-by: Eugene Teo <
[email protected]
>
Acked-by: Marcel Holtmann <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
net/bridge/br_ioctl.c
patch
|
blob
|
history
diff --git
a/net/bridge/br_ioctl.c
b/net/bridge/br_ioctl.c
index 4e4119a1213925568b8a1acdef9bf52b98b19da3..4c61a7e0a86e1ae9e16867f9f8e4b0412b8edbaf 100644
(file)
--- a/
net/bridge/br_ioctl.c
+++ b/
net/bridge/br_ioctl.c
@@
-58,12
+58,13
@@
static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
{
int num;
void *buf;
- size_t size
= maxnum * sizeof(struct __fdb_entry)
;
+ size_t size;
- if (size > PAGE_SIZE) {
- size = PAGE_SIZE;
+ /* Clamp size to PAGE_SIZE, test maxnum to avoid overflow */
+ if (maxnum > PAGE_SIZE/sizeof(struct __fdb_entry))
maxnum = PAGE_SIZE/sizeof(struct __fdb_entry);
- }
+
+ size = maxnum * sizeof(struct __fdb_entry);
buf = kmalloc(size, GFP_USER);
if (!buf)