summaryrefslogtreecommitdiff
path: root/source/l/hal/patches/fix_md_crash.diff
diff options
context:
space:
mode:
Diffstat (limited to 'source/l/hal/patches/fix_md_crash.diff')
-rw-r--r--source/l/hal/patches/fix_md_crash.diff45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/l/hal/patches/fix_md_crash.diff b/source/l/hal/patches/fix_md_crash.diff
new file mode 100644
index 00000000..8a404c77
--- /dev/null
+++ b/source/l/hal/patches/fix_md_crash.diff
@@ -0,0 +1,45 @@
+Backported from b35bf1fbfc000749010a27f3f35a95ddf6bb0b07 Mon Sep 17 00:00:00 2001
+From: Chris Coulson <chrisccoulson@googlemail.com>
+Subject: fix crash when assembling certain MD devices
+
+Don't assume that the parent of a volume has storage capability; e. g.
+if we are an MD partition then this is the case as we were re-parented
+to the root computer device object earlier.
+
+FD#21603
+
+--- a/hald/linux/blockdev.c 2008-05-08 01:23:41.000000000 +0200
++++ b/hald/linux/blockdev.c 2009-06-04 12:48:31.000000000 +0200
+@@ -1392,10 +1392,15 @@ hotplug_event_begin_add_blockdev (const
+ hal_device_property_set_bool (d, "volume.is_mounted", FALSE);
+ hal_device_property_set_bool (d, "volume.is_mounted_read_only", FALSE);
+ hal_device_property_set_bool (d, "volume.linux.is_device_mapper", is_device_mapper);
+- hal_device_property_set_bool (
+- d, "volume.is_disc",
+- strcmp (hal_device_property_get_string (parent, "storage.drive_type"), "cdrom") == 0);
+-
++ /* Don't assume that the parent has storage capability, eg
++ * if we are an MD partition then this is the case as we were
++ * re-parented to the root computer device object earlier.
++ */
++ if (hal_device_has_property(parent, "storage.drive_type")) {
++ hal_device_property_set_bool (d, "volume.is_disc", strcmp (hal_device_property_get_string (parent, "storage.drive_type"), "cdrom") == 0);
++ } else {
++ hal_device_property_set_bool (d, "volume.is_disc", FALSE);
++ }
+
+ is_physical_partition = TRUE;
+ if (is_fakevolume || is_device_mapper)
+@@ -1404,8 +1409,10 @@ hotplug_event_begin_add_blockdev (const
+ hal_device_property_set_bool (d, "volume.is_partition", is_physical_partition);
+
+ hal_device_property_set_string (d, "info.category", "volume");
+- if (strcmp(hal_device_property_get_string (parent, "storage.drive_type"), "cdrom") == 0) {
+- hal_device_add_capability (d, "volume.disc");
++ if (hal_device_has_property(parent, "storage.drive_type")) {
++ if (strcmp(hal_device_property_get_string (parent, "storage.drive_type"), "cdrom") == 0) {
++ hal_device_add_capability (d, "volume.disc");
++ }
+ }
+ hal_device_add_capability (d, "volume");
+ hal_device_add_capability (d, "block");