[PATCH] add return value checking of get_user() in set_vesa_blanking()

[akpm@osdl.org: bugfix]
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc: James Simmons <jsimmons@infradead.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Yoichi Yuasa 2006-12-06 20:38:38 -08:00 committed by Linus Torvalds
parent db68b189f4
commit 403aac965e
1 changed files with 10 additions and 6 deletions

View File

@ -152,7 +152,7 @@ static void gotoxy(struct vc_data *vc, int new_x, int new_y);
static void save_cur(struct vc_data *vc); static void save_cur(struct vc_data *vc);
static void reset_terminal(struct vc_data *vc, int do_clear); static void reset_terminal(struct vc_data *vc, int do_clear);
static void con_flush_chars(struct tty_struct *tty); static void con_flush_chars(struct tty_struct *tty);
static void set_vesa_blanking(char __user *p); static int set_vesa_blanking(char __user *p);
static void set_cursor(struct vc_data *vc); static void set_cursor(struct vc_data *vc);
static void hide_cursor(struct vc_data *vc); static void hide_cursor(struct vc_data *vc);
static void console_callback(struct work_struct *ignored); static void console_callback(struct work_struct *ignored);
@ -2369,7 +2369,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
ret = __put_user(data, p); ret = __put_user(data, p);
break; break;
case TIOCL_SETVESABLANK: case TIOCL_SETVESABLANK:
set_vesa_blanking(p); ret = set_vesa_blanking(p);
break; break;
case TIOCL_GETKMSGREDIRECT: case TIOCL_GETKMSGREDIRECT:
data = kmsg_redirect; data = kmsg_redirect;
@ -3313,11 +3313,15 @@ postcore_initcall(vtconsole_class_init);
* Screen blanking * Screen blanking
*/ */
static void set_vesa_blanking(char __user *p) static int set_vesa_blanking(char __user *p)
{ {
unsigned int mode; unsigned int mode;
get_user(mode, p + 1);
vesa_blank_mode = (mode < 4) ? mode : 0; if (get_user(mode, p + 1))
return -EFAULT;
vesa_blank_mode = (mode < 4) ? mode : 0;
return 0;
} }
void do_blank_screen(int entering_gfx) void do_blank_screen(int entering_gfx)