Skip to contentSkip to conversation

tools/libs: xenforeignmemory_unmap_resource() should be idempotent...

PATCH In review Paul Durrant 2 participants 2 messages Nov 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libs: xenforeignmemory_unmap_resource() should be idempotent...

...and is not because linux osdep_xenforeignmemory_unmap_resource() is not.

---
Cc: Andrew Cooper <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

This is an alternative to the similarly named patch posted by Andrew. This one fixes the underlying issue in the osdep implementation. Andrew requested this be backported to 4.11.

---
 tools/libs/foreignmemory/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/foreignmemory/linux.c +1 -1
index 132875df8a..8daa5828e3 100644
@@ -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(
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel