[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 019/113] rbd: Fix use after free in qemu_rbd_set_key

From: Michael Roth
Subject: [Qemu-devel] [PATCH 019/113] rbd: Fix use after free in qemu_rbd_set_keypairs() error path
Date: Mon, 18 Jun 2018 20:41:45 -0500

From: Kevin Wolf <address@hidden>

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>
(cherry picked from commit 71c87815f9e0386b6f3e22942adc956fd603c82f)
Signed-off-by: Michael Roth <address@hidden>
 block/rbd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/rbd.c b/block/rbd.c
index a76a5e8755..2de434dfdd 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -265,13 +265,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);
         if (ret < 0) {
             error_setg_errno(errp, -ret, "invalid conf option %s", key);
+            QDECREF(name);
             ret = -EINVAL;
+        QDECREF(name);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]