drm: ctx release can happen before dev->ctxlist is allocated
authorDave Airlie <airlied@starflyer.(none)>
Thu, 7 Jul 2005 10:17:42 +0000 (20:17 +1000)
committerDave Airlie <airlied@linux.ie>
Thu, 7 Jul 2005 10:17:42 +0000 (20:17 +1000)
From: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/drm_fops.c

index 7f9b00c..a53322d 100644 (file)
@@ -259,7 +259,7 @@ int drm_release( struct inode *inode, struct file *filp )
        drm_fasync( -1, filp, 0 );
 
        down( &dev->ctxlist_sem );
-       if ( !list_empty( &dev->ctxlist->head ) ) {
+       if ( dev->ctxlist && (!list_empty(&dev->ctxlist->head))) {
                drm_ctx_list_t *pos, *n;
 
                list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) {