drm: fix issue with contexts running out of RAM
authorDave Airlie <airlied@starflyer.(none)>
Mon, 2 Jan 2006 08:23:44 +0000 (19:23 +1100)
committerDave Airlie <airlied@linux.ie>
Mon, 2 Jan 2006 08:23:44 +0000 (19:23 +1100)
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/drm_context.c

index bdd168d..7a7bcef 100644 (file)
@@ -432,6 +432,10 @@ int drm_addctx(struct inode *inode, struct file *filp,
 
        if (ctx.handle != DRM_KERNEL_CONTEXT) {
                if (dev->driver->context_ctor)
 
        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);
        }
 
                        dev->driver->context_ctor(dev, ctx.handle);
        }