[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] tools/libs: xenforeignmemory_unmap_resource() should be idempotent...

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

Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>

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(-)

diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index 132875df8a..8daa5828e3 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -298,7 +298,7 @@ int osdep_xenforeignmemory_restrict(xenforeignmemory_handle 
 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(

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.