diff options
author | Michael Tretter <m.tretter@pengutronix.de> | 2017-12-08 14:46:02 +0100 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2018-01-12 19:10:35 +0100 |
commit | aed4088967eec97de81a1c914f87fdbae09a19e8 (patch) | |
tree | 18a6a1b56d0c1c7739f684304eee5d84556f4e7d | |
parent | 089b8982e9816def693890a96882f370ea287f47 (diff) |
vaapipostproc: lock ensure_filter with postproc_lock
gst_vaapipostproc_ensure_filter might free the allowed_srcpad_caps
and allowed_sinkpad_caps. This can race with copying these caps in
gst_vaapipostproc_transform_caps and lead to segfaults.
The gst_vaapipostproc_transform_caps function already locks
postproc_lock before copying the caps. Make sure that calls to
gst_vaapipostproc_ensure_filter also acquire this lock.
https://bugzilla.gnome.org/show_bug.cgi?id=791404
-rw-r--r-- | gst/vaapi/gstvaapipostproc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index e8287414..e0f6aebb 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -306,7 +306,9 @@ gst_vaapipostproc_start (GstBaseTransform * trans) ds_reset (&postproc->deinterlace_state); if (!gst_vaapi_plugin_base_open (GST_VAAPI_PLUGIN_BASE (postproc))) return FALSE; + g_mutex_lock (&postproc->postproc_lock); gst_vaapipostproc_ensure_filter (postproc); + g_mutex_unlock (&postproc->postproc_lock); return TRUE; } @@ -1881,8 +1883,12 @@ cb_channels_init (GstVaapiPostproc * postproc) if (postproc->cb_channels) return; - if (!gst_vaapipostproc_ensure_filter (postproc)) + g_mutex_lock (&postproc->postproc_lock); + if (!gst_vaapipostproc_ensure_filter (postproc)) { + g_mutex_unlock (&postproc->postproc_lock); return; + } + g_mutex_unlock (&postproc->postproc_lock); filter_ops = postproc->filter_ops ? g_ptr_array_ref (postproc->filter_ops) : gst_vaapi_filter_get_operations (postproc->filter); |