]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm: stop information leak of old kernel stack.
authorDave Airlie <airlied@redhat.com>
Tue, 17 Aug 2010 04:46:00 +0000 (14:46 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Aug 2010 23:46:22 +0000 (16:46 -0700)
commit b9f0aee83335db1f3915f4e42a5e21b351740afd upstream.

non-critical issue, CVE-2010-2803

Userspace controls the amount of memory to be allocate, so it can
get the ioctl to allocate more memory than the kernel uses, and get
access to kernel stack. This can only be done for processes authenticated
to the X server for DRI access, and if the user has DRI access.

Fix is to just memset the data to 0 if the user doesn't copy into
it in the first place.

Reported-by: Kees Cook <kees@ubuntu.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/gpu/drm/drm_drv.c

index 4a66201edaec0ea89ccc9d791a67f29d2ea58245..c9736ed5d5bf1744bd22dbcb8631637b6c0147a6 100644 (file)
@@ -502,7 +502,9 @@ long drm_ioctl(struct file *filp,
                                retcode = -EFAULT;
                                goto err_i1;
                        }
-               }
+               } else
+                       memset(kdata, 0, _IOC_SIZE(cmd));
+
                if (ioctl->flags & DRM_UNLOCKED)
                        retcode = func(dev, kdata, file_priv);
                else {