x86/sev-es: Don't return NULL from sev_es_get_ghcb()
authorJoerg Roedel <jroedel@suse.de>
Wed, 19 May 2021 13:52:44 +0000 (15:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 May 2021 10:06:53 +0000 (12:06 +0200)
commitbe4cba71b2d068f783ede32775212ef4da3238c4
tree6694a92cc82c44741580f385899878738fca270e
parente7174da8c45ba180c04b76fa675c89de1c658b08
x86/sev-es: Don't return NULL from sev_es_get_ghcb()

commit b250f2f7792d15bcde98e0456781e2835556d5fa upstream.

sev_es_get_ghcb() is called from several places but only one of them
checks the return value. The reaction to returning NULL is always the
same: calling panic() and kill the machine.

Instead of adding checks to all call sites, move the panic() into the
function itself so that it will no longer return NULL.

Fixes: 0786138c78e7 ("x86/sev-es: Add a Runtime #VC Exception Handler")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: stable@vger.kernel.org # v5.10+
Link: https://lkml.kernel.org/r/20210519135251.30093-2-joro@8bytes.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/sev-es.c