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:
dacbde0
)
mm/nommu.c: add additional check for vread() just like vwrite() has done
author
Chen Gang
<
[email protected]
>
Wed, 3 Jul 2013 22:02:36 +0000
(15:02 -0700)
committer
Linus Torvalds
<
[email protected]
>
Wed, 3 Jul 2013 23:07:31 +0000
(16:07 -0700)
vwrite() checks for overflow. vread() should do the same thing.
Since vwrite() checks the source buffer address, vread() should check
the destination buffer address.
Signed-off-by: Chen Gang <
[email protected]
>
Cc: Al Viro <
[email protected]
>
Cc: Michel Lespinasse <
[email protected]
>
Cc: Rik van Riel <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
mm/nommu.c
patch
|
blob
|
history
diff --git
a/mm/nommu.c
b/mm/nommu.c
index 298884dcd6e71e4723a203a82f1613cbfcec19ec..1898b2fe9da5eefdc3b33823a3cd23d2a401118f 100644
(file)
--- a/
mm/nommu.c
+++ b/
mm/nommu.c
@@
-282,6
+282,10
@@
EXPORT_SYMBOL(vmalloc_to_pfn);
long vread(char *buf, char *addr, unsigned long count)
{
+ /* Don't allow overflow */
+ if ((unsigned long) buf + count < count)
+ count = -(unsigned long) buf;
+
memcpy(buf, addr, count);
return count;
}