android_kernel_motorola_sm6225/include/drm
Vegard Nossum 1147c9cdd0 drm: fix leak of uninitialized data to userspace
...so drm_getunique() is trying to copy some uninitialized data to
userspace. The ECX register contains the number of words that are
left to copy -- so there are 5 * 4 = 20 bytes left. The offset of the
first uninitialized byte (counting from the start of the string) is
also 20 (i.e. 0xf65d2294&((1 << 5)-1) == 20). So somebody tried to
copy 40 bytes when the string was only 19 long.

In drm_set_busid() we have this code:

        dev->unique_len = 40;
        dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER);
      ...
        len = snprintf(dev->unique, dev->unique_len, pci:%04x:%02x:%02x.%d",

...so it seems that dev->unique is never updated to reflect the
actual length of the string. The remaining bytes (20 in this case)
are random uninitialized bytes that are copied into userspace.

This patch fixes the problem by setting dev->unique_len after the
snprintf().

airlied- I've had to fix this up to store the alloced size so
we have it for drm_free later.

Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Vegard Nossum <vegardno@thuin.ifi.uio.no>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2008-12-29 17:47:22 +10:00
..
drm.h drm: move to kref per-master structures. 2008-12-29 17:47:22 +10:00
drm_core.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
drm_hashtab.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
drm_memory.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
drm_memory_debug.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
drm_os_linux.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
drm_pciids.h drm/i915: Filter pci devices based on PCI_CLASS_DISPLAY_VGA 2008-11-11 18:02:12 +10:00
drm_sarea.h drm: move to kref per-master structures. 2008-12-29 17:47:22 +10:00
drm_sman.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
drmP.h drm: fix leak of uninitialized data to userspace 2008-12-29 17:47:22 +10:00
i810_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
i830_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
i915_drm.h i915: Add GEM ioctl to get available aperture size. 2008-11-03 10:56:49 +10:00
Kbuild drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
mga_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
r128_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
radeon_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
savage_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
sis_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00
via_drm.h drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00