aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas@tungstengraphics.com>2006-08-15 19:21:56 -0400
committerDave Airlie <airlied@linux.ie>2006-09-21 15:32:32 -0400
commit0a0c721dc5d0de011e5d363cd454c60c66ca00ec (patch)
tree6afaf6fb6a25e82768212c1122cb89d21bc7a85f /drivers/char/drm
parentbd5af0781aed12b9707d238c17cf55d46f9bf98d (diff)
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')
-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)
155 del_timer(&dev->timer); 155 del_timer(&dev->timer);
156 156
157 /* Clear pid list */ 157 /* Clear pid list */
158 list_for_each_entry_safe(pt, next, &dev->magicfree, head) { 158 if (dev->magicfree.next) {
159 list_del(&pt->head); 159 list_for_each_entry_safe(pt, next, &dev->magicfree, head) {
160 drm_ht_remove_item(&dev->magiclist, &pt->hash_item); 160 list_del(&pt->head);
161 drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); 161 drm_ht_remove_item(&dev->magiclist, &pt->hash_item);
162 drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
163 }
162 } 164 }
163 165
164 /* Clear AGP information */ 166 /* Clear AGP information */