diff options
author | Andi Shyti <andi.shyti@gmail.com> | 2012-05-28 16:42:45 (GMT) |
---|---|---|
committer | Rajiv Andrade <srajiv@linux.vnet.ibm.com> | 2012-06-12 21:53:51 (GMT) |
commit | 3072928ff2457642af0da745b88f0420b4596c48 (patch) | |
tree | d097ad703bcc2f25872bac17a75088a2af4ea725 /drivers/char/tpm/tpm.c | |
parent | dad79cb89254ce646906846b0f0cf7995d626710 (diff) | |
download | linux-fsl-qoriq-3072928ff2457642af0da745b88f0420b4596c48.tar.xz |
tpm: check the chip reference before using it
If a driver calls tpm_dev_vendor_release for a device already released
then the driver will oops.
Signed-off-by: Andi Shyti <andi.shyti@gmail.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r-- | drivers/char/tpm/tpm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index dae254d..d39b1f6 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -1330,6 +1330,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); void tpm_dev_vendor_release(struct tpm_chip *chip) { + if (!chip) + return; + if (chip->vendor.release) chip->vendor.release(chip->dev); @@ -1347,6 +1350,9 @@ void tpm_dev_release(struct device *dev) { struct tpm_chip *chip = dev_get_drvdata(dev); + if (!chip) + return; + tpm_dev_vendor_release(chip); chip->release(dev); |