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)
committerBorislav Petkov <bp@suse.de>
Wed, 19 May 2021 15:05:13 +0000 (17:05 +0200)
commitb250f2f7792d15bcde98e0456781e2835556d5fa
tree4654885a45f8f98867f4b7f3f023581d97fa771b
parent0024430e920f2900654ad83cd081cf52e02a3ef5
x86/sev-es: Don't return NULL from sev_es_get_ghcb()

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
arch/x86/kernel/sev.c