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

Commit 238b1eaa authored by Peter Huewe's avatar Peter Huewe Committed by Peter Huewe
Browse files

tpm/tpm_ppi: Check return value of acpi_get_name



If
 status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
fails for whatever reason and does not return AE_OK
 if (strstr(buffer.pointer, context) != NULL) {
does dereference a null pointer.

-> Check the return value and return the status to the caller

Found by coverity
Cc: stable@vger.kernel.org
Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
parent 747d35bd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@ static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context,
	acpi_status status;
	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
	status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
	if (ACPI_FAILURE(status))
		return status;

	if (strstr(buffer.pointer, context) != NULL) {
		*return_value = handle;
		kfree(buffer.pointer);