]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
vgaarb: fix incorrect dereference of userspace pointer.
authorAndy Getzendanner <james.getzendanner@students.olin.edu>
Thu, 11 Feb 2010 04:04:48 +0000 (14:04 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 11 Feb 2010 04:04:48 +0000 (14:04 +1000)
This patch corrects a userspace pointer dereference in the VGA arbiter
in 2.6.32.1.

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
/dev/vga_arbiter.

The patch has been tested against 2.6.32.1 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: Andy Getzendanner <james.getzendanner@students.olin.edu>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/vga/vgaarb.c

index 1ac0c93603c903a1d7a39f1efb10530936a2f4e1..24b56dc5459730d47b6c7b606324ec13a64b5804 100644 (file)
@@ -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,