diff options
| author | Kurt Borja <[email protected]> | 2025-03-30 15:39:16 +0000 |
|---|---|---|
| committer | Ilpo Järvinen <[email protected]> | 2025-04-01 10:49:07 +0000 |
| commit | 7b98c1c8e2ab79122f9d00697a6df0ddee6999de (patch) | |
| tree | 01ed989d1723bd24cd52b6d79dde76709867ce76 /rust/helpers/rcu.c | |
| parent | Merge tag 'rust-fixes-6.15-merge' of git://git.kernel.org/pub/scm/linux/kerne... (diff) | |
| download | kernel-7b98c1c8e2ab79122f9d00697a6df0ddee6999de.tar.gz kernel-7b98c1c8e2ab79122f9d00697a6df0ddee6999de.zip | |
platform/x86: thinkpad_acpi: Fix NULL pointer dereferences while probing
Some subdrivers make use of the global reference tpacpi_pdev during
initialization, which is called from the platform driver's probe.
However, after the commit 38b9ab80db31 ("platform/x86: thinkpad_acpi:
Move subdriver initialization to tpacpi_pdriver's probe.") this
variable is only properly initialized *after* probing and this can
result in a NULL pointer dereference.
In order to fix this without reverting the commit, register the platform
bundle in two steps, first create and initialize tpacpi_pdev, then
register the driver synchronously with platform_driver_probe(). This way
the benefits of commit 38b9ab80db31 are preserved.
Additionally, the commit 43fc63a1e8f6 ("platform/x86: thinkpad_acpi:
Move HWMON initialization to tpacpi_hwmon_pdriver's probe") introduced
a similar problem, however tpacpi_sensors_pdev is only used once inside
the probe, so replace the global reference with the one given by the
probe.
Reported-by: Damian Tometzki <[email protected]>
Closes: https://lore.kernel.org/r/CAL=B37kdL1orSQZD2A3skDOevRXBzF__cJJgY_GFh9LZO3FMsw@mail.gmail.com/
Fixes: 38b9ab80db31 ("platform/x86: thinkpad_acpi: Move subdriver initialization to tpacpi_pdriver's probe.")
Fixes: 43fc63a1e8f6 ("platform/x86: thinkpad_acpi: Move HWMON initialization to tpacpi_hwmon_pdriver's probe")
Tested-by: Damian Tometzki <[email protected]>
Tested-by: Gene C <[email protected]>
Signed-off-by: Kurt Borja <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Ilpo Järvinen <[email protected]>
Diffstat (limited to 'rust/helpers/rcu.c')
0 files changed, 0 insertions, 0 deletions
