summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/drm_drv.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2013-09-30 03:26:22 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2013-09-30 03:26:22 +0000
commit01145d28fb7d97f9b7fb91f7961ea6f9db8252b0 (patch)
tree6da20c1556718f6d78ecb61c8b8f859c848e76b0 /sys/dev/pci/drm/drm_drv.c
parent7bde551dd1e07a95f3e9f4e4f94b6c03e62bdd82 (diff)
drmclose: don't unref objects with a mutex locked.
Some free functions (radeon) grab sleeping locks. Instead when we ahve taken the object off the tree we unlock and unref, then regrab before looking again. from oga in bitrig, ok kettenis@
Diffstat (limited to 'sys/dev/pci/drm/drm_drv.c')
-rw-r--r--sys/dev/pci/drm/drm_drv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index ba9f30cddc5..f9ab8884a8d 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_drv.c,v 1.113 2013/08/27 03:18:45 jsg Exp $ */
+/* $OpenBSD: drm_drv.c,v 1.114 2013/09/30 03:26:21 jsg Exp $ */
/*-
* Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org>
* Copyright © 2008 Intel Corporation
@@ -578,8 +578,10 @@ drmclose(dev_t kdev, int flags, int fmt, struct proc *p)
mtx_enter(&file_priv->table_lock);
while ((han = SPLAY_ROOT(&file_priv->obj_tree)) != NULL) {
SPLAY_REMOVE(drm_obj_tree, &file_priv->obj_tree, han);
+ mtx_leave(&file_priv->table_lock);
drm_handle_unref(han->obj);
drm_free(han);
+ mtx_enter(&file_priv->table_lock);
}
mtx_leave(&file_priv->table_lock);
}