Introduce the ability for an encryption key to be passed through 'struct
bio' to the "PFK" module for use by inline encryption with Qualcomm ICE.
This will be used to specify a default key for metadata encryption.
Instead of referencing the keyring key (struct key) directly as we did
in the marlin kernel, require users to provide a structure directly
containing the key material. Referencing a keyring key from struct bio
is incorrect because userspace can call keyctl_revoke() at any time,
causing the key's payload to be freed; so unless the key semaphore is
held, there's no guarantee the payload will live until the bio is done.
For now, leave in place most of the PFK code, including the "get the
bio's inode and call back into ext4 to get the key" hack. This is
necessary for now, though really this should be implemented by having
ext4 set the key in its bios, and refactoring the "PFK" module's
functionality into more appropriate places in block/ and drivers/. But
in any case, keys specified by ext4 will override the "default" key, as
intended.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Change-Id: I4295abaeecf6f7ab8c9854eb80d928f40500fde2