kvm tools: Fix attempt to free mmaped memory
PATCH 1/1 kvm tools: Fix attempt to free mmaped memory
Framebuffer memory which was mmap() is being free() at the shutdown of the guest, leading to glibc errors.
Signed-off-by Sasha Levin <[email protected]>
--- tools/kvm/framebuffer.c | 3 ++- tools/kvm/hw/vesa.c | 1 + tools/kvm/include/kvm/framebuffer.h | 1 + 3 files changed, 4 insertions(+), 1 deletions(-)
tools/kvm/framebuffer.c +2 -1
@@ -3,6 +3,7 @@#include <linux/kernel.h> #include <linux/list.h> #include <stdlib.h> +#include <sys/mman.h> static LIST_HEAD (framebuffers);
@@ -62,6 +63,6 @@ void fb__stop(void)struct framebuffer *fb;list_for_each_entry (fb, &framebuffers, node) { -free (fb->mem); +munmap (fb->mem, fb->mem_size); } }
tools/kvm/hw/vesa.c +1 -0
@@ -70,6 +70,7 @@ struct framebuffer *vesa__init(struct kvm *kvm) .depth = VESA_BPP, .mem = mem, .mem_addr = VESA_MEM_ADDR, + .mem_size = VESA_MEM_SIZE, };return fb__register (&vesafb); }
tools/kvm/include/kvm/framebuffer.h +1 -0
@@ -20,6 +20,7 @@ struct framebuffer {u8 depth;char *mem;u64 mem_addr; +u64 mem_size;unsigned long nr_targets;struct fb_target_operations *targets[FB_MAX_TARGETS ];
Signature · 1 line
1.7.5.3