* [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe
@ 2026-05-12 16:16 Rafael J. Wysocki
2026-05-16 1:14 ` Jarkko Sakkinen
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2026-05-12 16:16 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, Andy Shevchenko,
LKML, Linux ACPI
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
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.
Fixes: 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/char/tpm/tpm_crb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -786,8 +786,8 @@ static int crb_map_pluton(struct device
static 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 platfor
u32 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)) {
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe 2026-05-12 16:16 [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki @ 2026-05-16 1:14 ` Jarkko Sakkinen 2026-05-19 21:01 ` Rafael J. Wysocki 0 siblings, 1 reply; 7+ messages in thread From: Jarkko Sakkinen @ 2026-05-16 1:14 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, Andy Shevchenko, LKML, Linux ACPI On Tue, May 12, 2026 at 06:16:23PM +0200, Rafael J. Wysocki wrote: > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > > 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. > > Fixes: 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one") > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > drivers/char/tpm/tpm_crb.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > --- a/drivers/char/tpm/tpm_crb.c > +++ b/drivers/char/tpm/tpm_crb.c > @@ -786,8 +786,8 @@ static int crb_map_pluton(struct device > static 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 platfor > u32 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 <jarkko@kernel.org> Thank you. BR, Jarkko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe 2026-05-16 1:14 ` Jarkko Sakkinen @ 2026-05-19 21:01 ` Rafael J. Wysocki 2026-06-08 17:35 ` Rafael J. Wysocki 0 siblings, 1 reply; 7+ messages in thread From: Rafael J. Wysocki @ 2026-05-19 21:01 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Rafael J. Wysocki, Peter Huewe, Jason Gunthorpe, linux-integrity, Andy Shevchenko, LKML, Linux ACPI On Sat, May 16, 2026 at 3:15 AM Jarkko Sakkinen <jarkko@kernel.org> wrote: > > On Tue, May 12, 2026 at 06:16:23PM +0200, Rafael J. Wysocki wrote: > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > > > > 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. > > > > Fixes: 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one") > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > --- > > drivers/char/tpm/tpm_crb.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > --- a/drivers/char/tpm/tpm_crb.c > > +++ b/drivers/char/tpm/tpm_crb.c > > @@ -786,8 +786,8 @@ static int crb_map_pluton(struct device > > static 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 platfor > > u32 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 <jarkko@kernel.org> Thanks! So do you want me to pick up this one? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe 2026-05-19 21:01 ` Rafael J. Wysocki @ 2026-06-08 17:35 ` Rafael J. Wysocki 2026-06-09 15:45 ` Jarkko Sakkinen 0 siblings, 1 reply; 7+ messages in thread From: Rafael J. Wysocki @ 2026-06-08 17:35 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, Andy Shevchenko, LKML, Linux ACPI On Tue, May 19, 2026 at 11:01 PM Rafael J. Wysocki <rafael@kernel.org> wrote: > > On Sat, May 16, 2026 at 3:15 AM Jarkko Sakkinen <jarkko@kernel.org> wrote: > > > > On Tue, May 12, 2026 at 06:16:23PM +0200, Rafael J. Wysocki wrote: > > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > > > > > > 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. > > > > > > Fixes: 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one") > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > --- > > > drivers/char/tpm/tpm_crb.c | 6 +++++- > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > +++ b/drivers/char/tpm/tpm_crb.c > > > @@ -786,8 +786,8 @@ static int crb_map_pluton(struct device > > > static 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 platfor > > > u32 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 <jarkko@kernel.org> > > 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! ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe 2026-06-08 17:35 ` Rafael J. Wysocki @ 2026-06-09 15:45 ` Jarkko Sakkinen 2026-06-09 16:14 ` Rafael J. Wysocki 0 siblings, 1 reply; 7+ messages in thread From: Jarkko Sakkinen @ 2026-06-09 15:45 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, Andy Shevchenko, LKML, Linux ACPI On Mon, Jun 08, 2026 at 07:35:26PM +0200, Rafael J. Wysocki wrote: > On Tue, May 19, 2026 at 11:01 PM Rafael J. Wysocki <rafael@kernel.org> wrote: > > > > On Sat, May 16, 2026 at 3:15 AM Jarkko Sakkinen <jarkko@kernel.org> wrote: > > > > > > On Tue, May 12, 2026 at 06:16:23PM +0200, Rafael J. Wysocki wrote: > > > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > > > > > > > > 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. > > > > > > > > Fixes: 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one") > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > --- > > > > drivers/char/tpm/tpm_crb.c | 6 +++++- > > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > @@ -786,8 +786,8 @@ static int crb_map_pluton(struct device > > > > static 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 platfor > > > > u32 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 <jarkko@kernel.org> > > > > 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. > > Thanks! BR, Jarkko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe 2026-06-09 15:45 ` Jarkko Sakkinen @ 2026-06-09 16:14 ` Rafael J. Wysocki 2026-06-09 16:43 ` Jarkko Sakkinen 0 siblings, 1 reply; 7+ messages in thread From: Rafael J. Wysocki @ 2026-06-09 16:14 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Rafael J. Wysocki, Peter Huewe, Jason Gunthorpe, linux-integrity, Andy Shevchenko, LKML, Linux ACPI On Tue, Jun 9, 2026 at 5:45 PM Jarkko Sakkinen <jarkko@kernel.org> wrote: > > On Mon, Jun 08, 2026 at 07:35:26PM +0200, Rafael J. Wysocki wrote: > > On Tue, May 19, 2026 at 11:01 PM Rafael J. Wysocki <rafael@kernel.org> wrote: > > > > > > On Sat, May 16, 2026 at 3:15 AM Jarkko Sakkinen <jarkko@kernel.org> wrote: > > > > > > > > On Tue, May 12, 2026 at 06:16:23PM +0200, Rafael J. Wysocki wrote: > > > > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > > > > > > > > > > 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. > > > > > > > > > > Fixes: 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one") > > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > > --- > > > > > drivers/char/tpm/tpm_crb.c | 6 +++++- > > > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > @@ -786,8 +786,8 @@ static int crb_map_pluton(struct device > > > > > static 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 platfor > > > > > u32 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 <jarkko@kernel.org> > > > > > > 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. OK, I'll drop it then, thanks! ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe 2026-06-09 16:14 ` Rafael J. Wysocki @ 2026-06-09 16:43 ` Jarkko Sakkinen 0 siblings, 0 replies; 7+ messages in thread From: Jarkko Sakkinen @ 2026-06-09 16:43 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, Andy Shevchenko, LKML, Linux ACPI On Tue, Jun 09, 2026 at 06:14:47PM +0200, Rafael J. Wysocki wrote: > On Tue, Jun 9, 2026 at 5:45 PM Jarkko Sakkinen <jarkko@kernel.org> wrote: > > > > On Mon, Jun 08, 2026 at 07:35:26PM +0200, Rafael J. Wysocki wrote: > > > On Tue, May 19, 2026 at 11:01 PM Rafael J. Wysocki <rafael@kernel.org> wrote: > > > > > > > > On Sat, May 16, 2026 at 3:15 AM Jarkko Sakkinen <jarkko@kernel.org> wrote: > > > > > > > > > > On Tue, May 12, 2026 at 06:16:23PM +0200, Rafael J. Wysocki wrote: > > > > > > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> > > > > > > > > > > > > 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. > > > > > > > > > > > > Fixes: 48fe2cddc85c ("tpm_crb: Convert ACPI driver to a platform one") > > > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > > > --- > > > > > > drivers/char/tpm/tpm_crb.c | 6 +++++- > > > > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > > > > > > > --- a/drivers/char/tpm/tpm_crb.c > > > > > > +++ b/drivers/char/tpm/tpm_crb.c > > > > > > @@ -786,8 +786,8 @@ static int crb_map_pluton(struct device > > > > > > static 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 platfor > > > > > > u32 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 <jarkko@kernel.org> > > > > > > > > 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. > > OK, I'll drop it then, thanks! NP, and apologies for causing extra trouble! BR, Jarkko ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-06-09 16:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-12 16:16 [PATCH v1] tpm_crb: Check ACPI_COMPANION() against NULL during probe Rafael J. Wysocki 2026-05-16 1:14 ` Jarkko Sakkinen 2026-05-19 21:01 ` Rafael J. Wysocki 2026-06-08 17:35 ` Rafael J. Wysocki 2026-06-09 15:45 ` Jarkko Sakkinen 2026-06-09 16:14 ` Rafael J. Wysocki 2026-06-09 16:43 ` Jarkko Sakkinen
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.