Commit a5355e98 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ACPI fixes from Rafael Wysocki:
 "These fix three ACPI driver issues and add version checks to two ACPI
  table parsers:

   - Call input_free_device() on failing input device registration as
     necessary (and mentioned in the input subsystem documentation) in
     the ACPI button driver (Kaushlendra Kumar)

   - Fix use-after-free in acpi_video_switch_brightness() by canceling a
     delayed work during tear-down (Yuhao Jiang)

   - Use platform device for devres-related actions in the ACPI fan
     driver to allow device-managed resources to be cleaned up properly
     (Armin Wolf)

   - Add version checks to the MRRM and SPCR table parsers (Tony Luck
     and Punit Agrawal)"

* tag 'acpi-6.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: SPCR: Check for table version when using precise baudrate
  ACPI: MRRM: Check revision of MRRM table
  ACPI: fan: Use platform device for devres-related actions
  ACPI: fan: Use ACPI handle when retrieving _FST
  ACPI: video: Fix use-after-free in acpi_video_switch_brightness()
  ACPI: button: Call input_free_device() on failing input device registration
parents a5dbbb39 8907226b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ static __init int acpi_parse_mrrm(struct acpi_table_header *table)
	if (!mrrm)
		return -ENODEV;

	if (mrrm->header.revision != 1)
		return -EINVAL;

	if (mrrm->flags & ACPI_MRRM_FLAGS_REGION_ASSIGNMENT_OS)
		return -EOPNOTSUPP;

+3 −1
Original line number Diff line number Diff line
@@ -1959,8 +1959,10 @@ static void acpi_video_bus_remove_notify_handler(struct acpi_video_bus *video)
	struct acpi_video_device *dev;

	mutex_lock(&video->device_list_lock);
	list_for_each_entry(dev, &video->video_device_list, entry)
	list_for_each_entry(dev, &video->video_device_list, entry) {
		acpi_video_dev_remove_notify_handler(dev);
		cancel_delayed_work_sync(&dev->switch_brightness_work);
	}
	mutex_unlock(&video->device_list_lock);

	acpi_video_bus_stop_devices(video);
+3 −1
Original line number Diff line number Diff line
@@ -619,8 +619,10 @@ static int acpi_button_add(struct acpi_device *device)

	input_set_drvdata(input, device);
	error = input_register_device(input);
	if (error)
	if (error) {
		input_free_device(input);
		goto err_remove_fs;
	}

	switch (device->device_type) {
	case ACPI_BUS_TYPE_POWER_BUTTON:
+4 −3
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ struct acpi_fan_fst {
};

struct acpi_fan {
	acpi_handle handle;
	bool acpi4;
	bool has_fst;
	struct acpi_fan_fif fif;
@@ -59,14 +60,14 @@ struct acpi_fan {
	struct device_attribute fine_grain_control;
};

int acpi_fan_get_fst(struct acpi_device *device, struct acpi_fan_fst *fst);
int acpi_fan_get_fst(acpi_handle handle, struct acpi_fan_fst *fst);
int acpi_fan_create_attributes(struct acpi_device *device);
void acpi_fan_delete_attributes(struct acpi_device *device);

#if IS_REACHABLE(CONFIG_HWMON)
int devm_acpi_fan_create_hwmon(struct acpi_device *device);
int devm_acpi_fan_create_hwmon(struct device *dev);
#else
static inline int devm_acpi_fan_create_hwmon(struct acpi_device *device) { return 0; };
static inline int devm_acpi_fan_create_hwmon(struct device *dev) { return 0; };
#endif

#endif
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ static ssize_t show_fan_speed(struct device *dev, struct device_attribute *attr,
	struct acpi_fan_fst fst;
	int status;

	status = acpi_fan_get_fst(acpi_dev, &fst);
	status = acpi_fan_get_fst(acpi_dev->handle, &fst);
	if (status)
		return status;

Loading