tpm_crb: Check ACPI_COMPANION() against NULL during probe
Subsystems (3)
Rafael J. Wysocki
maintainerPATCH 1/1 tpm_crb: Check ACPI_COMPANION() against NULL during probe
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.
Accordingly, add a requisite ACPI_COMPANION() check against NULL to the tpm_crb driver.
--- drivers/char/tpm/tpm_crb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_crb.c +5 -1
@@ -786,8 +786,8 @@ static int crb_map_pluton(struct devicestatic int crb_acpi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct acpi_device *device =ACPI_COMPANION (dev);struct acpi_table_tpm2 *buf; +struct acpi_device *device;struct crb_priv *priv;struct tpm_chip *chip;struct tpm2_crb_smc *crb_smc;
@@ -797,6 +797,10 @@ static int crb_acpi_probe(struct platforu32 sm;int rc; + device =ACPI_COMPANION (dev); +if (!device) +return -ENODEV ; + status =acpi_get_table (ACPI_SIG_TPM2 ,1 , (struct acpi_table_header **) &buf);if (ACPI_FAILURE (status) || buf->header.length <sizeof (*buf)) {
Quoted 32 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of
device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.Accordingly, add a requisite
ACPI_COMPANION()check against NULL to thetpm_crbdriver.Fixes 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/char/tpm/tpm_crb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +1
-1@@ -786,8 +786,8 @@ static int crb_map_pluton(struct devicestatic int crb_acpi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct acpi_device *device =ACPI_COMPANION (dev);struct acpi_table_tpm2 *buf; +struct acpi_device *device;struct crb_priv *priv;struct tpm_chip *chip;struct tpm2_crb_smc *crb_smc;
drivers/char/tpm/tpm_crb.c static int crb_acpi_probe(struct platfor · line 806
Quoted 10 lines
drivers/char/tpm/tpm_crb.c +4
-0@@ -797,6 +797,10 @@ static int crb_acpi_probe(struct platforu32 sm;int rc; + device =ACPI_COMPANION (dev); +if (!device) +return -ENODEV ; + status =acpi_get_table (ACPI_SIG_TPM2 ,1 , (struct acpi_table_header **) &buf);if (ACPI_FAILURE (status) || buf->header.length <sizeof (*buf)) {
Thank you.
BR, Jarkko
Rafael J. Wysocki
maintainerQuoted 34 lines · Jarkko Sakkinen
Quoted 32 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of
device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.Accordingly, add a requisite
ACPI_COMPANION()check against NULL to thetpm_crbdriver.Fixes 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/char/tpm/tpm_crb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +1
-1@@ -786,8 +786,8 @@ static int crb_map_pluton(struct devicestatic int crb_acpi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct acpi_device *device =ACPI_COMPANION (dev);struct acpi_table_tpm2 *buf; +struct acpi_device *device;struct crb_priv *priv;struct tpm_chip *chip;struct tpm2_crb_smc *crb_smc;@@ -797,6 +797,10 @@ static int crb_acpi_probe(struct platforu32 sm;int rc;
Quoted 12 lines
drivers/char/tpm/tpm_crb.c static int crb_acpi_probe(struct platfor · line 806
Quoted 10 lines
drivers/char/tpm/tpm_crb.c +4
-0+ device =ACPI_COMPANION (dev); +if (!device) +return -ENODEV ; + status =acpi_get_table (ACPI_SIG_TPM2 ,1 , (struct acpi_table_header **) &buf);if (ACPI_FAILURE (status) || buf->header.length <sizeof (*buf)) {Reviewed-by Jarkko Sakkinen <[email protected]>
Thanks!
So do you want me to pick up this one?
Rafael J. Wysocki
maintainerQuoted 49 lines · Rafael J. Wysocki
Quoted 34 lines · Jarkko Sakkinen
Quoted 32 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of
device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.Accordingly, add a requisite
ACPI_COMPANION()check against NULL to thetpm_crbdriver.Fixes 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/char/tpm/tpm_crb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +1
-1@@ -786,8 +786,8 @@ static int crb_map_pluton(struct devicestatic int crb_acpi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct acpi_device *device =ACPI_COMPANION (dev);struct acpi_table_tpm2 *buf; +struct acpi_device *device;struct crb_priv *priv;struct tpm_chip *chip;struct tpm2_crb_smc *crb_smc;@@ -797,6 +797,10 @@ static int crb_acpi_probe(struct platforu32 sm;int rc;Quoted 12 lines
drivers/char/tpm/tpm_crb.c static int crb_acpi_probe(struct platfor · line 806
Quoted 10 lines
drivers/char/tpm/tpm_crb.c +4
-0+ device =ACPI_COMPANION (dev); +if (!device) +return -ENODEV ; + status =acpi_get_table (ACPI_SIG_TPM2 ,1 , (struct acpi_table_header **) &buf);if (ACPI_FAILURE (status) || buf->header.length <sizeof (*buf)) {Reviewed-by Jarkko Sakkinen <[email protected]>
Quoted 3 lines
Thanks!
So do you want me to pick up this one?
I took the silence as consent and picked it up. If you'd rather route it differently, please let me know.
Thanks!
Jarkko Sakkinen
maintainerQuoted 50 lines · Rafael J. Wysocki
Quoted 49 lines · Rafael J. Wysocki
Quoted 46 lines · Jarkko Sakkinen
Quoted 32 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of
device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.Accordingly, add a requisite
ACPI_COMPANION()check against NULL to thetpm_crbdriver.Fixes 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/char/tpm/tpm_crb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +1
-1@@ -786,8 +786,8 @@ static int crb_map_pluton(struct devicestatic int crb_acpi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct acpi_device *device =ACPI_COMPANION (dev);struct acpi_table_tpm2 *buf; +struct acpi_device *device;struct crb_priv *priv;struct tpm_chip *chip;struct tpm2_crb_smc *crb_smc;drivers/char/tpm/tpm_crb.c static int crb_acpi_probe(struct platfor · line 806
Quoted 10 lines
drivers/char/tpm/tpm_crb.c +4
-0@@ -797,6 +797,10 @@ static int crb_acpi_probe(struct platforu32 sm;int rc; + device =ACPI_COMPANION (dev); +if (!device) +return -ENODEV ; + status =acpi_get_table (ACPI_SIG_TPM2 ,1 , (struct acpi_table_header **) &buf);if (ACPI_FAILURE (status) || buf->header.length <sizeof (*buf)) {Reviewed-by Jarkko Sakkinen <[email protected]>
Quoted 6 lines
Quoted 3 lines
Thanks!
So do you want me to pick up this one?
I took the silence as consent and picked it up. If you'd rather route it differently, please let me know.
OK my bad in commes, sorry. I did already pick this up and it is going to my next PR.
Quoted 2 lines
Thanks!
BR, Jarkko
Rafael J. Wysocki
maintainerQuoted 54 lines · Jarkko Sakkinen
Quoted 52 lines · Rafael J. Wysocki
Quoted 51 lines · Rafael J. Wysocki
Quoted 34 lines · Jarkko Sakkinen
Quoted 32 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of
device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.Accordingly, add a requisite
ACPI_COMPANION()check against NULL to thetpm_crbdriver.Fixes 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/char/tpm/tpm_crb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +1
-1@@ -786,8 +786,8 @@ static int crb_map_pluton(struct devicestatic int crb_acpi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct acpi_device *device =ACPI_COMPANION (dev);struct acpi_table_tpm2 *buf; +struct acpi_device *device;struct crb_priv *priv;struct tpm_chip *chip;struct tpm2_crb_smc *crb_smc;@@ -797,6 +797,10 @@ static int crb_acpi_probe(struct platforu32 sm;int rc;Quoted 12 lines
drivers/char/tpm/tpm_crb.c static int crb_acpi_probe(struct platfor · line 806
Quoted 10 lines
drivers/char/tpm/tpm_crb.c +4
-0+ device =ACPI_COMPANION (dev); +if (!device) +return -ENODEV ; + status =acpi_get_table (ACPI_SIG_TPM2 ,1 , (struct acpi_table_header **) &buf);if (ACPI_FAILURE (status) || buf->header.length <sizeof (*buf)) {Reviewed-by Jarkko Sakkinen <[email protected]>Thanks!
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
So do you want me to pick up this one?
I took the silence as consent and picked it up. If you'd rather route it differently, please let me know.
OK my bad in commes, sorry. I did already pick this up and it is going to my next PR.
OK, I'll drop it then, thanks!
Jarkko Sakkinen
maintainerQuoted 57 lines · Rafael J. Wysocki
Quoted 56 lines · Jarkko Sakkinen
Quoted 54 lines · Rafael J. Wysocki
Quoted 52 lines · Rafael J. Wysocki
Quoted 34 lines · Jarkko Sakkinen
Quoted 32 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of
device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.Accordingly, add a requisite
ACPI_COMPANION()check against NULL to thetpm_crbdriver.Fixes 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one")Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/char/tpm/tpm_crb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +1
-1@@ -786,8 +786,8 @@ static int crb_map_pluton(struct devicestatic int crb_acpi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct acpi_device *device =ACPI_COMPANION (dev);struct acpi_table_tpm2 *buf; +struct acpi_device *device;struct crb_priv *priv;struct tpm_chip *chip;struct tpm2_crb_smc *crb_smc;@@ -797,6 +797,10 @@ static int crb_acpi_probe(struct platforu32 sm;int rc;Quoted 12 lines
drivers/char/tpm/tpm_crb.c static int crb_acpi_probe(struct platfor · line 806
Quoted 10 lines
drivers/char/tpm/tpm_crb.c +4
-0+ device =ACPI_COMPANION (dev); +if (!device) +return -ENODEV ; + status =acpi_get_table (ACPI_SIG_TPM2 ,1 , (struct acpi_table_header **) &buf);if (ACPI_FAILURE (status) || buf->header.length <sizeof (*buf)) {Reviewed-by Jarkko Sakkinen <[email protected]>Thanks!
So do you want me to pick up this one?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I took the silence as consent and picked it up. If you'd rather route it differently, please let me know.
OK my bad in commes, sorry. I did already pick this up and it is going to my next PR.
OK, I'll drop it then, thanks!
NP, and apologies for causing extra trouble!
BR, Jarkko