]> xenbits.xensource.com Git - xen.git/commitdiff
xen/sysctl: fix XEN_SYSCTL_getdomaininfolist handling with XSM
authorJuergen Gross <jgross@suse.com>
Tue, 2 May 2023 10:04:58 +0000 (12:04 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 2 May 2023 10:04:58 +0000 (12:04 +0200)
In case XSM is active, the handling of XEN_SYSCTL_getdomaininfolist
can fail if the last domain scanned isn't allowed to be accessed by
the calling domain (i.e. xsm_getdomaininfo(XSM_HOOK, d) is failing).

Fix that by just ignoring scanned domains where xsm_getdomaininfo()
is returning an error, like it is effectively done when such a
situation occurs for a domain not being the last one scanned.

Fixes: d046f361dc93 ("Xen Security Modules: XSM")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/sysctl.c

index 02505ab044b53c90dadba78a282045326d6daec1..0cbfe8bd4467ca6668cdd37dd7696219af3f04ab 100644 (file)
@@ -89,8 +89,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             if ( num_domains == op->u.getdomaininfolist.max_domains )
                 break;
 
-            ret = xsm_getdomaininfo(XSM_HOOK, d);
-            if ( ret )
+            if ( xsm_getdomaininfo(XSM_HOOK, d) )
                 continue;
 
             getdomaininfo(d, &info);