Skip to content

Commit 68e8cc2

Browse files
Yizhuo Zhaidanvet
authored andcommitted
fbdev: fbmem: Fix the implicit type casting
In function do_fb_ioctl(), the "arg" is the type of unsigned long, and in "case FBIOBLANK:" this argument is casted into an int before passig to fb_blank(). In fb_blank(), the comparision if (blank > FB_BLANK_POWERDOWN) would be bypass if the original "arg" is a large number, which is possible because it comes from the user input. Fix this by adding the check before the function call. Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Acked-by: Helge Deller <[email protected]> Signed-off-by: Yizhuo Zhai <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 622c9a3 commit 68e8cc2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/video/fbdev/core/fbmem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
11601160
ret = fbcon_set_con2fb_map_ioctl(argp);
11611161
break;
11621162
case FBIOBLANK:
1163+
if (arg > FB_BLANK_POWERDOWN)
1164+
return -EINVAL;
11631165
console_lock();
11641166
lock_fb_info(info);
11651167
ret = fb_blank(info, arg);

0 commit comments

Comments
 (0)