diff options
author | Roy Li <rongqing.li@windriver.com> | 2016-05-24 13:28:00 +0800 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2016-05-25 09:41:44 -0400 |
commit | dc7ab5bea574500d745e0cef4c36c0cbeca1e251 (patch) | |
tree | 1a22a3a58bde62b314140b7295a447dc5937a82d | |
parent | 16a31ef4a84d46dd358e899fa8c0dd9e2703ecbb (diff) | |
download | meta-virtualization-dc7ab5bea574500d745e0cef4c36c0cbeca1e251.tar.gz |
libvirt-python: backport a patch to fix crash in getAllDomainStats
Upstream libvirt Commits 1d39dbaf and 827ed9b4 broke the libvirt-python API
by removing virDomainRef() and virDomainFree(). virDomainStatsRecordListFree() will
free that domain pointer and later when virDomain (python object) call
its destructor and tries to free that same pointer again.
Signed-off-by: Roy Li <rongqing.li@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r-- | recipes-extended/libvirt/libvirt-python.inc | 1 | ||||
-rw-r--r-- | recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch | 57 |
2 files changed, 58 insertions, 0 deletions
diff --git a/recipes-extended/libvirt/libvirt-python.inc b/recipes-extended/libvirt/libvirt-python.inc index c1dafe9d..405d5f74 100644 --- a/recipes-extended/libvirt/libvirt-python.inc +++ b/recipes-extended/libvirt/libvirt-python.inc | |||
@@ -17,6 +17,7 @@ FILES_${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" | |||
17 | 17 | ||
18 | SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python" | 18 | SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python" |
19 | SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}" | 19 | SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}" |
20 | SRC_URI += "file://0001-fix-crash-in-getAllDomainStats.patch;patchdir=../libvirt-python-${PV}" | ||
20 | 21 | ||
21 | SRC_URI[libvirt_python.md5sum] = "ed018c714d7ddbe93221c796dff283ed" | 22 | SRC_URI[libvirt_python.md5sum] = "ed018c714d7ddbe93221c796dff283ed" |
22 | SRC_URI[libvirt_python.sha256sum] = "6d35ae9e7801573393b9c92471f39e6700d479f10b641df81d041b469f160bf8" | 23 | SRC_URI[libvirt_python.sha256sum] = "6d35ae9e7801573393b9c92471f39e6700d479f10b641df81d041b469f160bf8" |
diff --git a/recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch b/recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch new file mode 100644 index 00000000..0583a940 --- /dev/null +++ b/recipes-extended/libvirt/libvirt/0001-fix-crash-in-getAllDomainStats.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From e9c4e2abffef007a28112ebb40a9586b0128f10b Mon Sep 17 00:00:00 2001 | ||
2 | From: Pavel Hrdina <phrdina@redhat.com> | ||
3 | Date: Mon, 18 Apr 2016 16:53:50 +0200 | ||
4 | Subject: [PATCH] fix crash in getAllDomainStats | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | |||
8 | Commits 1d39dbaf and 827ed9b4 broke the libvirt-python API by removing | ||
9 | virDomainRef() and virDomainFree(). virDomainStatsRecordListFree() will | ||
10 | free that domain pointer and later when virDomain (python object) call | ||
11 | its destructor and tries to free that same pointer again. | ||
12 | |||
13 | Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1326839 | ||
14 | |||
15 | Signed-off-by: Pavel Hrdina <phrdina@redhat.com> | ||
16 | --- | ||
17 | libvirt-override.c | 8 +++++++- | ||
18 | 1 file changed, 7 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/libvirt-override.c b/libvirt-override.c | ||
21 | index 4640ed5..2de95ce 100644 | ||
22 | --- a/libvirt-override.c | ||
23 | +++ b/libvirt-override.c | ||
24 | @@ -8381,6 +8381,7 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records, | ||
25 | PyObject *py_retval; | ||
26 | PyObject *py_record; | ||
27 | PyObject *py_record_stats = NULL; | ||
28 | + virDomainPtr dom = NULL; | ||
29 | size_t i; | ||
30 | |||
31 | if (!(py_retval = PyList_New(nrecords))) | ||
32 | @@ -8392,9 +8393,12 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records, | ||
33 | |||
34 | VIR_PY_LIST_SET_GOTO(py_retval, i, py_record, error); | ||
35 | |||
36 | + dom = records[i]->dom; | ||
37 | + virDomainRef(dom); | ||
38 | VIR_PY_TUPLE_SET_GOTO(py_record, 0, | ||
39 | - libvirt_virDomainPtrWrap(records[i]->dom), | ||
40 | + libvirt_virDomainPtrWrap(dom), | ||
41 | error); | ||
42 | + dom = NULL; | ||
43 | |||
44 | if (!(py_record_stats = getPyVirTypedParameter(records[i]->params, | ||
45 | records[i]->nparams))) | ||
46 | @@ -8406,6 +8410,8 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records, | ||
47 | return py_retval; | ||
48 | |||
49 | error: | ||
50 | + if (dom) | ||
51 | + virDomainFree(dom); | ||
52 | Py_XDECREF(py_retval); | ||
53 | return NULL; | ||
54 | } | ||
55 | -- | ||
56 | 2.8.1 | ||
57 | |||