summaryrefslogtreecommitdiff
path: root/lib/memory-notifier-error-inject.c
diff options
context:
space:
mode:
authorKurt Borja <kuurtb@gmail.com>2025-03-30 18:39:16 +0300
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2025-04-01 13:49:07 +0300
commit7b98c1c8e2ab79122f9d00697a6df0ddee6999de (patch)
tree01ed989d1723bd24cd52b6d79dde76709867ce76 /lib/memory-notifier-error-inject.c
parent08733088b566b58283f0f12fb73f5db6a9a9de30 (diff)
downloadlinux-7b98c1c8e2ab79122f9d00697a6df0ddee6999de.tar.xz
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 <damian@riscv-rocks.de> 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 <damian@riscv-rocks.de> Tested-by: Gene C <arch@sapience.com> Signed-off-by: Kurt Borja <kuurtb@gmail.com> Link: https://lore.kernel.org/r/20250330-thinkpad-fix-v1-1-4906b3fe6b74@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions