[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] unlink the bs from bdrv-list upon bdrv_delete(bs)
From: |
Uri Lublin |
Subject: |
[Qemu-devel] [PATCH] unlink the bs from bdrv-list upon bdrv_delete(bs) |
Date: |
Tue, 1 Apr 2008 08:37:04 -0700 |
In bdrv_delete(bs) bs memory is freed but bs is not unlinked from the block driver list.
That may cause a segmentation fault later when the block driver list is walked,
for example upon 'info block'.
This patch unlinks bs from bdrv-list.
Signed-off-by: Uri Lublin <address@hidden>
Index: block.c
===================================================================
RCS file: /sources/qemu/qemu/block.c,v
retrieving revision 1.56
diff -u -r1.56 block.c
--- block.c 11 Mar 2008 23:30:21 -0000 1.56
+++ block.c 1 Apr 2008 15:11:41 -0000
@@ -452,7 +452,14 @@
void bdrv_delete(BlockDriverState *bs)
{
- /* XXX: remove the driver list */
+ BlockDriverState **pbs;
+
+ pbs = &bdrv_first;
+ while (*pbs != bs && *pbs != NULL)
+ pbs = &(*pbs)->next;
+ if (*pbs == bs)
+ *pbs = bs->next;
+
bdrv_close(bs);
qemu_free(bs);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] unlink the bs from bdrv-list upon bdrv_delete(bs),
Uri Lublin <=