GNOME Bugzilla – Bug 735569
rtspconnection: Crash due to no protection of watchs readsrc
Last modified: 2014-09-04 09:57:00 UTC
Created attachment 284662 [details] [review] patch for gst-plugins-base This happends due to it is possible to manipulate watchs readsrc from different threads. This is happening when running with multiple client threads in rtsp server. More specific from handle_tunnel when calling gst_rtsp_watch_reset (opriv->watch); ( Observe that opriv is from another client saved in hash_table ) ( Observe same watch Thread4 #4 watch=0x58ced8 Thread12 #11 watch=0x58ced8)
+ Trace 234014
Thread 12 (Thread 21856)
The trace contain two threads. If I just check the "+" sign i only see one. But if I choose to open link in new tab i can see both.
Review of attachment 284662 [details] [review]: The same seems to be true for the writesrc. ::: gst-libs/gst/rtsp/gstrtspconnection.c @@ +2935,3 @@ guint id; GMutex mutex; + GMutex readsrc_mutex; Why not just reuse the existing mutex? @@ +3413,2 @@ if (watch->conn->input_stream) { + g_mutex_lock (&watch->readsrc_mutex); Just put the lock/unlock outside the if/else block
Created attachment 284788 [details] [review] new gst-plugins-base patch New patch with corrections.
commit acdb7feacf5253b661b0c0e5ce5283cb85483849 Author: Göran Jönsson <goranjn@axis.com> Date: Wed Aug 27 13:45:57 2014 +0200 rtspconnection: Protect readsrc, writesrc and controllsrc with a mutex Fixes a crash when controlsrc, readsrc or writesrc are modified from gst_rtsp_source_dispatch_read/write and gst_rtsp_watch_reset at the same time. https://bugzilla.gnome.org/show_bug.cgi?id=735569