Commit 9c6c0b9e authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[AGPGART] sanitise agp mode input on setup ioctl.

parent 1e464de0
...@@ -805,11 +805,19 @@ static int agpioc_setup_wrap(agp_file_private * priv, unsigned long arg) ...@@ -805,11 +805,19 @@ static int agpioc_setup_wrap(agp_file_private * priv, unsigned long arg)
{ {
agp_setup mode; agp_setup mode;
if (copy_from_user(&mode, (void *) arg, sizeof(agp_setup))) { if (copy_from_user(&mode, (void *) arg, sizeof(agp_setup)))
return -EFAULT; return -EFAULT;
switch (mode.agp_mode) {
case 1:
case 2:
case 4:
case 8:
agp_enable(mode.agp_mode);
return 0;
default:;
} }
agp_enable(mode.agp_mode); return -EINVAL;
return 0;
} }
static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg) static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment