Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'acpi-5.13-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
"These revert one recent commit that turned out to be problematic,
address two issues in the ACPI "custom method" interface and update
GPIO properties documentation.

Specifics:

- Revent recent commit related to the handling of ACPI power
resources during initialization, because it turned out to cause
problems to occur on some systems (Rafael Wysocki).

- Fix potential use-after-free and potential memory leak in the ACPI
"custom method" debugfs interface (Mark Langsdorf).

- Update ACPI GPIO properties documentation to cover assumptions
regarding GPIO polarity (Andy Shevchenko)"

* tag 'acpi-5.13-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
Revert "ACPI: scan: Turn off unused power resources during initialization"
ACPI: custom_method: fix a possible memory leak
ACPI: custom_method: fix potential use-after-free issue
Documentation: firmware-guide: gpio-properties: Add note to SPI CS case

+11 -5
+6
Documentation/firmware-guide/acpi/gpio-properties.rst
··· 99 99 } 100 100 } 101 101 102 + Note, that historically ACPI has no means of the GPIO polarity and thus 103 + the SPISerialBus() resource defines it on the per-chip basis. In order 104 + to avoid a chain of negations, the GPIO polarity is considered being 105 + Active High. Even for the cases when _DSD() is involved (see the example 106 + above) the GPIO CS polarity must be defined Active High to avoid ambiguity. 107 + 102 108 Other supported properties 103 109 ========================== 104 110
+3 -1
drivers/acpi/custom_method.c
··· 42 42 sizeof(struct acpi_table_header))) 43 43 return -EFAULT; 44 44 uncopied_bytes = max_size = table.length; 45 + /* make sure the buf is not allocated */ 46 + kfree(buf); 45 47 buf = kzalloc(max_size, GFP_KERNEL); 46 48 if (!buf) 47 49 return -ENOMEM; ··· 57 55 (*ppos + count < count) || 58 56 (count > uncopied_bytes)) { 59 57 kfree(buf); 58 + buf = NULL; 60 59 return -EINVAL; 61 60 } 62 61 ··· 79 76 add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE); 80 77 } 81 78 82 - kfree(buf); 83 79 return count; 84 80 } 85 81
-1
drivers/acpi/internal.h
··· 142 142 int acpi_power_get_inferred_state(struct acpi_device *device, int *state); 143 143 int acpi_power_on_resources(struct acpi_device *device, int state); 144 144 int acpi_power_transition(struct acpi_device *device, int state); 145 - void acpi_turn_off_unused_power_resources(void); 146 145 147 146 /* -------------------------------------------------------------------------- 148 147 Device Power Management
+1 -1
drivers/acpi/power.c
··· 995 995 996 996 mutex_unlock(&power_resource_list_lock); 997 997 } 998 - #endif 999 998 1000 999 void acpi_turn_off_unused_power_resources(void) 1001 1000 { ··· 1015 1016 1016 1017 mutex_unlock(&power_resource_list_lock); 1017 1018 } 1019 + #endif
-2
drivers/acpi/scan.c
··· 2359 2359 } 2360 2360 } 2361 2361 2362 - acpi_turn_off_unused_power_resources(); 2363 - 2364 2362 acpi_scan_initialized = true; 2365 2363 2366 2364 out:
+1
drivers/acpi/sleep.h
··· 8 8 extern struct mutex acpi_device_lock; 9 9 10 10 extern void acpi_resume_power_resources(void); 11 + extern void acpi_turn_off_unused_power_resources(void); 11 12 12 13 static inline acpi_status acpi_set_waking_vector(u32 wakeup_address) 13 14 {