aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-10-21 14:53:01 -0400
committerDave Airlie <airlied@redhat.com>2008-10-22 23:46:54 -0400
commit7e78f72524b794fa8d73dc59aeeacc12a2e937fe (patch)
treee04e6f5336d29ef58c75a829339e771210d904bc
parent49568873705e45a0de77b7824a9a46d3201019a7 (diff)
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>
-rw-r--r--drivers/gpu/drm/drm_drawable.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c
index 4a794d89942b..80be1cab62af 100644
--- a/drivers/gpu/drm/drm_drawable.c
+++ b/drivers/gpu/drm/drm_drawable.c
@@ -81,6 +81,10 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
81 spin_lock_irqsave(&dev->drw_lock, irqflags); 81 spin_lock_irqsave(&dev->drw_lock, irqflags);
82 82
83 info = drm_get_drawable_info(dev, draw->handle); 83 info = drm_get_drawable_info(dev, draw->handle);
84 if (info == NULL) {
85 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
86 return -EINVAL;
87 }
84 drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), 88 drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect),
85 DRM_MEM_BUFS); 89 DRM_MEM_BUFS);
86 drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); 90 drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS);