aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi
AgeCommit message (Collapse)AuthorFilesLines
2023-10-09ACPI: resource: Add TongFang GM6BGEQ, GM6BG5Q and GM6BG0Q to ↵Hans de Goede1-6/+13
irq1_edge_low_force_override[] The TongFang GM6BGEQ, GM6BG5Q and GM6BG0Q are 3 GPU variants of a TongFang barebone design which is sold under various brand names. The ACPI IRQ override for the keyboard IRQ must be used on these AMD Zen laptops in order for the IRQ to work. Adjust the pcspecialist_laptop[] DMI match table for this: 1. Drop the sys-vendor match from the existing PCSpecialist Elimina Pro 16 entry for the GM6BGEQ (RTX3050 GPU) model so that it will also match the laptop when sold by other vendors such as hyperbook.pl. 2. Add board-name matches for the GM6BG5Q (RTX4050) and GM6B0Q (RTX4060) models. Note the .ident values of the dmi_system_id structs are left unset since these are not used. Suggested-by: August Wikerfors <[email protected]> Reported-by: Francesco <[email protected]> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217394 Link: https://laptopparts4less.frl/index.php?route=product/search&filter_name=GM6BG Link: https://hyperbook.pl/en/content/14-hyperbook-drivers Link: https://linux-hardware.org/?probe=bfa70344e3 Link: https://bbs.archlinuxcn.org/viewtopic.php?id=13313 Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-06acpi,mm: fix typo sibiling -> siblingLi Zhijian1-1/+1
First found this typo as reviewing memory tier code. Fix it by sed like: $ sed -i 's/sibiling/sibling/g' $(git grep -l sibiling) so the acpi one will be corrected as well. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Li Zhijian <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Huang, Ying <[email protected]> Cc: Len Brown <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
2023-10-06ACPI: bus: Add context argument to acpi_dev_install_notify_handler()Rafael J. Wysocki7-8/+8
Add void *context arrgument to the list of arguments of acpi_dev_install_notify_handler() and modify it to pass that argument as context to acpi_install_notify_handler() instead of its first argument which is problematic in general (for example, if platform drivers used it, they would rather get struct platform_device pointers or pointers to their private data from the context arguments of their notify handlers). Make all of the current callers of acpi_dev_install_notify_handler() take this change into account so as to avoid altering the general functionality. Co-developed-by: Michal Wilczynski <[email protected]> Signed-off-by: Michal Wilczynski <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-06Merge tag 'arm64-fixes' of ↵Linus Torvalds1-2/+1
git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux Pull arm64 fixes from Will Deacon: "A typo fix for a PMU driver, a workround for a side-channel erratum on Cortex-A520 and a fix for the local timer save/restore when using ACPI with Qualcomm's custom CPUs: - Workaround for Cortex-A520 erratum #2966298 - Fix typo in Arm CMN PMU driver that breaks counter overflow handling - Fix timer handling across idle for Qualcomm custom CPUs" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: cpuidle, ACPI: Evaluate LPI arch_flags for broadcast timer arm64: errata: Add Cortex-A520 speculative unprivileged load workaround arm64: Add Cortex-A520 CPU part definition perf/arm-cmn: Fix the unhandled overflow status of counter 4 to 7
2023-10-05ACPI: thermal: Use thermal_zone_for_each_trip() for updating tripsRafael J. Wysocki1-41/+37
Rearrange the code handling notifications from the platform firmware regarding trip point updates to carry out one loop over trip points instead of two of them by using thermal_zone_for_each_trip() for that, which is more straightforward than using a combination of thermal_zone_device_exec() and for_each_thermal_trip(), each with its own callback function. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
2023-10-05ACPI: thermal: Combine passive and active trip update functionsRafael J. Wysocki1-18/+17
Combine acpi_thermal_update_passive_trip() and acpi_thermal_update_active_trip() into one common function called acpi_thermal_update_trip(), so as to reduce code duplication and prepare the code in question for subsequent changes. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-10-05ACPI: thermal: Move get_active_temp()Rafael J. Wysocki1-23/+23
Put the get_active_temp() function next to the analogous get_passive_temp() one to allow subsequent changes to be easier to follow. No functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
2023-10-04cpuidle, ACPI: Evaluate LPI arch_flags for broadcast timerOza Pawandeep1-2/+1
Arm® Functional Fixed Hardware Specification defines LPI states, which provide an architectural context loss flags field that can be used to describe the context that might be lost when an LPI state is entered. - Core context Lost - General purpose registers. - Floating point and SIMD registers. - System registers, include the System register based - generic timer for the core. - Debug register in the core power domain. - PMU registers in the core power domain. - Trace register in the core power domain. - Trace context loss - GICR - GICD Qualcomm's custom CPUs preserves the architectural state, including keeping the power domain for local timers active. when core is power gated, the local timers are sufficient to wake the core up without needing broadcast timer. The patch fixes the evaluation of cpuidle arch_flags, and moves only to broadcast timer if core context lost is defined in ACPI LPI. Fixes: a36a7fecfe60 ("ACPI / processor_idle: Add support for Low Power Idle(LPI) states") Reviewed-by: Sudeep Holla <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Oza Pawandeep <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2023-10-03ACPI: PRM: Annotate struct prm_module_info with __counted_byKees Cook1-1/+1
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct prm_module_info. Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci # [1] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: FPDT: properly handle invalid FPDT subtablesVasily Khoruzhick1-8/+37
Buggy BIOSes may have invalid FPDT subtables, e.g. on my hardware: S3PT subtable: 7F20FE30: 53 33 50 54 24 00 00 00-00 00 00 00 00 00 18 01 *S3PT$...........* 7F20FE40: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 *................* 7F20FE50: 00 00 00 00 Here the first record has zero length. FBPT subtable: 7F20FE50: 46 42 50 54-3C 00 00 00 46 42 50 54 *....FBPT<...FBPT* 7F20FE60: 02 00 30 02 00 00 00 00-00 00 00 00 00 00 00 00 *..0.............* 7F20FE70: 2A A6 BC 6E 0B 00 00 00-1A 44 41 70 0B 00 00 00 **..n.....DAp....* 7F20FE80: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 *................* And here FBPT table has FBPT signature repeated instead of the first record. Current code will be looping indefinitely due to zero length records, so break out of the loop if record length is zero. While we are here, add proper handling for fpdt_process_subtable() failures. Fixes: d1eb86e59be0 ("ACPI: tables: introduce support for FPDT table") Cc: All applicable <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]> [ rjw: Comment edit, added empty code lines ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: utils: Remove redundant braces around individual statementJonathan Bergh1-2/+1
Remove braces that are not required for a one-line statement which follows a control statement. Signed-off-by: Jonathan Bergh <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: utils: Fix up white space in a few placesJonathan Bergh1-2/+2
Fix up the following formatting issues flagged by checkpatch: * Remove indentation before goto label * Remove whitespace ahead of a comma in parameter list Signed-off-by: Jonathan Bergh <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: thermal: Fix up function header formatting in two placesJonathan Bergh1-4/+11
Fix up the following formatting issues: * braces following function declarations should be on a new line * empty line should be present between function declarations Signed-off-by: Jonathan Bergh <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: video: Add acpi_backlight=vendor quirk for Toshiba Portégé R100Ondrej Zary1-0/+26
Toshiba Portégé R100 has both acpi_video and toshiba_acpi vendor backlight driver working. But none of them gets activated as it has a VGA with no kernel driver (Trident CyberBlade XP4m32). The DMI strings are very generic ("Portable PC") so add a custom callback function to check for Trident CyberBlade XP4m32 PCI device before enabling the vendor backlight driver (better than acpi_video as it has more brightness steps). Fixes: 5aa9d943e9b6 ("ACPI: video: Don't enable fallback path for creating ACPI backlight by default") Signed-off-by: Ondrej Zary <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: OSL: Add empty lines after local variable declarationsJonathan Bergh1-0/+4
Fix up four places where there is no empty line after declarations of local variables in a function (as per the kernel coding style). Signed-off-by: Jonathan Bergh <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: OSL: Remove redundant parentheses in return statementsJonathan Bergh1-3/+3
Fix up three return statements including redundant perens around the return value. Signed-off-by: Jonathan Bergh <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: OSL: Fix up white space in parameter listsJonathan Bergh1-8/+8
Fix up declarations of pointer arguments where a space is present before the argument name, which does not agree with the kernel coding style. Signed-off-by: Jonathan Bergh <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: property: Document the _DSD data buffer GUIDAndy Shevchenko1-0/+1
As the rest of the GUIDs document one for _DSD data buffer so it will be eaisier to search for on internet or documentation. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: property: Allow _DSD buffer data only for byte accessorsAndy Shevchenko1-9/+10
In accordance with ACPI specificication and _DSD data buffer representation the data there is an array of bytes. Hence, accessing it with something longer will create a sparse data which is against of how device property APIs work in general and also not defined in the ACPI specification (see [1]). Fix the code to emit an error if non-byte accessor is used to retrieve _DSD buffer data. Fixes: 369af6bf2c28 ("ACPI: property: Read buffer properties as integers") Link: https://uefi.org/specs/ACPI/6.5/19_ASL_Reference.html#buffer-declare-buffer-object # [1] Signed-off-by: Andy Shevchenko <[email protected]> [ rjw: Add missing braces ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed()Andy Shevchenko1-3/+2
The acpi_evaluate_dsm_typed() provides a way to check the type of the object evaluated by _DSM call. Use it instead of open coded variant. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: PCI: Switch to use acpi_evaluate_dsm_typed()Andy Shevchenko1-3/+3
The acpi_evaluate_dsm_typed() provides a way to check the type of the object evaluated by _DSM call. Use it instead of open coded variant. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-03ACPI: LPSS: drop BayTrail and Lynxpoint pinctrl HIDsRaag Jadav1-8/+3
Platform devices are now created by ACPI core on device enumeration on acpi_bus_scan() -> acpi_bus_attach() path after commit 48459340b92b ("ACPI / scan: use platform bus type by default for _HID enumeration"). No need to create them from LPSS unless we explicitly need to set acpi_lpss_pm_domain for them. Signed-off-by: Raag Jadav <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-10-02Merge tag 'libnvdimm-fixes-6.6-rc5' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm Pull libnvdimm fix from Dave Jiang: - Fix incorrect calculation of idt size in NFIT * tag 'libnvdimm-fixes-6.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: ACPI: NFIT: Fix incorrect calculation of idt size
2023-10-02Merge back new ACPI backlight material for v6.7.Rafael J. Wysocki1-8/+50
2023-09-29ACPI: thermal: Drop list of device ACPI handles from struct acpi_thermalRafael J. Wysocki1-1/+0
Notice that the list of device ACPI handles in struct acpi_thermal is not used and drop it. No functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
2023-09-29ACPI: utils: Dynamically determine acpi_handle_list sizeRafael J. Wysocki4-12/+88
Address a long-standing "TBD" comment in the ACPI headers regarding the number of handles in struct acpi_handle_list. The number 10, which along with the comment dates back to 2.4.23, seems like it may have been arbitrarily chosen and isn't sufficient in all cases [1]. Finally change the code to dynamically determine the size of the handles table in struct acpi_handle_list and allocate it accordingly. Update the users of to struct acpi_handle_list to take the additional dynamic allocation into account. Link: https://lore.kernel.org/linux-acpi/[email protected] # [1] Co-developed-by: Vicki Pfau <[email protected]> Signed-off-by: Vicki Pfau <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-09-28ACPI: thermal: Rename structure fields holding temperature in deci-KelvinRafael J. Wysocki1-23/+23
Rename structure fields holding temperature values in deci-Kelvin so as to avoid temperature units confusion. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
2023-09-28ACPI: thermal: Drop critical_valid and hot_valid trip flagsRafael J. Wysocki1-17/+8
The critical_valid and hot_valid flags in struct acpi_thermal_trips are only used during initialization and they are only false if the corresponding trip temperatures are equal to THERMAL_TEMP_INVALID, so drop them and use THERMAL_TEMP_INVALID checks instead of them where applicable. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-28ACPI: thermal: Do not use trip indices for cooling device bindingRafael J. Wysocki1-66/+44
Rearrange the ACPI thermal driver's callback functions used for cooling device binding and unbinding, acpi_thermal_bind_cooling_device() and acpi_thermal_unbind_cooling_device(), respectively, so that they use trip pointers instead of trip indices which is more straightforward and allows the driver to become independent of the ordering of trips in the thermal zone structure. The general functionality is not expected to be changed. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-28ACPI: thermal: Mark uninitialized active trips as invalidRafael J. Wysocki1-0/+3
After removing the valid flag from struct acpi_thermal_trip, the trip temperature value is used in validity checks, so it must be THERMAL_TEMP_INVALID for the active trip entries in struct acpi_thermal_trips that are not going to be used (because the corresponding objects are not present in the ACPI tables, for example). Accordingly, modify acpi_thermal_get_trip_points() to set the temperature value to THERMAL_TEMP_INVALID for trip point entries skipped by it after acpi_thermal_init_trip() has returned 'false' for an active trip. Fixes: 058f5e407deb ("ACPI: thermal: Drop valid flag from struct acpi_thermal_trip") Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-09-28ACPI: thermal: Merge trip initialization functionsRafael J. Wysocki1-34/+30
In order to reduce code duplicationeve further, merge acpi_thermal_init_passive/active_trip() into one function called acpi_thermal_init_trip() that will be used for initializing both the passive and active trip points. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-28ACPI: thermal: Collapse trip devices update function wrappersRafael J. Wysocki1-19/+7
In order to reduce code duplicationeve further, merge acpi_thermal_update_passive/active_devices() into one function called acpi_thermal_update_trip_devices() that will be used for updating both the passive and active trip points. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-28ACPI: thermal: Collapse trip devices update functionsRafael J. Wysocki1-33/+20
In order to reduce code duplication, merge update_passive_devices() and update_active_devices() into one function called update_trip_devices() that will be used for updating both the passive and active trip points. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-28ACPI: thermal: Add device list to struct acpi_thermal_tripRafael J. Wysocki1-15/+21
The device lists present in struct acpi_thermal_passive and struct acpi_thermal_active can be located in struct acpi_thermal_trip which then will allow the same code to be used for handling both the passive and active trip points, so make that change. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-27ACPI: thermal: Fix a small leak in acpi_thermal_add()Dan Carpenter1-2/+4
Free "tz" if the "trip" allocation fails. Fixes: 5fc2189f9335 ("ACPI: thermal: Create and populate trip points table earlier") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-09-26ACPI: thermal: Drop valid flag from struct acpi_thermal_tripRafael J. Wysocki1-26/+23
Notice that the valid flag in struct acpi_thermal_trip is in fact redundant, because the temperature field of invalid trips is always equal to THERMAL_TEMP_INVALID, so drop it from there and adjust the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Drop redundant trip point flagsRafael J. Wysocki1-19/+10
Trip point flags previously used by the driver need not be used any more after the preceding changes, so drop them and adjust the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Untangle initialization and updates of active tripsRafael J. Wysocki1-97/+100
Separate the code needed to update active trips (in a response to a notification from the platform firmware) as well as to initialize them from the code that is only necessary for their initialization and cleanly divide it into functions that each carry out a specific action. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Untangle initialization and updates of the passive tripRafael J. Wysocki1-73/+125
Separate the code needed to update the passive trip (in a response to a notification from the platform firmware) as well as to initialize it from the code that is only necessary for its initialization and cleanly divide it into functions that each carry out a specific action. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Simplify critical and hot trips representationRafael J. Wysocki1-36/+33
Notice that the only piece of information regarding the critical and hot trips that needs to be stored in the driver's local data structures is whether or not these trips are valid, so drop all of the redundant information from there and adjust the code accordingly. Among other things, this requires acpi_thermal_add() to be rearranged so as to obtain the critical trip temperature before populating the trip points table and for symmetry, the hot trip temperature is obtained earlier too. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Create and populate trip points table earlierRafael J. Wysocki1-53/+52
Create and populate the driver's trip points table in acpi_thermal_add() so as to allow the its data structures to be simplified going forward. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Determine the number of trip points earlierRafael J. Wysocki1-29/+27
Compute the number of trip points in acpi_thermal_add() so as to allow the driver's data structures to be simplified going forward. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Fold acpi_thermal_get_info() into its callerRafael J. Wysocki1-33/+19
There is only one caller of acpi_thermal_get_info() and the code from it can be folded into its caller just fine, so do that. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-26ACPI: thermal: Simplify initialization of critical and hot tripsRafael J. Wysocki1-64/+66
Use the observation that the critical and hot trip points are never updated by the ACPI thermal driver, because the flags passed from acpi_thermal_notify() to acpi_thermal_trips_update() do not include ACPI_TRIPS_CRITICAL or ACPI_TRIPS_HOT, to move the initialization of those trip points directly into acpi_thermal_get_trip_points() and reduce the size of __acpi_thermal_trips_update(). Also make the critical and hot trip points initialization code more straightforward and drop the flags that are not needed any more. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
2023-09-25ACPI: NFIT: Fix incorrect calculation of idt sizeYu Liao1-1/+1
acpi_nfit_interleave's field 'line_offset' is switched to flexible array [1], but sizeof_idt() still calculates the size in the form of 1-element array. Therefore, fix incorrect calculation in sizeof_idt(). [1] https://lore.kernel.org/lkml/2652195.BddDVKsqQX@kreacher/ Fixes: 2a5ab99847bd ("ACPICA: struct acpi_nfit_interleave: Replace 1-element array with flexible array") Cc: [email protected] # v6.4+ Signed-off-by: Yu Liao <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dave Jiang <[email protected]>
2023-09-25ACPI: video: Fix NULL pointer dereference in acpi_video_bus_add()Dinghao Liu1-2/+5
acpi_video_bus_add_notify_handler() could free video->input and set it to NULL on failure, but this failure would be missed in its caller acpi_video_bus_add(). As a result, when an error happens in acpi_dev_install_notify_handler(), acpi_video_bus_add() would call acpi_video_bus_remove_notify_handler(), where a potential NULL pointer video->input is dereferenced in input_unregister_device(). Fix this by adding a return value check and adjusting the following error handling code. Fixes: 6f7016819766 ("ACPI: video: Install Notify() handler directly") Signed-off-by: Dinghao Liu <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-09-21ACPI: EC: Add quirk for the HP Pavilion Gaming 15-dk1xxxHans de Goede1-0/+11
Added GPE quirk entry for the HP Pavilion Gaming 15-dk1xxx. There is a quirk entry for 2 15-c..... laptops, this is for a new version which has 15-dk1xxx as identifier. This fixes the LID switch and rfkill and brightness hotkeys not working. Closes: https://github.com/systemd/systemd/issues/28942 Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-09-21ACPI: OSI: refactor deprecated strncpy()Justin Stitt1-1/+1
`strncpy()` is deprecated for use on NUL-terminated destination strings [1]. We know `osi->string` is a NUL-terminated string due to its eventual use in `acpi_install_interface()` and `acpi_remove_interface()` which expect a `acpi_string` which has been specifically typedef'd as: | typedef char *acpi_string; /* Null terminated ASCII string */ ... and which also has other string functions used on it like `strlen`. Furthermore, padding is not needed in this instance either. Due to the reasoning above a suitable replacement is `strscpy` [2] since it guarantees NUL-termination on the destination buffer and doesn't unnecessarily NUL-pad. While there is unlikely to be a buffer overread (or other related bug) in this case, we should still favor a more robust and less ambiguous interface. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Signed-off-by: Justin Stitt <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-09-21ACPI: OSL: add __printf format attribute to acpi_os_vprintf()Su Hui1-1/+1
With gcc and W=1 option to compile the kernel, warning occurs: drivers/acpi/osl.c:156:2: error: function ‘acpi_os_vprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]. Allow the compiler to recognize and check format strings is safer. Signed-off-by: Su Hui <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2023-09-21ACPI: APEI: Fix AER info corruption when error status data has multiple sectionsShiju Jose1-1/+22
ghes_handle_aer() passes AER data to the PCI core for logging and recovery by calling aer_recover_queue() with a pointer to struct aer_capability_regs. The problem was that aer_recover_queue() queues the pointer directly without copying the aer_capability_regs data. The pointer was to the ghes->estatus buffer, which could be reused before aer_recover_work_func() reads the data. To avoid this problem, allocate a new aer_capability_regs structure from the ghes_estatus_pool, copy the AER data from the ghes->estatus buffer into it, pass a pointer to the new struct to aer_recover_queue(), and free it after aer_recover_work_func() has processed it. Reported-by: Bjorn Helgaas <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Signed-off-by: Shiju Jose <[email protected]> [ rjw: Subject edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>