summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2020-07-18 17:16:42 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-07-18 17:16:42 +0200
commit71122358ba9349753eb11f13a9cc9249ba25f1ff (patch)
tree3a8930804b1f5fc9a53a8fdfd6f56b300ad12005
parentcdf3ed4f50b675d9d485a76b6e1baa0cf1dd6a5a (diff)
rumpdisk: link the bd on success only
Otherwise we would crash after an unsuccessful device_open call.
-rw-r--r--rumpdisk/block-rump.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rumpdisk/block-rump.c b/rumpdisk/block-rump.c
index b361c15f..42ace30d 100644
--- a/rumpdisk/block-rump.c
+++ b/rumpdisk/block-rump.c
@@ -154,8 +154,6 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type,
bd->mode = mode;
bd->device.emul_data = bd;
bd->device.emul_ops = &rump_block_emulation_ops;
- bd->next = block_head;
- block_head = bd;
err = rump_sys_open (dev_name, dev_mode_to_rump_mode (bd->mode));
if (err < 0)
@@ -199,6 +197,8 @@ out:
if (bd)
{
+ bd->next = block_head;
+ block_head = bd;
*devp = ports_get_right (bd);
*devicePoly = MACH_MSG_TYPE_MAKE_SEND;
}