linux/security/keys
David Howells ceb73c1204 KEYS: Fix __key_link_end() quota fixup on error
Fix __key_link_end()'s attempt to fix up the quota if an error occurs.

There are two erroneous cases: Firstly, we always decrease the quota if
the preallocated replacement keyring needs cleaning up, irrespective of
whether or not we should (we may have replaced a pointer rather than
adding another pointer).

Secondly, we never clean up the quota if we added a pointer without the
keyring storage being extended (we allocate multiple pointers at a time,
even if we're not going to use them all immediately).

We handle this by setting the bottom bit of the preallocation pointer in
__key_link_begin() to indicate that the quota needs fixing up, which is
then passed to __key_link() (which clears the whole thing) and
__key_link_end().

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-26 08:58:20 +10:00
..
compat.c KEYS: Fix up comments in key management code 2011-01-21 14:59:30 -08:00
encrypted.c encrypted-keys: rename encrypted_defined files to encrypted 2011-01-24 10:27:57 +11:00
encrypted.h encrypted-keys: rename encrypted_defined files to encrypted 2011-01-24 10:27:57 +11:00
gc.c KEYS: Fix up comments in key management code 2011-01-21 14:59:30 -08:00
internal.h KEYS: Fix __key_link_end() quota fixup on error 2011-01-26 08:58:20 +10:00
key.c KEYS: Fix __key_link_end() quota fixup on error 2011-01-26 08:58:20 +10:00
keyctl.c KEYS: Fix up comments in key management code 2011-01-21 14:59:30 -08:00
keyring.c KEYS: Fix __key_link_end() quota fixup on error 2011-01-26 08:58:20 +10:00
Makefile encrypted-keys: rename encrypted_defined files to encrypted 2011-01-24 10:27:57 +11:00
permission.c KEYS: Fix up comments in key management code 2011-01-21 14:59:30 -08:00
proc.c KEYS: Fix up comments in key management code 2011-01-21 14:59:30 -08:00
process_keys.c KEYS: Fix up comments in key management code 2011-01-21 14:59:30 -08:00
request_key.c KEYS: Fix __key_link_end() quota fixup on error 2011-01-26 08:58:20 +10:00
request_key_auth.c KEYS: Fix up comments in key management code 2011-01-21 14:59:30 -08:00
sysctl.c
trusted.c trusted keys: Fix a memory leak in trusted_update(). 2011-01-24 10:59:58 +11:00
trusted.h trusted-keys: rename trusted_defined files to trusted 2011-01-24 10:14:22 +11:00
user_defined.c KEYS: Do some style cleanup in the key management code. 2011-01-21 14:59:29 -08:00