diff options
author | David Howells <dhowells@redhat.com> | 2019-02-14 17:20:25 +0100 |
---|---|---|
committer | James Morris <james.morris@microsoft.com> | 2019-02-15 23:12:09 +0100 |
commit | 822ad64d7e46a8e2c8b8a796738d7b657cbb146d (patch) | |
tree | 1a90686fb8e972e8d202500ab3d53196ec29cd16 /security/keys/keyctl.c | |
parent | assoc_array: Fix shortcut creation (diff) | |
download | linux-822ad64d7e46a8e2c8b8a796738d7b657cbb146d.tar.xz linux-822ad64d7e46a8e2c8b8a796738d7b657cbb146d.zip |
keys: Fix dependency loop between construction record and auth key
In the request_key() upcall mechanism there's a dependency loop by which if
a key type driver overrides the ->request_key hook and the userspace side
manages to lose the authorisation key, the auth key and the internal
construction record (struct key_construction) can keep each other pinned.
Fix this by the following changes:
(1) Killing off the construction record and using the auth key instead.
(2) Including the operation name in the auth key payload and making the
payload available outside of security/keys/.
(3) The ->request_key hook is given the authkey instead of the cons
record and operation name.
Changes (2) and (3) allow the auth key to naturally be cleaned up if the
keyring it is in is destroyed or cleared or the auth key is unlinked.
Fixes: 7ee02a316600 ("keys: Fix dependency loop between construction record and auth key")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'security/keys/keyctl.c')
-rw-r--r-- | security/keys/keyctl.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index e8093d025966..7bbe03593e58 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -25,6 +25,7 @@ #include <linux/security.h> #include <linux/uio.h> #include <linux/uaccess.h> +#include <keys/request_key_auth-type.h> #include "internal.h" #define KEY_MAX_DESC_SIZE 4096 |