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

[Xen-devel] [PATCH v2 7/7] gnttab: properly handle transfer slots when changing version



Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.
---
Or should we put ourselves on the position that reserved entries aren#t
meant to be used for transfers?

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2755,6 +2755,11 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARA
         {
             switch ( shared_entry_v2(gt, i).hdr.flags & GTF_type_mask )
             {
+            case GTF_accept_transfer:
+                 if ( !(shared_entry_v2(gt, i).hdr.flags &
+                        GTF_transfer_completed) )
+                     break;
+                 /* fall through */
             case GTF_permit_access:
                  if ( !(shared_entry_v2(gt, i).full_page.frame >> 32) )
                      break;
@@ -2784,13 +2789,17 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARA
             switch ( flags & GTF_type_mask )
             {
             case GTF_permit_access:
-                reserved_entries[i].flags = flags | status_entry(gt, i);
+                flags |= status_entry(gt, i);
+                /* fall through */
+            case GTF_accept_transfer:
+                reserved_entries[i].flags = flags;
                 reserved_entries[i].domid = shared_entry_v2(gt, i).hdr.domid;
                 reserved_entries[i].frame = shared_entry_v2(gt, 
i).full_page.frame;
                 break;
+
             default:
                 gdprintk(XENLOG_INFO,
-                         "bad flags %#x in grant %#x when switching version\n",
+                         "unstable flags %#x in grant %#x when switching 
version\n",
                          flags, i);
                 /* fall through */
             case GTF_invalid:
@@ -2819,10 +2828,20 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARA
         case 2:
             for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES; i++ )
             {
-                status_entry(gt, i) =
-                    reserved_entries[i].flags & (GTF_reading | GTF_writing);
-                shared_entry_v2(gt, i).hdr.flags =
-                    reserved_entries[i].flags & ~(GTF_reading | GTF_writing);
+                if ( (reserved_entries[i].flags & GTF_type_mask) !=
+                     GTF_accept_transfer )
+                {
+                    status_entry(gt, i) =
+                        reserved_entries[i].flags & (GTF_reading | 
GTF_writing);
+                    shared_entry_v2(gt, i).hdr.flags =
+                        reserved_entries[i].flags & ~(GTF_reading | 
GTF_writing);
+                }
+                else
+                {
+                    status_entry(gt, i) = 0;
+                    shared_entry_v2(gt, i).hdr.flags =
+                        reserved_entries[i].flags;
+                }
                 shared_entry_v2(gt, i).hdr.domid =
                     reserved_entries[i].domid;
                 shared_entry_v2(gt, i).full_page.frame =




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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