From f75ec3010ad8d15d316f6e6d580c85f9e6b8466e Mon Sep 17 00:00:00 2001 From: Rik Faith Date: Thu, 17 Aug 2000 20:26:11 +0000 Subject: [PATCH] Bug #112196: auth.c uses semaphores while holding spinlocks Make spinlocked region smaller to avoid semaphore. --- linux/auth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/auth.c b/linux/auth.c index 9f81c539..4556bd96 100644 --- a/linux/auth.c +++ b/linux/auth.c @@ -126,12 +126,12 @@ int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, if (priv->magic) { auth.magic = priv->magic; } else { - spin_lock(&lock); do { + spin_lock(&lock); if (!sequence) ++sequence; /* reserve 0 */ auth.magic = sequence++; + spin_unlock(&lock); } while (drm_find_file(dev, auth.magic)); - spin_unlock(&lock); priv->magic = auth.magic; drm_add_magic(dev, priv, auth.magic); }