1
From 4f8c6d0c8141ee440032796c4a14f01d018a1a75 Mon Sep 17 00:00:00 2001
2
From: Martin Pitt <martinpitt@gnome.org>
3
Date: Mon, 2 Apr 2012 09:18:47 +0200
4
Subject: [PATCH] =?UTF-8?q?Bug=2048173=20=E2=80=94=20Ignore=20add/change=20e?=
5
=?UTF-8?q?vents=20for=20a=20nonexisting=20native=20path?=
7
Content-Type: text/plain; charset=UTF-8
8
Content-Transfer-Encoding: 8bit
10
Devices that need to poll for media sometimes send out change uevents after
13
UDEV [26112.087644] change /sdb (block)
21
(Note the weird device path.) Our current logic treats this change event as
22
add, and creates an /org/freedesktop/UDisks/devices/sdb device for it:
24
**** TREATING CHANGE AS ADD /sys/sdb
26
**** UPDATING /sys/sdb
28
But as the device does not really exist, this is invalid and useless.
30
If a real /dev/sdb comes back later on with an add event, udisks sees that the
31
device already exists, and crashes:
33
(udisks-daemon:24900): udisks-daemon-ERROR **: **** HACK: Wanting to register
34
object at path `/org/freedesktop/UDisks/devices/sdb' but there is already an
35
object there. This is an internal error in the daemon. Aborting.
37
To prevent this, ensure that the native device actually exists before adding an
40
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48173
41
Bug-Ubuntu: https://bugs.launchpad.net/bugs/899757
43
src/device.c | 7 +++++++
44
1 files changed, 7 insertions(+), 0 deletions(-)
46
diff --git a/src/device.c b/src/device.c
47
index f24cb88..2ae7f38 100644
50
@@ -5108,6 +5108,13 @@ device_new (Daemon *daemon,
51
if (g_str_has_prefix (native_path, "/sys/devices/virtual/block/ram"))
54
+ /* ignore bogus events */
55
+ if (!g_file_test (native_path, G_FILE_TEST_EXISTS))
57
+ g_warning ("Ignoring device with nonexisting native path: %s", native_path);
61
PROFILE ("device_new(native_path=%s): start", native_path);
63
device = DEVICE (g_object_new (TYPE_DEVICE, NULL));