[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 18/36] rbd: Fix use after free in qemu_rbd_set_ke
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH v3 18/36] rbd: Fix use after free in qemu_rbd_set_keypairs() error path |
Date: |
Fri, 23 Feb 2018 20:25:31 +0100 |
If we want to include the invalid option name in the error message, we
can't free the string earlier than that.
Cc: address@hidden
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block/rbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/rbd.c b/block/rbd.c
index 8474b0ba11..27fa11b473 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -268,13 +268,14 @@ static int qemu_rbd_set_keypairs(rados_t cluster, const
char *keypairs_json,
key = qstring_get_str(name);
ret = rados_conf_set(cluster, key, qstring_get_str(value));
- QDECREF(name);
QDECREF(value);
if (ret < 0) {
error_setg_errno(errp, -ret, "invalid conf option %s", key);
+ QDECREF(name);
ret = -EINVAL;
break;
}
+ QDECREF(name);
}
QDECREF(keypairs);
--
2.13.6
- [Qemu-devel] [PATCH v3 08/36] util: Add qemu_opts_to_qdict_filtered(), (continued)
- [Qemu-devel] [PATCH v3 08/36] util: Add qemu_opts_to_qdict_filtered(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 11/36] qdict: Introduce qdict_rename_keys(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 09/36] test-qemu-opts: Test qemu_opts_append(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 10/36] test-qemu-opts: Test qemu_opts_to_qdict_filtered(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 13/36] block: Make bdrv_is_whitelisted() public, Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 16/36] file-win32: Support .bdrv_co_create, Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 14/36] block: x-blockdev-create QMP command, Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 15/36] file-posix: Support .bdrv_co_create, Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 12/36] qcow2: Use visitor for options in qcow2_create(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 17/36] gluster: Support .bdrv_co_create, Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 18/36] rbd: Fix use after free in qemu_rbd_set_keypairs() error path,
Kevin Wolf <=
- [Qemu-devel] [PATCH v3 19/36] rbd: Factor out qemu_rbd_connect(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 21/36] rbd: Pass BlockdevOptionsRbd to qemu_rbd_connect(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 23/36] rbd: Assign s->snap/image_name in qemu_rbd_open(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 22/36] rbd: Support .bdrv_co_create, Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 20/36] rbd: Remove non-schema options from runtime_opts, Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 24/36] rbd: Use qemu_rbd_connect() in qemu_rbd_do_create(), Kevin Wolf, 2018/02/23
- [Qemu-devel] [PATCH v3 25/36] nfs: Use QAPI options in nfs_client_open(), Kevin Wolf, 2018/02/23