summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorPeter Huewe <PeterHuewe@gmx.de>2013-10-30 01:40:28 +0100
committerPeter Huewe <peterhuewe@gmx.de>2014-01-06 14:37:23 +0100
commit238b1eaa59e6a8e2993af0db9ec2255bfa53927b (patch)
treeb332688b47a875a7d3d82585db36f4540b7bc5b8 /drivers/char/tpm
parenttpm/tpm_ppi: Do not compare strcmp(a,b) == -1 (diff)
downloadlinux-238b1eaa59e6a8e2993af0db9ec2255bfa53927b.tar.xz
linux-238b1eaa59e6a8e2993af0db9ec2255bfa53927b.zip
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 <peterhuewe@gmx.de>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm_ppi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
index 18c5810b646b..6ac9d275b732 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);