From 238b1eaa59e6a8e2993af0db9ec2255bfa53927b Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Wed, 30 Oct 2013 01:40:28 +0100 Subject: 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: Peter Huewe --- drivers/char/tpm/tpm_ppi.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c index 18c5810..6ac9d27 100644 --- a/drivers/char/tpm/tpm_ppi.c +++ b/drivers/char/tpm/tpm_ppi.c @@ -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); -- cgit v1.1