summaryrefslogtreecommitdiff
path: root/bsd-core/drm_auth.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-11-07 04:11:15 +0000
committerEric Anholt <anholt@freebsd.org>2004-11-07 04:11:15 +0000
commita1d9e5abafe60ca2b7f96cadd1013695ada4ac41 (patch)
treeff8a462ecf2fea9ee35c8988ac0d9a37b7206808 /bsd-core/drm_auth.c
parentc5bededa5130a58273448188c04c15bc9c1097f3 (diff)
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).
Diffstat (limited to 'bsd-core/drm_auth.c')
-rw-r--r--bsd-core/drm_auth.c10
1 files changed, 8 insertions, 2 deletions
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) {