aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_drawable.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 10:18:40 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 10:18:40 -0700
commit70740d6c93030b339b4ad17fd58ee135dfc13913 (patch)
tree2d423b34968aa111237c93490f62c3c8e962b5ef /drivers/gpu/drm/drm_drawable.c
parenta3415dc34f4a615a904852e7a9d0cc2877007e9e (diff)
parent7e78f72524b794fa8d73dc59aeeacc12a2e937fe (diff)
Merge branch 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: drm: Avoid oops in DRM_IOCTL_RM_DRAW if a bad handle is supplied. drm: Add 32-bit compatibility for DRM_IOCTL_UPDATE_DRAW. drm/i915: use pipes, not planes to label vblank data drm/i915: hold dev->struct_mutex and DRM lock during vblank ring operations i915: Fix format string warnings on x86-64. i915: Don't dereference HWS in /proc debug files when it isn't initialized. i915: Enable IMR passthrough of vblank events before enabling it in pipestat. drm: Remove two leaks of vblank reference count in error paths. drm: fix leak of cliprects in drm_rmdraw() i915: Disable MSI on GM965 (errata says it doesn't work) drm: Set cliprects to NULL when changing drawable to having 0 cliprects. i915: Protect vblank IRQ reg access with spinlock
Diffstat (limited to 'drivers/gpu/drm/drm_drawable.c')
-rw-r--r--drivers/gpu/drm/drm_drawable.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c
index 1839c57663c..80be1cab62a 100644
--- a/drivers/gpu/drm/drm_drawable.c
+++ b/drivers/gpu/drm/drm_drawable.c
@@ -76,11 +76,18 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
struct drm_draw *draw = data;
unsigned long irqflags;
+ struct drm_drawable_info *info;
spin_lock_irqsave(&dev->drw_lock, irqflags);
- drm_free(drm_get_drawable_info(dev, draw->handle),
- sizeof(struct drm_drawable_info), DRM_MEM_BUFS);
+ 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);
idr_remove(&dev->drw_idr, draw->handle);
@@ -111,7 +118,9 @@ int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file
switch (update->type) {
case DRM_DRAWABLE_CLIPRECTS:
- if (update->num != info->num_rects) {
+ if (update->num == 0)
+ rects = NULL;
+ else if (update->num != info->num_rects) {
rects = drm_alloc(update->num * sizeof(struct drm_clip_rect),
DRM_MEM_BUFS);
} else