[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1383413101-10975-2-git-send-email-peterhuewe@gmx.de>
Date: Sat, 2 Nov 2013 18:24:57 +0100
From: Peter Huewe <peterhuewe@....de>
To: james.l.morris@...cle.com, tpmdd-devel@...ts.sourceforge.net,
adlai@...ux.vnet.ibm.com
Cc: linux-kernel@...r.kernel.org, Peter Huewe <PeterHuewe@....de>,
stable@...r.kernel.org, Peter Huewe <peterhuewe@....de>
Subject: [PATCH 2/6] tpm/tpm_ppi: Check return value of acpi_get_name
From: Peter Huewe <PeterHuewe@....de>
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@...r.kernel.org
Signed-off-by: Peter Huewe <peterhuewe@....de>
---
drivers/char/tpm/tpm_ppi.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
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);
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists