]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KEYS: allow reaching the keys quotas exactly
authorEric Biggers <ebiggers@google.com>
Thu, 14 Feb 2019 16:20:01 +0000 (16:20 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitf361f6a50bb72f4c90ebbd3fcdb12f9fadf36e1b
treeefecbf73c7749ead60b0fc36593a8f298630d71e
parent9c0569647d42917dd18dfbae87dfd8c371550754
KEYS: allow reaching the keys quotas exactly

BugLink: https://bugs.launchpad.net/bugs/1837813
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: 0b77f5bfb45c ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
security/keys/key.c