Skip to contentSkip to conversation

Merge io/ 2017/01/26

GIT PULL Applied Daniel P. Berrange 2 participants 3 messages Jan 26, 2017 – Jan 27, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit c7f1cf01b8245762ca5864e835d84f6677ae8b1f:

Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging (2017-01-25 17:54:14 +0000)

are available in the git repository at:

git://github.com/berrange/qemu tags/pull-qio-2017-01-26-1

for you to fetch changes up to 80fb34eda099e7cc519a91e9701ab3c0262717b3:

io: fix possible double free of task error object (2017-01-26 10:26:18 +0000)

----------------------------------------------------------------
Merge io/ 2017/01/26

----------------------------------------------------------------
Daniel P. Berrange (1):
io: fix possible double free of task error object

 io/task.c            | 1 +
 tests/test-io-task.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL v1] io: fix possible double free of task error object

If a QIOTask has an error set and the calling code uses qio_task_propagate_error() to steal the reference to that Error object, the task would not clear its own reference. This would lead to a double-free when qio_task_free runs, if the caller had (correctly) freed the Error object they now owned.

---
 io/task.c            | 1 +
 tests/test-io-task.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
io/task.c +1 -0
index 60bf1a9..3ce5560 100644
@@ -157,6 +157,7 @@ bool qio_task_propagate_error(QIOTask *task,
 {
     if (task->err) {
         error_propagate(errp, task->err);
+        task->err = NULL;
         return true;
     }
 
tests/test-io-task.c +3 -1
index ff62272..141aa2c 100644
@@ -127,7 +127,7 @@ static void test_task_failure(void)
     g_assert(data.source == obj);
     g_assert(data.err == err);
     g_assert(data.freed == false);
-
+    error_free(data.err);
 }
 
 
@@ -238,6 +238,8 @@ static void test_task_thread_failure(void)
     g_assert(data.source == obj);
     g_assert(data.err != NULL);
 
+    error_free(data.err);
+
     self = g_thread_self();
 
     /* Make sure the test_task_thread_worker actually got
Signature · 1 line
2.9.3
#2 lore raw
In reply to Daniel P. Berrange
Quoted 10 lines · Daniel P. Berrange

The following changes since commit c7f1cf01b8245762ca5864e835d84f6677ae8b1f:

Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging (2017-01-25 17:54:14 +0000)

are available in the git repository at:

git://github.com/berrange/qemu tags/pull-qio-2017-01-26-1

for you to fetch changes up to 80fb34eda099e7cc519a91e9701ab3c0262717b3:

Quoted 8 lines

io: fix possible double free of task error object (2017-01-26 10:26:18 +0000)

----------------------------------------------------------------
Merge io/ 2017/01/26

----------------------------------------------------------------
Daniel P. Berrange (1):
io: fix possible double free of task error object

Applied, thanks.

-- PMM