diff options
author | Eric Anholt <anholt@freebsd.org> | 2003-10-19 23:35:58 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2003-10-19 23:35:58 +0000 |
commit | 0cf1887139eb1ce18d09f7be0567aa93d802040d (patch) | |
tree | 05704a5a90bc9b0fbabed4029f200f9eff955953 /bsd-core/drm_auth.c | |
parent | 59fbe01fea8f77fc3810643c14a1738d197d4291 (diff) |
- SMPng lock the DRM. This is only partial -- there are a few code paths
used by root (the X Server) which are not locked. However, it should
deal with lost-IRQ issues on -current which I think people have been
experiencing but I am unable to reproduce (though I understand why they
would occur, because of a bug of mine). Note that most of the locking
(DRM_LOCK()/UNLOCK()) is all covered by Giant still, so it doesn't
matter yet.
- Remove locking on FreeBSD-stable and NetBSD. These are covered by the
fact that there is no reentrancy of the kernel except by interrupts,
which are locked using spldrm()/splx() instead.
Diffstat (limited to 'bsd-core/drm_auth.c')
-rw-r--r-- | bsd-core/drm_auth.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index 6f819ad8..9e34b35c 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -54,7 +54,7 @@ static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic) return retval; } -int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) +static int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) { int hash; drm_magic_entry_t *entry; @@ -82,7 +82,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) return 0; } -int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) +static int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) { drm_magic_entry_t *prev = NULL; drm_magic_entry_t *pt; @@ -116,9 +116,17 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) int DRM(getmagic)(DRM_IOCTL_ARGS) { static drm_magic_t sequence = 0; - drm_auth_t auth; + drm_auth_t auth; + drm_file_t *priv; DRM_DEVICE; - DRM_PRIV; + + DRM_LOCK(); + priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); + DRM_UNLOCK(); + if (priv == NULL) { + DRM_DEBUG("can't find authenticator\n"); + return EINVAL; + } /* Find unique magic */ if (priv->magic) { @@ -152,6 +160,7 @@ int DRM(authmagic)(DRM_IOCTL_ARGS) DRM_COPY_FROM_USER_IOCTL(auth, (drm_auth_t *)data, sizeof(auth)); DRM_DEBUG("%u\n", auth.magic); + if ((file = DRM(find_file)(dev, auth.magic))) { file->authenticated = 1; DRM(remove_magic)(dev, auth.magic); |