tcti-abrmd: Fix null deref
Backport upstream commit to clean up null derefs reported by coverity scan. Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
This commit is contained in:
parent
47d85b1d32
commit
32e3d5ec65
@ -0,0 +1,50 @@
|
||||
From 418d49669a33f9e6b029787e3869b3a534bb7de8 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Tricca <philip.b.tricca@intel.com>
|
||||
Date: Mon, 14 Aug 2017 13:57:51 -0700
|
||||
Subject: [PATCH] tcti-tabrmd: Fix NULL deref bug by moving debug output after
|
||||
NULL check.
|
||||
|
||||
This one speaks for itself: The debug output dereferences the pointer to
|
||||
the context structure before checking for NULL. Switching these two
|
||||
things around fixes the issue.
|
||||
|
||||
Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
|
||||
---
|
||||
src/tcti-tabrmd.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/tcti-tabrmd.c b/src/tcti-tabrmd.c
|
||||
index 970702c..134cf8d 100644
|
||||
--- a/src/tcti-tabrmd.c
|
||||
+++ b/src/tcti-tabrmd.c
|
||||
@@ -293,11 +293,11 @@ tss2_tcti_tabrmd_cancel (TSS2_TCTI_CONTEXT *context)
|
||||
GError *error = NULL;
|
||||
gboolean cancel_ret;
|
||||
|
||||
- g_info("tss2_tcti_tabrmd_cancel: id 0x%" PRIx64,
|
||||
- TSS2_TCTI_TABRMD_ID (context));
|
||||
if (context == NULL) {
|
||||
return TSS2_TCTI_RC_BAD_CONTEXT;
|
||||
}
|
||||
+ g_info("tss2_tcti_tabrmd_cancel: id 0x%" PRIx64,
|
||||
+ TSS2_TCTI_TABRMD_ID (context));
|
||||
if (TSS2_TCTI_TABRMD_STATE (context) != TABRMD_STATE_RECEIVE) {
|
||||
return TSS2_TCTI_RC_BAD_SEQUENCE;
|
||||
}
|
||||
@@ -346,11 +346,11 @@ tss2_tcti_tabrmd_set_locality (TSS2_TCTI_CONTEXT *context,
|
||||
TSS2_RC ret = TSS2_RC_SUCCESS;
|
||||
GError *error = NULL;
|
||||
|
||||
- g_info ("tss2_tcti_tabrmd_set_locality: id 0x%" PRIx64,
|
||||
- TSS2_TCTI_TABRMD_ID (context));
|
||||
if (context == NULL) {
|
||||
return TSS2_TCTI_RC_BAD_CONTEXT;
|
||||
}
|
||||
+ g_info ("tss2_tcti_tabrmd_set_locality: id 0x%" PRIx64,
|
||||
+ TSS2_TCTI_TABRMD_ID (context));
|
||||
if (TSS2_TCTI_TABRMD_STATE (context) != TABRMD_STATE_TRANSMIT) {
|
||||
return TSS2_TCTI_RC_BAD_SEQUENCE;
|
||||
}
|
||||
--
|
||||
2.13.6
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
Name: tpm2-abrmd
|
||||
Version: 1.1.0
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
Summary: A system daemon implementing TPM2 Access Broker and Resource Manager
|
||||
|
||||
License: BSD
|
||||
URL: https://github.com/01org/tpm2-abrmd
|
||||
Source0: https://github.com/01org/tpm2-abrmd/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
# upstream commit 418d49669a33f9e6b029787e3869b3a534bb7de8
|
||||
Patch0: 0001-tcti-tabrmd-Fix-NULL-deref-bug-by-moving-debug-outpu.patch
|
||||
|
||||
%{?systemd_requires}
|
||||
BuildRequires: systemd
|
||||
@ -30,7 +32,7 @@ tpm2-abrmd is a system daemon implementing the TPM2 access broker (TAB) and
|
||||
Resource Manager (RM) spec from the TCG.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version}
|
||||
%autosetup -p1 -n %{name}-%{version}
|
||||
autoreconf -vif
|
||||
|
||||
%build
|
||||
@ -91,6 +93,9 @@ required to build applications that use tpm2-abrmd.
|
||||
%systemd_postun tpm2-abrmd.service
|
||||
|
||||
%changelog
|
||||
* Wed Oct 18 2017 Jerry Snitselaar <jsnitsel@redhat.com> - 1.1.0-7
|
||||
- tcti-abrmd: Fix null deref
|
||||
|
||||
* Fri Oct 13 2017 Sun Yunying <yunying.sun@intel.com> - 1.1.0-6
|
||||
- Add tss user if doesn't currently exist - PR#1 from Jerry Snitselaar
|
||||
- Removed source tarball and cleared it from .gitignore
|
||||
|
||||
Loading…
Reference in New Issue
Block a user