Commit 2c1ec4bf authored by Zhaowei Yuan's avatar Zhaowei Yuan Committed by Ben Hutchings

drm: fix NULL pointer access by wrong ioctl

commit 1539fb9b upstream.

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: default avatarZhaowei Yuan <zhaowei.yuan@samsung.com>
Reviewed-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
[bwh: Backported to 3.2: adjust indentation]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent e0b2508d
......@@ -456,8 +456,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment