xen/kexec: return error code for unknown hypercalls

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: d046f361dc ("Xen Security Modules: XSM")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 1ee8b11c11
master date: 2026-02-06 20:56:16 +0100
This commit is contained in:
Roger Pau Monné authored and Jan Beulich committed 2026-02-11 12:17:57 +01:00
1 parent d2a6413550
commit 867b7d3f97
1 file changed
+5 -1
+5 -1
View File
@@ -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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.