diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-08-14 17:11:14 +0200 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-08-14 17:11:14 +0200 |
commit | 4daa024918d461ab8d173631fa5187dc50253b67 (patch) | |
tree | 637030df3f1726001d13d1699aca8fe4e316e5f3 | |
parent | 0d60cd0036c6bc5383cdc1dad719950afd68cbbf (diff) |
Avoid kernel oops in some error paths calling drm_lastclose().
-rw-r--r-- | linux-core/drm_drv.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 0281178c..79209dbf 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -163,11 +163,13 @@ int drm_lastclose(drm_device_t * dev) dev->unique_len = 0; } - 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 */ |