Dinge die man lieber nicht wüsste

Kamikaze

Warrior of Sunlight
Staff member
Manchmal wünsche ich mir ich hätte nicht nachgesehen:
Code:
# svn diff -r prev
Index: sys/dev/acpica/acpi_battery.c
===================================================================
--- sys/dev/acpica/acpi_battery.c       (revision 253641)
+++ sys/dev/acpica/acpi_battery.c       (working copy)
@@ -360,6 +360,18 @@
     int error, unit;
     device_t dev;
 
+
+    /*
+     * Giant is acquired to work around a reference counting bug in ACPICA
+     * versions prior to 20130328.  If not for that bug this function could
+     * be executed concurrently without any problems.
+     * The bug is in acpi_BatteryIsPresent -> AcpiGetObjectInfo call tree,
+     * where AcpiUtExecute_HID, AcpiUtExecute_UID, etc are executed without
+     * protection of any ACPICA lock and may concurrently call
+     * AcpiUtRemoveReference on a battery object.
+     */
+    mtx_lock(&Giant);
+
     /* For commands that use the ioctl_arg struct, validate it first. */
     error = ENXIO;
     unit = 0;
@@ -417,6 +429,7 @@
        error = EINVAL;
     }
 
+    mtx_unlock(&Giant);
     return (error);
 }
Ich schätze so kurz vor einem Release kann man sich über solche Workarounds nicht beschweren.
 
Und das ist kein performancekritischer Pfad, weshalb GIANT keine messbaren Auswirkungen haben dürfte.
 
Back
Top