提交 68e8cc2a 编写于 作者: Y Yizhuo Zhai 提交者: Daniel Vetter

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: NGuenter Roeck <linux@roeck-us.net>
Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
Acked-by: NHelge Deller <deller@gmx.de>
Signed-off-by: NYizhuo Zhai <yzhai003@ucr.edu>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220202235811.1621017-1-yzhai003@ucr.edu
上级 622c9a3a
......@@ -1160,6 +1160,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
ret = fbcon_set_con2fb_map_ioctl(argp);
break;
case FBIOBLANK:
if (arg > FB_BLANK_POWERDOWN)
return -EINVAL;
console_lock();
lock_fb_info(info);
ret = fb_blank(info, arg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册