android_kernel_xiaomi_sm8350/drivers/gpu/drm/mga
Dave Airlie 1b2f148963 drm: block userspace under allocating buffer and having drivers overwrite it (v2)
With the current screwed but its ABI, ioctls for the drm, Linus pointed out that we could allow userspace to specify the allocation size, but we pass it to the driver which then uses it blindly to store a struct. Now if userspace specifies the allocation size as smaller than the driver needs, the driver can possibly overwrite memory.

This patch restructures the driver ioctls so we store the structure size we are expecting, and make sure we allocate at least that size. The copy from/to userspace are still restricted to the size the user specifies, this allows ioctl structs to grow on both sides of the equation.

Up until now we didn't really use the DRM_IOCTL defines in the kernel, so this cleans them up and adds them for nouveau.

v2:
fix nouveau pushbuf arg (thanks to Ben for pointing it out)

Reported-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-17 14:52:25 +10:00
..
Makefile
mga_dma.c drm/mga: fixed brace, macro and spacing coding style issues 2010-08-02 10:17:36 +10:00
mga_drv.c drm/mga: fixed brace, macro and spacing coding style issues 2010-08-02 10:17:36 +10:00
mga_drv.h drm/mga: fixed brace, macro and spacing coding style issues 2010-08-02 10:17:36 +10:00
mga_ioc32.c
mga_irq.c drm/mga: fixed brace, macro and spacing coding style issues 2010-08-02 10:17:36 +10:00
mga_state.c drm: block userspace under allocating buffer and having drivers overwrite it (v2) 2010-08-17 14:52:25 +10:00
mga_warp.c drm/mga: fixed brace, macro and spacing coding style issues 2010-08-02 10:17:36 +10:00