Commit 609ce1f9 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

shmem: don't unmap a memrory region in restore_shmem_content()

This function doesn't allocate memory, so it should not release it.

CID 73380 (#1 of 1): Use after free (USE_AFTER_FREE)
14. deref_arg: Calling munmap dereferences freed pointer addr.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c8d8cad1
......@@ -129,7 +129,7 @@ static int restore_shmem_content(void *addr, struct shmem_info *si)
ret = open_page_read(si->shmid, &pr, opts.auto_dedup ? O_RDWR : O_RSTR, true);
if (ret)
goto err_unmap;
return -1;
fd_pg = img_raw_fd(pr.pi);
while (1) {
......@@ -168,9 +168,6 @@ static int restore_shmem_content(void *addr, struct shmem_info *si)
pr.close(&pr);
return ret;
err_unmap:
munmap(addr, si->size);
return -1;
}
int get_shmem_fd(int pid, VmaEntry *vi)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment