git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Security: Mitigate possible privilege escalation via SG_IO ioctl (CVE-2011-4127,...
[libguestfs.git]
/
python
/
guestfs-py-byhand.c
diff --git
a/python/guestfs-py-byhand.c
b/python/guestfs-py-byhand.c
index
af9686f
..
29be83b
100644
(file)
--- a/
python/guestfs-py-byhand.c
+++ b/
python/guestfs-py-byhand.c
@@
-91,6
+91,7
@@
py_guestfs_event_callback_wrapper (guestfs_h *g,
const char *buf, size_t buf_len,
const uint64_t *array, size_t array_len)
{
const char *buf, size_t buf_len,
const uint64_t *array, size_t array_len)
{
+ PyGILState_STATE py_save = PyGILState_UNLOCKED;
PyObject *py_callback = callback;
PyObject *py_array;
PyObject *args;
PyObject *py_callback = callback;
PyObject *py_array;
PyObject *args;
@@
-109,7
+110,14
@@
py_guestfs_event_callback_wrapper (guestfs_h *g,
(unsigned PY_LONG_LONG) event, event_handle,
buf, buf_len, py_array);
(unsigned PY_LONG_LONG) event, event_handle,
buf, buf_len, py_array);
+ if (PyEval_ThreadsInitialized ())
+ py_save = PyGILState_Ensure ();
+
py_r = PyEval_CallObject (py_callback, args);
py_r = PyEval_CallObject (py_callback, args);
+
+ if (PyEval_ThreadsInitialized ())
+ PyGILState_Release (py_save);
+
Py_DECREF (args);
if (py_r != NULL)
Py_DECREF (args);
if (py_r != NULL)