git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge to Fedora kernel-2.6.18-1.2255_FC5-vs2.0.2.2-rc9 patched with stable patch...
[linux-2.6.git]
/
net
/
bridge
/
br_ioctl.c
diff --git
a/net/bridge/br_ioctl.c
b/net/bridge/br_ioctl.c
index
4e4119a
..
4c61a7e
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;
{
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);
maxnum = PAGE_SIZE/sizeof(struct __fdb_entry);
- }
+
+ size = maxnum * sizeof(struct __fdb_entry);
buf = kmalloc(size, GFP_USER);
if (!buf)
buf = kmalloc(size, GFP_USER);
if (!buf)