]> xenbits.xensource.com Git - xen.git/commitdiff
gnttab: adjust unmap checking of dev_bus_addr
authorJan Beulich <jbeulich@suse.com>
Tue, 7 Sep 2021 07:37:50 +0000 (09:37 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 7 Sep 2021 07:37:50 +0000 (09:37 +0200)
There's no point checking ->dev_bus_addr when GNTMAP_device_map isn't
set (and hence the field isn't going to be consumed). And if there is a
mismatch, use the so far unused GNTST_bad_dev_addr error indicator - if
not here, where else would this (so far unused) value be used?

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/common/grant_table.c

index da687acc61710c4dbfc5dc9c69677c506626db5f..df74e2d6a7fd81d4cc63f53fd51153eac694f86a 100644 (file)
@@ -1450,9 +1450,9 @@ unmap_common(
 
     op->mfn = act->mfn;
 
-    if ( op->dev_bus_addr &&
+    if ( op->dev_bus_addr && (flags & GNTMAP_device_map) &&
          unlikely(op->dev_bus_addr != mfn_to_maddr(act->mfn)) )
-        PIN_FAIL(act_release_out, GNTST_general_error,
+        PIN_FAIL(act_release_out, GNTST_bad_dev_addr,
                  "Bus address doesn't match gntref (%"PRIx64" != %"PRIpaddr")\n",
                  op->dev_bus_addr, mfn_to_maddr(act->mfn));