[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/kexec: return error code for unknown hypercalls



commit 1ee8b11c1106dca6b8fe0d54c0e79146bb6545f0
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Fri Feb 6 19:19:48 2026 +0100
Commit:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
CommitDate: Fri Feb 6 20:56:16 2026 +0100

    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: d046f361dc93 ("Xen Security Modules: XSM")
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 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);
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.