Commit 348f5b25 authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] key management: fix locking problem and move __key_check() out of line

The attached patch fixes a locking problem in key_lookup() and moves
__key_check() out of line.
Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6fe496ec
......@@ -106,13 +106,7 @@ extern long keyctl_negate_key(key_serial_t, unsigned, key_serial_t);
* debugging key validation
*/
#ifdef KEY_DEBUGGING
static void __key_check(const struct key *key)
{
printk("__key_check: key %p {%08x} should be {%08x}\n",
key, key->magic, KEY_DEBUG_MAGIC);
BUG();
}
extern void __key_check(const struct key *);
static inline void key_check(const struct key *key)
{
......
......@@ -39,6 +39,15 @@ struct key_type key_type_dead = {
.name = "dead",
};
#ifdef KEY_DEBUGGING
void __key_check(const struct key *key)
{
printk("__key_check: key %p {%08x} should be {%08x}\n",
key, key->magic, KEY_DEBUG_MAGIC);
BUG();
}
#endif
/*****************************************************************************/
/*
* get the key quota record for a user, allocating a new record if one doesn't
......@@ -616,8 +625,6 @@ struct key *key_lookup(key_serial_t id)
goto found;
}
spin_unlock(&key_serial_lock);
not_found:
key = ERR_PTR(-ENOKEY);
goto error;
......@@ -634,8 +641,8 @@ struct key *key_lookup(key_serial_t id)
*/
atomic_inc(&key->usage);
spin_unlock(&key_serial_lock);
error:
spin_unlock(&key_serial_lock);
return key;
} /* end key_lookup() */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment