Skip to contentSkip to conversation

xen: fix domain unlocking in some xsm error paths

PATCH In review Matthew Daley 3 participants 3 messages Feb 28, 2013 – Mar 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: fix domain unlocking in some xsm error paths

A couple of xsm error/access-denied code paths in hypercalls neglect to unlock a previously locked domain. Fix by ensuring the domains are unlocked correctly.

---
 xen/arch/x86/physdev.c   |    2 +-
 xen/common/grant_table.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/physdev.c +1 -1
index d9ed5df..3006266 100644
@@ -111,7 +111,7 @@ int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p,
 
     ret = xsm_map_domain_pirq(XSM_TARGET, d);
     if ( ret )
-        return ret;
+        goto free_domain;
 
     /* Verify or get irq. */
     switch ( type )
xen/common/grant_table.c +1 -1
index f85adb4..5bd99b8 100644
@@ -2283,7 +2283,7 @@ gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t) uop,
     rc = xsm_grant_setup(XSM_TARGET, current->domain, d);
     if ( rc ) {
         op.status = GNTST_permission_denied;
-        goto out1;
+        goto out2;
     }
 
     gt = d->grant_table;
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Matthew Daley

A couple of xsm error/access-denied code paths in hypercalls neglect to unlock a previously locked domain. Fix by ensuring the domains are unlocked correctly.

xen/arch/x86/physdev.c int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p, · line 117

Quoted 11 lines
xen/arch/x86/physdev.c +1 -1
@@ -111,7 +111,7 @@ int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p,
 
     ret = xsm_map_domain_pirq(XSM_TARGET, d);
     if ( ret )
-        return ret;
+        goto free_domain;
 
     /* Verify or get irq. */
     switch ( type )

So it looks like this is a regression from Daniel's recent XSM rework.

xen/common/grant_table.c gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t) uop, · line 2289

Quoted 11 lines
xen/common/grant_table.c +1 -1
@@ -2283,7 +2283,7 @@ gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t) uop,
     rc = xsm_grant_setup(XSM_TARGET, current->domain, d);
     if ( rc ) {
         op.status = GNTST_permission_denied;
-        goto out1;
+        goto out2;
     }
 
     gt = d->grant_table;

Whereas this is something that is broken already in 4.2 (but not in 4.1). I'll try to remember to pick this up for 4.2 once it got applied and came out of staging.

Jan

Acked-by
#2 lore raw
Quoted 8 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Matthew Daley

A couple of xsm error/access-denied code paths in hypercalls neglect to unlock a previously locked domain. Fix by ensuring the domains are unlocked correctly.

Quoted 40 lines
Quoted 11 lines
xen/arch/x86/physdev.c +1 -1
@@ -111,7 +111,7 @@ int physdev_map_pirq(domid_t domid, int type, int *index,
 int *pirq_p,
 
     ret = xsm_map_domain_pirq(XSM_TARGET, d);
     if ( ret )
-        return ret;
+        goto free_domain;
 
     /* Verify or get irq. */
Quoted 1 line

switch ( type )

So it looks like this is a regression from Daniel's recent XSM rework.

Quoted 12 lines
xen/common/grant_table.c +1 -1
@@ -2283,7 +2283,7 @@
 gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t)
 uop,
     rc = xsm_grant_setup(XSM_TARGET, current->domain, d);
     if ( rc ) {
         op.status = GNTST_permission_denied;
-        goto out1;
+        goto out2;
     }
Quoted 1 line
     gt = d->grant_table;

Whereas this is something that is broken already in 4.2 (but not in 4.1). I'll try to remember to pick this up for 4.2 once it got applied and came out of staging.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel