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

Submitted by Victor Toso on May 7, 2019, 8:56 a.m.


Message ID 20190507085605.10054-4-victortoso@redhat.com
State New
Headers show
Series "polkit code to be on usb-acl-helper" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Victor Toso May 7, 2019, 8:56 a.m.
From: Victor Toso <me@victortoso.com>

Explanation on this mutex in commit 4eea5f3 in 2016-03-24 by Kirill
Moizik <kmoizik@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@redhat.com>
 src/channel-usbredir.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

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) {