diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index e0f306f268..15262819e1 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3183,11 +3183,12 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARAM(gnttab_set_version_t) uop) if ( op.version == 2 && gt->max_version == 1 ) goto out; /* Behave as before set_version was introduced. */ + grant_write_lock(gt); + res = 0; if ( gt->gt_version == op.version ) - goto out; + goto out_unlock; - grant_write_lock(gt); /* * Make sure that the grant table isn't currently in use when we * change the version number, except for the first 8 entries which