Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/xen/xen



On Sep 27,  8:36am, max%M00nBSD.net@localhost (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;
 	}
 	return 0;



Home | Main Index | Thread Index | Old Index