Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fda11e61 authored by Len Brown's avatar Len Brown
Browse files

dell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value



When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

The callers of wmi_get_event_data() pass ACPI_ALLOCATE_BUFFER,
and thus must check its return value before accessing
or kfree() on the buffer.

Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent f2772575
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -202,8 +202,13 @@ static void dell_wmi_notify(u32 value, void *context)
	struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
	struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
	static struct key_entry *key;
	static struct key_entry *key;
	union acpi_object *obj;
	union acpi_object *obj;
	acpi_status status;


	wmi_get_event_data(value, &response);
	status = wmi_get_event_data(value, &response);
	if (status != AE_OK) {
		printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status);
		return;
	}


	obj = (union acpi_object *)response.pointer;
	obj = (union acpi_object *)response.pointer;


+6 −1
Original line number Original line Diff line number Diff line
@@ -338,8 +338,13 @@ static void hp_wmi_notify(u32 value, void *context)
	static struct key_entry *key;
	static struct key_entry *key;
	union acpi_object *obj;
	union acpi_object *obj;
	int eventcode;
	int eventcode;
	acpi_status status;


	wmi_get_event_data(value, &response);
	status = wmi_get_event_data(value, &response);
	if (status != AE_OK) {
		printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
		return;
	}


	obj = (union acpi_object *)response.pointer;
	obj = (union acpi_object *)response.pointer;


+6 −1
Original line number Original line Diff line number Diff line
@@ -149,8 +149,13 @@ static void msi_wmi_notify(u32 value, void *context)
	static struct key_entry *key;
	static struct key_entry *key;
	union acpi_object *obj;
	union acpi_object *obj;
	ktime_t cur;
	ktime_t cur;
	acpi_status status;


	wmi_get_event_data(value, &response);
	status = wmi_get_event_data(value, &response);
	if (status != AE_OK) {
		printk(KERN_INFO DRV_PFX "bad event status 0x%x\n", status);
		return;
	}


	obj = (union acpi_object *)response.pointer;
	obj = (union acpi_object *)response.pointer;