Message ID | 1361317212-23356-1-git-send-email-airlied@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index 45adf97..a186563 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -438,6 +438,13 @@ int drm_rmctx(struct drm_device *dev, void *data, DRM_DEBUG("%d\n", ctx->handle); if (ctx->handle != DRM_KERNEL_CONTEXT) { + struct drm_local_map *map; + mutex_lock(&dev->struct_mutex); + map = idr_find(&dev->ctx_idr, ctx->handle); + mutex_unlock(&dev->struct_mutex); + + if (!map) + return -EINVAL; if (dev->driver->context_dtor) dev->driver->context_dtor(dev, ctx->handle); drm_ctxbitmap_free(dev, ctx->handle);