aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2017-05-10 14:47:27 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-05-12 16:18:45 +1000
commit4450142f6682835394adc2f5422d3003581b5135 (patch)
tree4bf7c121ed54bae5b953381c091f95a9c9bc597e
parent6916c2a0faff1eedbe9138616e460792e50a0b94 (diff)
downloadskiboot-4450142f6682835394adc2f5422d3003581b5135.zip
skiboot-4450142f6682835394adc2f5422d3003581b5135.tar.gz
skiboot-4450142f6682835394adc2f5422d3003581b5135.tar.bz2
tpm_i2c_nuvoton: fix use-after-free in tpm_register_chip failure path
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--libstb/drivers/tpm_i2c_nuvoton.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libstb/drivers/tpm_i2c_nuvoton.c b/libstb/drivers/tpm_i2c_nuvoton.c
index 4cb017e..90e27a9 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;