video: arcfb: fix buffer overflow
Subsystems (2)
PATCH 1/1 video: arcfb: fix buffer overflow
(count + p) is not checked for integer overflow. If p < fbmemlength and count = (size_t)(1 - p) (very big unsigned integer) then count + p = 1 < fbmemlength and copy_to_user(base_addr+p, buf, count) overflows base_addr.
---
Compile tested only.
drivers/video/arcfb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/arcfb.c +1 -1
@@ -454,7 +454,7 @@ static ssize_t arcfb_write(struct fb_info *info, const char __user *buf, xres = info->var.xres; fbmemlength = (xres * info->var.yres)/8 ; -if (p > fbmemlength) +if (p > fbmemlength || (p + count < p))return -ENOSPC ; err =0 ;
Signature · 1 line
1.7.0.4
Paul Mundt
AppliedQuoted 6 lines · Vasiliy Kulikov
(count + p) is not checked for integer overflow. If p < fbmemlength and count = (size_t)(1 - p) (very big unsigned integer) then count + p = 1 < fbmemlength and
copy_to_user(base_addr+p, buf, count)overflowsbase_addr.Signed-off-by Vasiliy Kulikov <[email protected]>
Applied, thanks.
Quoted 9 lines · Paul Mundt
Quoted 6 lines · Vasiliy Kulikov
(count + p) is not checked for integer overflow. If p < fbmemlength and count = (size_t)(1 - p) (very big unsigned integer) then count + p = 1 < fbmemlength and
copy_to_user(base_addr+p, buf, count)overflowsbase_addr.Signed-off-by Vasiliy Kulikov <[email protected]>Applied, thanks.
The patch is harmless, but the integer overflow would actually be caught in rw_verify_area().
regards,
dan carpenter
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · Paul Mundt
Quoted 5 lines · Vasiliy Kulikov
(count + p) is not checked for integer overflow. If p < fbmemlength and count = (size_t)(1 - p) (very big unsigned integer) then count + p = 1 < fbmemlength and
copy_to_user(base_addr+p, buf, count)overflowsbase_addr.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Vasiliy Kulikov <[email protected]>Applied, thanks.
The patch is harmless, but the integer overflow would actually be caught in
rw_verify_area().
Ah, so it is, I'll drop it then, thanks.