]> git.baikalelectronics.ru Git - kernel.git/commit
drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input
authorThierry Reding <treding@nvidia.com>
Mon, 3 Nov 2014 10:14:14 +0000 (11:14 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 13 Nov 2014 12:27:29 +0000 (13:27 +0100)
commitbf78e005876454dc562db8d503b0373e321b2825
treea74a276df9256273cdd277660c2d2fa954a9b66e
parent0846a9ec408d44d683e0501da0b42830b005333f
drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input

Some drivers treat the pitch and size fields as inputs and will use them
as minima provided by userspace so that they are only overwritten if the
minimal requirements of the driver exceed them.

This can cause strange behaviour when applications don't zero out these
fields, causing whatever was on the stack to be passed to the IOCTL. In
a typical case this would become visible as a failed allocation if the
pitch or size were unusually high. But this could also cause more subtle
bugs like overallocating dumb framebuffers.

To prevent drivers from misusing these values, make the DRM core zero
out the pitch and size fields before passing the structure to the driver
implementation.

While at it, also set the output handle field to zero for good measure,
even though it's less likely to be abused.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/drm_crtc.c