Skip to content

Commit b92f3d3

Browse files
committed
Merge tag 'acpi-5.5-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull additional ACPI updates from Rafael Wysocki: "These close a nasty race condition in the ACPI memory mappings management code and an invalid parameter check in a library routing, allow GPE 0xFF to be masked via kernel command line, add a new lid switch blacklist entry and clean up Kconfig. Specifics: - Fix locking issue in acpi_os_map_cleanup() leading to a race condition that can be harnessed for provoking a kernel panic from user space (Francesco Ruggeri) - Fix parameter check in acpi_bus_get_private_data() (Vamshi K Sthambamkadi) - Allow GPE 0xFF to be masked via kernel command line (Yunfeng Ye) - Add a new lid switch blacklist entry for Acer Switch 10 SW5-032 to the ACPI button driver (Hans de Goede) - Clean up Kconfig (Krzysztof Kozlowski)" * tag 'acpi-5.5-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: bus: Fix NULL pointer check in acpi_bus_get_private_data() ACPI: Fix Kconfig indentation ACPI: OSL: only free map once in osl.c ACPI: button: Add DMI quirk for Acer Switch 10 SW5-032 lid-switch ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100
2 parents ef867c1 + b65d563 commit b92f3d3

File tree

6 files changed

+39
-20
lines changed

6 files changed

+39
-20
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
the GPE dispatcher.
114114
This facility can be used to prevent such uncontrolled
115115
GPE floodings.
116-
Format: <int>
116+
Format: <byte>
117117

118118
acpi_no_auto_serialize [HW,ACPI]
119119
Disable auto-serialization of AML methods

drivers/acpi/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ config ACPI_PROCFS_POWER
104104
depends on X86 && PROC_FS
105105
help
106106
For backwards compatibility, this option allows
107-
deprecated power /proc/acpi/ directories to exist, even when
108-
they have been replaced by functions in /sys.
109-
The deprecated directories (and their replacements) include:
107+
deprecated power /proc/acpi/ directories to exist, even when
108+
they have been replaced by functions in /sys.
109+
The deprecated directories (and their replacements) include:
110110
/proc/acpi/battery/* (/sys/class/power_supply/*) and
111111
/proc/acpi/ac_adapter/* (sys/class/power_supply/*).
112112
This option has no effect on /proc/acpi/ directories
@@ -448,7 +448,7 @@ config ACPI_CUSTOM_METHOD
448448
config ACPI_BGRT
449449
bool "Boottime Graphics Resource Table support"
450450
depends on EFI && (X86 || ARM64)
451-
help
451+
help
452452
This driver adds support for exposing the ACPI Boottime Graphics
453453
Resource Table, which allows the operating system to obtain
454454
data from the firmware boot splash. It will appear under

drivers/acpi/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ int acpi_bus_get_private_data(acpi_handle handle, void **data)
153153
{
154154
acpi_status status;
155155

156-
if (!*data)
156+
if (!data)
157157
return -EINVAL;
158158

159159
status = acpi_get_data(handle, acpi_bus_private_data_handler, data);

drivers/acpi/button.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
7777

7878
/* Please keep this list sorted alphabetically by vendor and model */
7979
static const struct dmi_system_id dmi_lid_quirks[] = {
80+
{
81+
/*
82+
* Acer Switch 10 SW5-012. _LID method messes with home and
83+
* power button GPIO IRQ settings causing an interrupt storm on
84+
* both GPIOs. This is unfixable without a DSDT override, so we
85+
* have to disable the lid-switch functionality altogether :|
86+
*/
87+
.matches = {
88+
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
89+
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
90+
},
91+
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED,
92+
},
8093
{
8194
/*
8295
* Asus T200TA, _LID keeps reporting closed after every second

drivers/acpi/osl.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,19 +374,21 @@ void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
374374
}
375375
EXPORT_SYMBOL_GPL(acpi_os_map_memory);
376376

377-
static void acpi_os_drop_map_ref(struct acpi_ioremap *map)
377+
/* Must be called with mutex_lock(&acpi_ioremap_lock) */
378+
static unsigned long acpi_os_drop_map_ref(struct acpi_ioremap *map)
378379
{
379-
if (!--map->refcount)
380+
unsigned long refcount = --map->refcount;
381+
382+
if (!refcount)
380383
list_del_rcu(&map->list);
384+
return refcount;
381385
}
382386

383387
static void acpi_os_map_cleanup(struct acpi_ioremap *map)
384388
{
385-
if (!map->refcount) {
386-
synchronize_rcu_expedited();
387-
acpi_unmap(map->phys, map->virt);
388-
kfree(map);
389-
}
389+
synchronize_rcu_expedited();
390+
acpi_unmap(map->phys, map->virt);
391+
kfree(map);
390392
}
391393

392394
/**
@@ -406,6 +408,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map)
406408
void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size)
407409
{
408410
struct acpi_ioremap *map;
411+
unsigned long refcount;
409412

410413
if (!acpi_permanent_mmap) {
411414
__acpi_unmap_table(virt, size);
@@ -419,10 +422,11 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size)
419422
WARN(true, PREFIX "%s: bad address %p\n", __func__, virt);
420423
return;
421424
}
422-
acpi_os_drop_map_ref(map);
425+
refcount = acpi_os_drop_map_ref(map);
423426
mutex_unlock(&acpi_ioremap_lock);
424427

425-
acpi_os_map_cleanup(map);
428+
if (!refcount)
429+
acpi_os_map_cleanup(map);
426430
}
427431
EXPORT_SYMBOL_GPL(acpi_os_unmap_iomem);
428432

@@ -457,6 +461,7 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas)
457461
{
458462
u64 addr;
459463
struct acpi_ioremap *map;
464+
unsigned long refcount;
460465

461466
if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
462467
return;
@@ -472,10 +477,11 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas)
472477
mutex_unlock(&acpi_ioremap_lock);
473478
return;
474479
}
475-
acpi_os_drop_map_ref(map);
480+
refcount = acpi_os_drop_map_ref(map);
476481
mutex_unlock(&acpi_ioremap_lock);
477482

478-
acpi_os_map_cleanup(map);
483+
if (!refcount)
484+
acpi_os_map_cleanup(map);
479485
}
480486
EXPORT_SYMBOL(acpi_os_unmap_generic_address);
481487

drivers/acpi/sysfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,14 +819,14 @@ static ssize_t counter_set(struct kobject *kobj,
819819
* interface:
820820
* echo unmask > /sys/firmware/acpi/interrupts/gpe00
821821
*/
822-
#define ACPI_MASKABLE_GPE_MAX 0xFF
822+
#define ACPI_MASKABLE_GPE_MAX 0x100
823823
static DECLARE_BITMAP(acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) __initdata;
824824

825825
static int __init acpi_gpe_set_masked_gpes(char *val)
826826
{
827827
u8 gpe;
828828

829-
if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX)
829+
if (kstrtou8(val, 0, &gpe))
830830
return -EINVAL;
831831
set_bit(gpe, acpi_masked_gpes_map);
832832

@@ -838,7 +838,7 @@ void __init acpi_gpe_apply_masked_gpes(void)
838838
{
839839
acpi_handle handle;
840840
acpi_status status;
841-
u8 gpe;
841+
u16 gpe;
842842

843843
for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) {
844844
status = acpi_get_gpe_device(gpe, &handle);

0 commit comments

Comments
 (0)