Le 27/09/2014 17:51, Christos Zoulas a écrit :
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?


Yes perhaps. But you should ask someone else...

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;
        }
        return 0;



Reply via email to