Commit 5ec15bf2 authored by Tikhomirov Pavel's avatar Tikhomirov Pavel Committed by Pavel Emelyanov

page-read: add proper processing of return value

when get an error reading image file need stop restore
Signed-off-by: 's avatarTikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent b7529fe8
...@@ -382,7 +382,7 @@ static int restore_priv_vma_content(pid_t pid) ...@@ -382,7 +382,7 @@ static int restore_priv_vma_content(pid_t pid)
ret = pr.read_page(&pr, va, buf); ret = pr.read_page(&pr, va, buf);
if (ret < 0) if (ret < 0)
break; goto err_read;
va += PAGE_SIZE; va += PAGE_SIZE;
if (memcmp(p, buf, PAGE_SIZE) == 0) { if (memcmp(p, buf, PAGE_SIZE) == 0) {
...@@ -394,7 +394,7 @@ static int restore_priv_vma_content(pid_t pid) ...@@ -394,7 +394,7 @@ static int restore_priv_vma_content(pid_t pid)
} else { } else {
ret = pr.read_page(&pr, va, p); ret = pr.read_page(&pr, va, p);
if (ret < 0) if (ret < 0)
break; goto err_read;
va += PAGE_SIZE; va += PAGE_SIZE;
} }
...@@ -405,6 +405,7 @@ static int restore_priv_vma_content(pid_t pid) ...@@ -405,6 +405,7 @@ static int restore_priv_vma_content(pid_t pid)
pr.put_pagemap(&pr); pr.put_pagemap(&pr);
} }
err_read:
pr.close(&pr); pr.close(&pr);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
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