From 19ae2464c0800965c18c35132b0b6c7fe09d5f68 Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Wed, 2 Oct 2013 07:15:44 -0400 Subject: features/qemu-block: invoke bdrv_init() only once bdrv_init() is intended to be invoked only once. If invoked again after initialization (i.e., due to graph changes), the block driver registration code can reinsert entries into bdrv_drivers, effectively corrupting the NULL terminated linked list. This manifests as an infinite loop for callers attempt to traverse the list (to locate a driver). BUG: 986775 Change-Id: I2f95bda3c753dece4648cdad009d0e2a2d16f644 Signed-off-by: Brian Foster Reviewed-on: http://review.gluster.org/6021 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/features/qemu-block/src/qemu-block.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'xlators/features') diff --git a/xlators/features/qemu-block/src/qemu-block.c b/xlators/features/qemu-block/src/qemu-block.c index 81afb95e169..416ae44383c 100644 --- a/xlators/features/qemu-block/src/qemu-block.c +++ b/xlators/features/qemu-block/src/qemu-block.c @@ -982,6 +982,7 @@ init (xlator_t *this) { qb_conf_t *conf = NULL; int32_t ret = -1; + static int bdrv_inited = 0; if (!this->children || this->children->next) { gf_log (this->name, GF_LOG_ERROR, @@ -1018,7 +1019,10 @@ init (xlator_t *this) cur_mon = (void *) 1; - bdrv_init (); + if (!bdrv_inited) { + bdrv_init (); + bdrv_inited = 1; + } out: if (ret) -- cgit