Message ID | 1479429004-7962-1-git-send-email-stefanb@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On Thu, Nov 17, 2016 at 07:30:03PM -0500, Stefan Berger wrote: > Check for the parent device being NULL before accessing it. This > prevents crashed with the vtpm_proxy driver, since this driver > does not have a parent device. > > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> > --- > drivers/char/tpm/tpm_of.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c > index 36df9df..72c282e 100644 > --- a/drivers/char/tpm/tpm_of.c > +++ b/drivers/char/tpm/tpm_of.c > @@ -29,7 +29,7 @@ int tpm_read_log_of(struct tpm_chip *chip) > struct tpm_bios_log *log; > > log = &chip->log; > - if (chip->dev.parent->of_node) > + if (chip->dev.parent && chip->dev.parent->of_node) > np = chip->dev.parent->of_node; > else > return -ENODEV; > -- > 2.4.3 CC to linux-security-module LGTM Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> /Jarkko ------------------------------------------------------------------------------
diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c index 36df9df..72c282e 100644 --- a/drivers/char/tpm/tpm_of.c +++ b/drivers/char/tpm/tpm_of.c @@ -29,7 +29,7 @@ int tpm_read_log_of(struct tpm_chip *chip) struct tpm_bios_log *log; log = &chip->log; - if (chip->dev.parent->of_node) + if (chip->dev.parent && chip->dev.parent->of_node) np = chip->dev.parent->of_node; else return -ENODEV;
Check for the parent device being NULL before accessing it. This prevents crashed with the vtpm_proxy driver, since this driver does not have a parent device. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> --- drivers/char/tpm/tpm_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)