[Spice-devel] [spice-gtk v1 3/4] channel-usbredir: use mutex on polkit code path

Victor Toso victortoso at redhat.com
Tue May 7 08:56:04 UTC 2019


From: Victor Toso <me at victortoso.com>

Explanation on this mutex in commit 4eea5f3 in 2016-03-24 by Kirill
Moizik <kmoizik at redhat.com>. This is missing in the polkit code path
and its the major difference with _open_device_async_cb() callback.

Next patch will remove _open_device_async_cb() to keep code path for
access control mandatory there so add this lock/unlock now with some
context on why.

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/channel-usbredir.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 1910ff6..5214160 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -338,7 +338,9 @@ static void spice_usbredir_channel_open_acl_cb(
                                   "USB redirection channel connect cancelled");
     }
     if (!err) {
+        spice_usbredir_channel_lock(channel);
         spice_usbredir_channel_open_device(channel, &err);
+        spice_usbredir_channel_unlock(channel);
     }
     if (err) {
         libusb_unref_device(priv->device);
-- 
2.20.1



More information about the Spice-devel mailing list