[Skiboot] [PATCH] tpm_i2c_nuvoton: fix use-after-free in tpm_register_chip failure path

Stewart Smith stewart at linux.vnet.ibm.com
Wed May 10 14:47:27 AEST 2017


Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 libstb/drivers/tpm_i2c_nuvoton.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libstb/drivers/tpm_i2c_nuvoton.c b/libstb/drivers/tpm_i2c_nuvoton.c
index 4cb017e45c85..90e27a9b89ad 100644
--- a/libstb/drivers/tpm_i2c_nuvoton.c
+++ b/libstb/drivers/tpm_i2c_nuvoton.c
@@ -573,8 +573,10 @@ void tpm_i2c_nuvoton_probe(void)
 			goto disable;
 		}
 		if (tpm_register_chip(node, tpm_device,
-				      &tpm_i2c_nuvoton_driver))
+				      &tpm_i2c_nuvoton_driver)) {
 			free(tpm_device);
+			continue;
+		}
 		bus = i2c_find_bus_by_id(tpm_device->bus_id);
 		assert(bus->check_quirk == NULL);
 		bus->check_quirk = nuvoton_tpm_quirk;
-- 
2.9.3



More information about the Skiboot mailing list