]> xenbits.xensource.com Git - people/pauldu/xen.git/commitdiff
tools/libs: xenforeignmemory_unmap_resource() should be idempotent...
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 27 Nov 2018 16:39:17 +0000 (16:39 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 27 Nov 2018 16:58:36 +0000 (16:58 +0000)
...and is not because linux osdep_xenforeignmemory_unmap_resource() is not.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libs/foreignmemory/linux.c

index 132875df8a202800fdc3569545ce0ad1da25661a..8daa5828e3da2f1d0dee158ff91e8ba2274a4625 100644 (file)
@@ -298,7 +298,7 @@ int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem,
 int osdep_xenforeignmemory_unmap_resource(
     xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
 {
-    return munmap(fres->addr, fres->nr_frames << PAGE_SHIFT);
+    return fres ? munmap(fres->addr, fres->nr_frames << PAGE_SHIFT) : 0;
 }
 
 int osdep_xenforeignmemory_map_resource(