From 60f5b47d487b13efc8785c3950b453c4355a57d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Date: Wed, 11 Feb 2026 12:23:13 +0100 Subject: [PATCH] xen/kexec: return error code for unknown hypercalls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently do_kexec_op_internal() will return 0 for unknown hypercalls. Fix this by returning -EOPNOTSUPP instead. While there remove the pointless initialization of ret to -EINVAL; it just makes the code confusing. Fixes: d046f361dc93 ("Xen Security Modules: XSM") Reported-by: Andrew Cooper Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper master commit: 1ee8b11c1106dca6b8fe0d54c0e79146bb6545f0 master date: 2026-02-06 20:56:16 +0100 --- xen/common/kexec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/common/kexec.c b/xen/common/kexec.c index 84fe8c3597..1a3a20e1c9 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -1217,7 +1217,7 @@ static int do_kexec_op_internal(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) uarg, bool compat) { - int ret = -EINVAL; + int ret; ret = xsm_kexec(XSM_PRIV); if ( ret ) @@ -1258,6 +1258,10 @@ static int do_kexec_op_internal(unsigned long op, case KEXEC_CMD_kexec_status: ret = kexec_status(uarg); break; + + default: + ret = -EOPNOTSUPP; + break; } clear_bit(KEXEC_FLAG_IN_HYPERCALL, &kexec_flags);