drm: fix issue with contexts running out of RAM
Signed-off-by: Dave Airlie <airlied@linux.ie>
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
index bdd168d..7a7bcef 100644
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -432,6 +432,10 @@
if (ctx.handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_ctor)
+ if (dev->driver->context_ctor(dev, ctx.handle)) {
+ DRM_DEBUG("Running out of ctxs or memory.\n");
+ return -ENOMEM;
+ }
dev->driver->context_ctor(dev, ctx.handle);
}