android_kernel_samsung_msm8976/security/keys
Eric Biggers 6ecf74942f KEYS: allow reaching the keys quotas exactly
commit a08bf91ce28ed3ae7b6fef35d843fef8dc8c2cd9 upstream.

If the sysctl 'kernel.keys.maxkeys' is set to some number n, then
actually users can only add up to 'n - 1' keys.  Likewise for
'kernel.keys.maxbytes' and the root_* versions of these sysctls.  But
these sysctls are apparently supposed to be *maximums*, as per their
names and all documentation I could find -- the keyrings(7) man page,
Documentation/security/keys/core.rst, and all the mentions of EDQUOT
meaning that the key quota was *exceeded* (as opposed to reached).

Thus, fix the code to allow reaching the quotas exactly.

Fixes: 0b77f5bfb4 ("keys: make the keyring quotas controllable through /proc/sys")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-27 22:08:29 +02:00
..
encrypted-keys KEYS: Fix an error code in request_master_key() 2019-07-27 21:44:37 +02:00
Kconfig KEYS: Move the key config into security/keys/Kconfig 2012-05-11 10:56:56 +01:00
Makefile KEYS: Reorganise keys Makefile 2012-05-11 10:56:56 +01:00
compat.c Fix: compat_rw_copy_check_uvector() misuse in aio, readv, writev, and security keys 2013-03-12 11:05:45 -07:00
gc.c KEYS: Change the name of the dead type to ".dead" to prevent user access 2017-05-01 14:22:35 +00:00
internal.h KEYS: prevent creating a different user's keyrings 2019-07-27 21:44:21 +02:00
key.c KEYS: allow reaching the keys quotas exactly 2019-07-27 22:08:29 +02:00
keyctl.c KEYS: fix key refcount leak in keyctl_read_key() 2019-07-27 21:45:32 +02:00
keyring.c KEYS: prevent creating a different user's keyrings 2019-07-27 21:44:21 +02:00
permission.c userns: Convert security/keys to the new userns infrastructure 2012-09-13 18:28:02 -07:00
proc.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
process_keys.c KEYS: put keyring if install_session_keyring_to_cred() fails 2019-07-27 21:52:38 +02:00
request_key.c KEYS: add missing permission check for request_key() destination 2019-07-27 21:45:22 +02:00
request_key_auth.c KEYS: don't revoke uninstantiated key in request_key_auth_new() 2019-07-27 21:45:31 +02:00
sysctl.c
trusted.c KEYS: trusted: fix writing past end of buffer in trusted_read() 2019-07-27 21:45:42 +02:00
trusted.h trusted-keys: rename trusted_defined files to trusted 2011-01-24 10:14:22 +11:00
user_defined.c KEYS: Fix handling of stored error in a negatively instantiated user key 2017-04-22 23:02:53 +02:00