]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
ecryptfs: fix dereference of NULL user_key_payload
authorEric Biggers <ebiggers@google.com>
Mon, 9 Oct 2017 19:51:27 +0000 (12:51 -0700)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 16 Nov 2017 13:23:18 +0000 (11:23 -0200)
commit1cd4e09550a53168a95940807c1978d83fc1ce58
treeb35fd4c833019c109d70d9f6b85f4c2638c47412
parent3ec6d5ae8bc605529571db22b16376c3e13c1be0
ecryptfs: fix dereference of NULL user_key_payload

BugLink: http://bugs.launchpad.net/bugs/1731951
commit f66665c09ab489a11ca490d6a82df57cfc1bea3e upstream.

In eCryptfs, we failed to verify that the authentication token keys are
not revoked before dereferencing their payloads, which is problematic
because the payload of a revoked key is NULL.  request_key() *does* skip
revoked keys, but there is still a window where the key can be revoked
before we acquire the key semaphore.

Fix it by updating ecryptfs_get_key_payload_data() to return
-EKEYREVOKED if the key payload is NULL.  For completeness we check this
for "encrypted" keys as well as "user" keys, although encrypted keys
cannot be revoked currently.

Alternatively we could use key_validate(), but since we'll also need to
fix ecryptfs_get_key_payload_data() to validate the payload length, it
seems appropriate to just check the payload pointer.

Fixes: 237fead61998 ("[PATCH] ecryptfs: fs/Makefile and fs/Kconfig")
Reviewed-by: James Morris <james.l.morris@oracle.com>
Cc: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
fs/ecryptfs/ecryptfs_kernel.h
fs/ecryptfs/keystore.c