From: Gang W. <gan...@in...> - 2014-02-24 03:50:52
|
changeset 687048b24ef3 in /hg/p/tboot/code details: http://hg.code.sf.net/p/tboot/code/code?cmd=changeset;node=687048b24ef3 description: Fix crash when TPM is missing The latest tboot crashes during boot if there's no TPM at all, because write_tb_error_code() tries to dereference the null g_tpm pointer. IMHO all the functions that dereference g_tpm should first check if it's null, and return an error code. This patch fixes only one instance. Signed-off-by: Ed Swierk <es...@sk...> diffstat: tboot/common/tb_error.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 2cb8d6ec8a4a -r 687048b24ef3 tboot/common/tb_error.c --- a/tboot/common/tb_error.c Mon Feb 24 11:09:06 2014 +0800 +++ b/tboot/common/tb_error.c Mon Feb 24 11:09:18 2014 +0800 @@ -157,7 +157,7 @@ */ bool write_tb_error_code(tb_error_t error) { - if ( no_err_idx ) + if ( !g_tpm || no_err_idx ) return false; if ( !g_tpm->nv_write(g_tpm, 0, g_tpm->tb_err_index, 0, |