From a1d9e5abafe60ca2b7f96cadd1013695ada4ac41 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 7 Nov 2004 04:11:15 +0000 Subject: Refine the locking of the DRM. Most significant is covering the driver ioctls with dev_lock, which is a major step toward being able to remove Giant. Covers some new pieces (dev->unique*) in the core, and avoids one call down into system internals with the drm lock held, which is usually bad (FreeBSD LOR #23, #27). --- bsd-core/drm_auth.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bsd-core/drm_auth.c') diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index fb556f33..dfd820da 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -116,12 +116,18 @@ static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) int drm_getmagic(DRM_IOCTL_ARGS) { + DRM_DEVICE; static drm_magic_t sequence = 0; drm_auth_t auth; drm_file_t *priv; - DRM_DEVICE; - DRM_GET_PRIV_WITH_RETURN(priv, filp); + DRM_LOCK(); + priv = drm_find_file_by_proc(dev, p); + DRM_UNLOCK(); + if (priv == NULL) { + DRM_ERROR("can't find authenticator\n"); + return EINVAL; + } /* Find unique magic */ if (priv->magic) { -- cgit v1.2.3