On Sat, Sep 27, 2014 at 11:51:59AM -0400, Christos Zoulas wrote:
> On Sep 27,  8:36am, m...@m00nbsd.net (Maxime Villard) wrote:
> -- Subject: Re: CVS commit: src/sys/arch/xen/xen
> 
> | One however returns an error without freeing:
> | 
> |     if (newstart != start) {
> |             printf("uvm_map didn't give us back our vm space\n");
> |             return EINVAL;
> |     }
> | 
> | I think this one is the real bug; isn't it?
> 
> So the fix should be this, right?
> 
> christos
> 
> Index: privcmd.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/xen/xen/privcmd.c,v
> retrieving revision 1.47
> diff -u -u -r1.47 privcmd.c
> --- privcmd.c 21 Sep 2014 16:56:44 -0000      1.47
> +++ privcmd.c 27 Sep 2014 15:50:56 -0000
> @@ -576,12 +576,13 @@
>       if (error) {
>               if (obj)
>                       obj->uobj.pgops->pgo_detach(&obj->uobj);
> -             kmem_free(maddr, sizeof(paddr_t) * npages);
> -             kmem_free(obj, sizeof(*obj));
>               return error;
>       }
>       if (newstart != start) {
>               printf("uvm_map didn't give us back our vm space\n");
> +             uvm_unmap1(map, newstart, newstart + size, 0);
> +             if (obj)
> +                     obj->uobj.pgops->pgo_detach(&obj->uobj);
>               return EINVAL;
>       }

where is obj freed then ?

-- 
Manuel Bouyer <bou...@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

Reply via email to