return 0;
}
-static int cache_flush(gnttab_cache_flush_t *cflush, grant_ref_t *cur_ref)
+static int cache_flush(const gnttab_cache_flush_t *cflush, grant_ref_t *cur_ref)
{
struct domain *d, *owner;
struct page_info *page;
if ( (cflush->offset >= PAGE_SIZE) ||
(cflush->length > PAGE_SIZE) ||
- (cflush->offset + cflush->length > PAGE_SIZE) )
+ (cflush->offset + cflush->length > PAGE_SIZE) ||
+ (cflush->op & ~(GNTTAB_CACHE_INVAL | GNTTAB_CACHE_CLEAN)) )
return -EINVAL;
if ( cflush->length == 0 || cflush->op == 0 )
- return 0;
+ return !*cur_ref ? 0 : -EILSEQ;
/* currently unimplemented */
if ( cflush->op & GNTTAB_CACHE_SOURCE_GREF )
return -EOPNOTSUPP;
- if ( cflush->op & ~(GNTTAB_CACHE_INVAL|GNTTAB_CACHE_CLEAN) )
- return -EINVAL;
-
d = rcu_lock_current_domain();
mfn = cflush->a.dev_bus_addr >> PAGE_SHIFT;
*cur_ref = 0;
guest_handle_add_offset(uop, 1);
}
+
+ *cur_ref = 0;
+
return 0;
}