|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH] Null pointer dereference at free_vm_area()
Hi folks,
The free_vm_area() function may crash if it gets a NULL pointer as a
parameter. I do think that the right behaviour should be returning in
this case. This is, for example, the same behaviour of kfree(), and as
alloc_vm_area() may also return NULL, it may lead to a more elegant
alloc/free sequence in case of a fail.
In case you agree with that, a patch follows.
Signed-off-by: Glauber de Oliveira Costa <glommer@xxxxxxxxxx>
--
glommer
diff -r 829517be689f linux-2.6-xen-sparse/drivers/xen/util.c
--- a/linux-2.6-xen-sparse/drivers/xen/util.c Fri Dec 23 15:42:46 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/util.c Mon Dec 26 15:47:50 2005
@@ -35,6 +35,8 @@
void free_vm_area(struct vm_struct *area)
{
struct vm_struct *ret;
+ if (!area)
+ return;
ret = remove_vm_area(area->addr);
BUG_ON(ret != area);
kfree(area);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH] Null pointer dereference at free_vm_area(),
Glauber de Oliveira Costa <=
|
|
|
|
|