mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 02:50:43 +00:00
drm: Avoid oops in DRM_IOCTL_RM_DRAW if a bad handle is supplied.
Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Michel Dänzer <michel@tungstengraphics.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
4956887370
commit
7e78f72524
1 changed files with 4 additions and 0 deletions
|
@ -81,6 +81,10 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
|||
spin_lock_irqsave(&dev->drw_lock, irqflags);
|
||||
|
||||
info = drm_get_drawable_info(dev, draw->handle);
|
||||
if (info == NULL) {
|
||||
spin_unlock_irqrestore(&dev->drw_lock, irqflags);
|
||||
return -EINVAL;
|
||||
}
|
||||
drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect),
|
||||
DRM_MEM_BUFS);
|
||||
drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS);
|
||||
|
|
Loading…
Reference in a new issue