diff options
author | Philip Langdale <philipl@overt.org> | 2013-01-23 09:07:22 -0800 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2013-01-23 09:09:04 -0800 |
commit | 2ad82f2751b4a13dbcf8e7373a386019982bb43b (patch) | |
tree | 459e51533d6b28afb192ba0f2e912b35f625936e /daemon/gvfsbackendmtp.h | |
parent | 1d752664a9ac6c6535c66ed26dcd01ee2d7c49c3 (diff) | |
download | gvfs-2ad82f2751b4a13dbcf8e7373a386019982bb43b.tar.gz |
MTP: Fix race between on_uevent and do_unmount.
I've never seen this happen personally, but an Ubuntu bug reported
that on_uevent fired after the gudev client had been finalized, so
it must be possible to race between an explicit unmount and
physically unplugging a device. I made a brief attempt to reproduce
this but couldn't.
In any case, it's easy enough to protect against by taking a few
measures:
1) Explicitly disconnect the signal handler before unref'ing the
gudev client.
2) Use g_signal_connect_object to keep the backend alive enough
for on_uevent to complete.
3) NULL out the dev_path so that if we end up in on_uevent after
do_unmount has cleared the dev_path, the compare will fail
gracefully.
Diffstat (limited to 'daemon/gvfsbackendmtp.h')
-rw-r--r-- | daemon/gvfsbackendmtp.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/daemon/gvfsbackendmtp.h b/daemon/gvfsbackendmtp.h index 9dbaa0c4..4137b65b 100644 --- a/daemon/gvfsbackendmtp.h +++ b/daemon/gvfsbackendmtp.h @@ -47,6 +47,7 @@ struct _GVfsBackendMtp #ifdef HAVE_GUDEV GUdevClient *gudev_client; + gulong on_uevent_id; #endif GMutex mutex; |