diff options
author | Zhaowei Yuan <zhaowei.yuan@samsung.com> | 2014-06-18 14:33:59 +0800 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-06-25 13:26:57 +1000 |
commit | 1539fb9bd405ee32282ea0a38404f9e008ac5b7a (patch) | |
tree | 80d834baf72aa0f9b205c24528403a5eb69a3581 /drivers/gpu/drm/drm_drv.c | |
parent | a497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee (diff) |
drm: fix NULL pointer access by wrong ioctl
If user uses wrong ioctl command with _IOC_NONE and argument size
greater than 0, it can cause NULL pointer access from memset of line
463. If _IOC_NONE, don't memset to 0 for kdata.
Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rwxr-xr-x[-rw-r--r--] | drivers/gpu/drm/drm_drv.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 03711d00aaae..8218078b6133 100644..100755 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -419,8 +419,9 @@ long drm_ioctl(struct file *filp, retcode = -EFAULT; goto err_i1; } - } else + } else if (cmd & IOC_OUT) { memset(kdata, 0, usize); + } if (ioctl->flags & DRM_UNLOCKED) retcode = func(dev, kdata, file_priv); |