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.
diff --git a/tboot/common/tb_error.c b/tboot/common/tb_error.c
index 6038929..67ddf16 100644
--- a/tboot/common/tb_error.c
+++ b/tboot/common/tb_error.c
@@ -157,7 +157,7 @@ bool read_tb_error_code(tb_error_t *error)
  */
 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,
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to