If remapping of vDSO blob failed on vvar mapping,
we need to unmap previously mapped vDSO blob.

Cc: Andy Lutomirski <l...@kernel.org>
Cc: Oleg Nesterov <o...@redhat.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: "H. Peter Anvin" <h...@zytor.com>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: linux...@kvack.org
Cc: x...@kernel.org
Cc: Cyrill Gorcunov <gorcu...@openvz.org>
Cc: Pavel Emelyanov <xe...@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafo...@virtuozzo.com>
Acked-by: Andy Lutomirski <l...@kernel.org>
---
 arch/x86/entry/vdso/vma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index f840766659a8..3bab6ba3ffc5 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -238,12 +238,14 @@ static int map_vdso(const struct vdso_image *image, bool 
calculate_addr)
 
        if (IS_ERR(vma)) {
                ret = PTR_ERR(vma);
-               goto up_fail;
+               do_munmap(mm, text_start, image->size);
        }
 
 up_fail:
-       if (ret)
+       if (ret) {
                current->mm->context.vdso = NULL;
+               current->mm->context.vdso_image = NULL;
+       }
 
        up_write(&mm->mmap_sem);
        return ret;
-- 
2.9.0

Reply via email to