summaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_drv.c
diff options
context:
space:
mode:
authorThomas Hellstrom2006-08-16 01:21:56 +0200
committerDave Airlie2006-09-21 21:32:32 +0200
commit0a0c721dc5d0de011e5d363cd454c60c66ca00ec (patch)
tree6afaf6fb6a25e82768212c1122cb89d21bc7a85f /drivers/char/drm/drm_drv.c
parentdrm: allow detection of new VIA chipsets (diff)
downloadkernel-qcow2-linux-0a0c721dc5d0de011e5d363cd454c60c66ca00ec.tar.gz
kernel-qcow2-linux-0a0c721dc5d0de011e5d363cd454c60c66ca00ec.tar.xz
kernel-qcow2-linux-0a0c721dc5d0de011e5d363cd454c60c66ca00ec.zip
drm: avoid kernel oops in some error paths calling drm_lastclose
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_drv.c')
-rw-r--r--drivers/char/drm/drm_drv.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index f9ecc8414b8a..654b95cdd9a3 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -155,10 +155,12 @@ int drm_lastclose(drm_device_t * dev)
del_timer(&dev->timer);
/* Clear pid list */
- list_for_each_entry_safe(pt, next, &dev->magicfree, head) {
- list_del(&pt->head);
- drm_ht_remove_item(&dev->magiclist, &pt->hash_item);
- drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
+ if (dev->magicfree.next) {
+ list_for_each_entry_safe(pt, next, &dev->magicfree, head) {
+ list_del(&pt->head);
+ drm_ht_remove_item(&dev->magiclist, &pt->hash_item);
+ drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
+ }
}
/* Clear AGP information */