Blame SOURCES/0001-tcti-tabrmd-Fix-NULL-deref-bug-by-moving-debug-outpu.patch

56375a
From 418d49669a33f9e6b029787e3869b3a534bb7de8 Mon Sep 17 00:00:00 2001
56375a
From: Philip Tricca <philip.b.tricca@intel.com>
56375a
Date: Mon, 14 Aug 2017 13:57:51 -0700
56375a
Subject: [PATCH] tcti-tabrmd: Fix NULL deref bug by moving debug output after
56375a
 NULL check.
56375a
56375a
This one speaks for itself: The debug output dereferences the pointer to
56375a
the context structure before checking for NULL. Switching these two
56375a
things around fixes the issue.
56375a
56375a
Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
56375a
---
56375a
 src/tcti-tabrmd.c | 8 ++++----
56375a
 1 file changed, 4 insertions(+), 4 deletions(-)
56375a
56375a
diff --git a/src/tcti-tabrmd.c b/src/tcti-tabrmd.c
56375a
index 970702c..134cf8d 100644
56375a
--- a/src/tcti-tabrmd.c
56375a
+++ b/src/tcti-tabrmd.c
56375a
@@ -293,11 +293,11 @@ tss2_tcti_tabrmd_cancel (TSS2_TCTI_CONTEXT *context)
56375a
     GError *error = NULL;
56375a
     gboolean cancel_ret;
56375a
 
56375a
-    g_info("tss2_tcti_tabrmd_cancel: id 0x%" PRIx64,
56375a
-           TSS2_TCTI_TABRMD_ID (context));
56375a
     if (context == NULL) {
56375a
         return TSS2_TCTI_RC_BAD_CONTEXT;
56375a
     }
56375a
+    g_info("tss2_tcti_tabrmd_cancel: id 0x%" PRIx64,
56375a
+           TSS2_TCTI_TABRMD_ID (context));
56375a
     if (TSS2_TCTI_TABRMD_STATE (context) != TABRMD_STATE_RECEIVE) {
56375a
         return TSS2_TCTI_RC_BAD_SEQUENCE;
56375a
     }
56375a
@@ -346,11 +346,11 @@ tss2_tcti_tabrmd_set_locality (TSS2_TCTI_CONTEXT *context,
56375a
     TSS2_RC ret = TSS2_RC_SUCCESS;
56375a
     GError *error = NULL;
56375a
 
56375a
-    g_info ("tss2_tcti_tabrmd_set_locality: id 0x%" PRIx64,
56375a
-            TSS2_TCTI_TABRMD_ID (context));
56375a
     if (context == NULL) {
56375a
         return TSS2_TCTI_RC_BAD_CONTEXT;
56375a
     }
56375a
+    g_info ("tss2_tcti_tabrmd_set_locality: id 0x%" PRIx64,
56375a
+            TSS2_TCTI_TABRMD_ID (context));
56375a
     if (TSS2_TCTI_TABRMD_STATE (context) != TABRMD_STATE_TRANSMIT) {
56375a
         return TSS2_TCTI_RC_BAD_SEQUENCE;
56375a
     }
56375a
-- 
56375a
2.13.6
56375a