summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drm_drv.c
diff options
context:
space:
mode:
authorremko <remko@FreeBSD.org>2008-01-16 13:54:40 +0000
committerremko <remko@FreeBSD.org>2008-01-16 13:54:40 +0000
commit339d7dbc077cb1de0501ede1373f3720a66ea644 (patch)
tree3d12499a31e3278968b25192486b504dbcccec85 /sys/dev/drm/drm_drv.c
parent4a8da7a19f441169a5650807be6c6f876f7d993c (diff)
downloadFreeBSD-src-339d7dbc077cb1de0501ede1373f3720a66ea644.zip
FreeBSD-src-339d7dbc077cb1de0501ede1373f3720a66ea644.tar.gz
Dont accidentally remove a filesocket which is still in use. This gives
problems when the DRM driver is loaded and the AIXGL extension is loaded , the AIXGL driver requests a drm_close and this will cause the radeon driver to fail while starting X windows. PR: kern/114688 Submitted by: vehemens <vehemens at verizon dot net> Prodded by: Robert Noland Approved by: imp (mentor, a while ago already), anholt MFC After: 1 week
Diffstat (limited to 'sys/dev/drm/drm_drv.c')
-rw-r--r--sys/dev/drm/drm_drv.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/drm/drm_drv.c b/sys/dev/drm/drm_drv.c
index 0d23e96..71d9c75 100644
--- a/sys/dev/drm/drm_drv.c
+++ b/sys/dev/drm/drm_drv.c
@@ -711,6 +711,9 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
return EINVAL;
}
+ if (--priv->refs != 0)
+ goto done;
+
if (dev->driver.preclose != NULL)
dev->driver.preclose(dev, filp);
@@ -786,17 +789,17 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
dev->buf_pgid = 0;
#endif /* __NetBSD__ || __OpenBSD__ */
- if (--priv->refs == 0) {
- if (dev->driver.postclose != NULL)
- dev->driver.postclose(dev, priv);
- TAILQ_REMOVE(&dev->files, priv, link);
- free(priv, M_DRM);
- }
+ if (dev->driver.postclose != NULL)
+ dev->driver.postclose(dev, priv);
+
+ TAILQ_REMOVE(&dev->files, priv, link);
+ free(priv, M_DRM);
/* ========================================================
* End inline drm_release
*/
+ done:
atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
#ifdef __FreeBSD__
device_unbusy(dev->device);
OpenPOWER on IntegriCloud