Commit 77c1ff39 authored by Andy Getzendanner's avatar Andy Getzendanner Committed by Dave Airlie

vgaarb: fix incorrect dereference of userspace pointer.

This patch corrects a userspace pointer dereference in the VGA arbiter

copy_from_user() is used at line 822 to copy the contents of buf into
kbuf, but a call to strncmp() on line 964 uses buf rather than kbuf.  This
problem led to a GPF in strncmp() when X was started on my x86_32 systems.
 X triggered the behavior with a write of "target PCI:0000:01:00.0" to

The patch has been tested against and observed to correct the GPF
observed when starting X or manually writing the string "target
PCI:0000:01:00.0" to /dev/vga_arbiter.
Signed-off-by: default avatarAndy Getzendanner <>
Cc: Jesse Barnes <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarDave Airlie <>
parent 0a4583eb
......@@ -961,7 +961,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
remaining -= 7;
pr_devel("client 0x%p called 'target'\n", priv);
/* if target is default */
if (!strncmp(buf, "default", 7))
if (!strncmp(kbuf, "default", 7))
pdev = pci_dev_get(vga_default_device());
else {
if (!vga_pci_str_to_vars(curr_pos, remaining,
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