From: Greg KH <gregkh@linuxfoundation.org>
To: Kirill Marinushkin <k.marinushkin@gmail.com>
Cc: dhowells@redhat.com, zer0mem@yahoo.com, serge@hallyn.com,
james.l.morris@oracle.com, keyrings@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] KEYS: Sort out big_key initialisation
Date: Sat, 30 Jul 2016 10:07:20 -0700 [thread overview]
Message-ID: <20160730170720.GA10208@kroah.com> (raw)
In-Reply-To: <1469895701-27055-1-git-send-email-k.marinushkin@gmail.com>
On Sat, Jul 30, 2016 at 06:21:41PM +0200, Kirill Marinushkin wrote:
> big_key has two separate initialisation functions, one that registers the
> key type and one that registers the crypto. If the key type fails to
> register, there's no problem if the crypto registers successfully because
> there's no way to reach the crypto except through the key type.
>
> However, if the key type registers successfully but the crypto does not,
> big_key_rng and big_key_blkcipher may end up set to NULL - but the code
> neither checks for this nor unregisters the big key key type.
>
> Furthermore, since the key type is registered before the crypto, it is
> theoretically possible for the kernel to try adding a big_key before the
> crypto is set up, leading to the same effect.
>
> Fix this by merging big_key_crypto_init() and big_key_init() and calling
> the resulting function late. If they're going to be encrypted, we
> shouldn't be creating big_keys before we have the facilities to do the
> encryption available. The key type registration is also moved after the
> crypto initialisation.
>
> The fix also includes message printing on failure.
>
> If the big_key type isn't correctly set up, simply doing:
>
> dd if=/dev/zero bs=4096 count=1 | keyctl padd big_key a @s
>
> ought to cause an oops.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
> ---
> security/keys/Kconfig | 2 +-
> security/keys/big_key.c | 62 +++++++++++++++++++++++++++----------------------
> 2 files changed, 35 insertions(+), 29 deletions(-)
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read Documentation/stable_kernel_rules.txt
for how to do this properly.
</formletter>
next prev parent reply other threads:[~2016-07-30 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-30 16:21 [PATCH] KEYS: Sort out big_key initialisation Kirill Marinushkin
2016-07-30 17:07 ` Greg KH [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-07-30 20:03 Kirill Marinushkin
2016-07-30 20:12 ` Joe Perches
2016-08-11 19:17 ` Kirill Marinushkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160730170720.GA10208@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dhowells@redhat.com \
--cc=james.l.morris@oracle.com \
--cc=k.marinushkin@gmail.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=stable@vger.kernel.org \
--cc=zer0mem@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox