linux-stable/drivers/platform/x86
Prarit Bhargava 2cdfa0c20d platform/x86/intel: Fix 'rmmod pmt_telemetry' panic
'rmmod pmt_telemetry' panics with:

 BUG: kernel NULL pointer dereference, address: 0000000000000040
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: 0000 [#1] PREEMPT SMP NOPTI
 CPU: 4 PID: 1697 Comm: rmmod Tainted: G S      W        --------  ---  5.18.0-rc4 #3
 Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-P DDR5 RVP, BIOS ADLPFWI1.R00.3056.B00.2201310233 01/31/2022
 RIP: 0010:device_del+0x1b/0x3d0
 Code: e8 1a d9 e9 ff e9 58 ff ff ff 48 8b 08 eb dc 0f 1f 44 00 00 41 56 41 55 41 54 55 48 8d af 80 00 00 00 53 48 89 fb 48 83 ec 18 <4c> 8b 67 40 48 89 ef 65 48 8b 04 25 28 00 00 00 48 89 44 24 10 31
 RSP: 0018:ffffb520415cfd60 EFLAGS: 00010286
 RAX: 0000000000000070 RBX: 0000000000000000 RCX: 0000000000000000
 RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000
 RBP: 0000000000000080 R08: ffffffffffffffff R09: ffffb520415cfd78
 R10: 0000000000000002 R11: ffffb520415cfd78 R12: 0000000000000000
 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 FS:  00007f7e198e5740(0000) GS:ffff905c9f700000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000040 CR3: 000000010782a005 CR4: 0000000000770ee0
 PKRU: 55555554
 Call Trace:
  <TASK>
  ? __xa_erase+0x53/0xb0
  device_unregister+0x13/0x50
  intel_pmt_dev_destroy+0x34/0x60 [pmt_class]
  pmt_telem_remove+0x40/0x50 [pmt_telemetry]
  auxiliary_bus_remove+0x18/0x30
  device_release_driver_internal+0xc1/0x150
  driver_detach+0x44/0x90
  bus_remove_driver+0x74/0xd0
  auxiliary_driver_unregister+0x12/0x20
  pmt_telem_exit+0xc/0xe4a [pmt_telemetry]
  __x64_sys_delete_module+0x13a/0x250
  ? syscall_trace_enter.isra.19+0x11e/0x1a0
  do_syscall_64+0x58/0x80
  ? syscall_exit_to_user_mode+0x12/0x30
  ? do_syscall_64+0x67/0x80
  ? syscall_exit_to_user_mode+0x12/0x30
  ? do_syscall_64+0x67/0x80
  ? syscall_exit_to_user_mode+0x12/0x30
  ? do_syscall_64+0x67/0x80
  ? exc_page_fault+0x64/0x140
  entry_SYSCALL_64_after_hwframe+0x44/0xae
 RIP: 0033:0x7f7e1803a05b
 Code: 73 01 c3 48 8b 0d 2d 4e 38 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d fd 4d 38 00 f7 d8 64 89 01 48

The probe function, pmt_telem_probe(), adds an entry for devices even if
they have not been initialized.  This results in the array of initialized
devices containing both initialized and uninitialized entries.  This
causes a panic in the remove function, pmt_telem_remove() which expects
the array to only contain initialized entries.

Only use an entry when a device is initialized.

Cc: "David E. Box" <david.e.box@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: David Arcari <darcari@redhat.com>
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Reviewed-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20220429122322.2550003-1-prarit@redhat.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-05-06 13:05:57 +02:00
..
dell platform/x86: dell-laptop: Add quirk entry for Latitude 7520 2022-04-27 16:55:54 +02:00
intel platform/x86/intel: Fix 'rmmod pmt_telemetry' panic 2022-05-06 13:05:57 +02:00
acer-wireless.c
acer-wmi.c platform/x86: acer-wmi: use __packed instead of __attribute__((packed)) 2021-09-14 12:27:15 +02:00
acerhdf.c platform/x86: acerhdf: Cleanup str_starts_with() 2022-04-04 15:50:23 +02:00
adv_swbutton.c platform/x86: add support for Advantech software defined button 2021-04-07 19:46:56 +02:00
amd-pmc.c platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND 2022-04-04 16:26:09 +02:00
amd_hsmp.c platform/x86: Add AMD system management interface 2022-03-02 11:42:36 +01:00
amilo-rfkill.c
apple-gmux.c platform/x86: apple-gmux: use resource_size() with res 2021-12-21 19:35:33 +01:00
asus-laptop.c platform/x86: asus-laptop: fix kobj_to_dev.cocci warnings 2021-03-23 21:06:10 +01:00
asus-nb-wmi.c platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s 2021-08-12 17:18:28 +02:00
asus-tf103c-dock.c platform/x86: asus-tf103c-dock: Make 2 global structs static 2022-01-24 10:41:47 +01:00
asus-wireless.c
asus-wmi.c platform/x86: asus-wmi: Fix driver not binding when fan curve control probe fails 2022-04-27 16:55:54 +02:00
asus-wmi.h
barco-p50-gpio.c platform/x86: barco-p50-gpio: Fix duplicate included linux/io.h 2022-04-04 15:50:23 +02:00
classmate-laptop.c platform/x86: Typo fix in the file classmate-laptop.c 2021-03-23 21:05:58 +01:00
compal-laptop.c
dual_accel_detect.h platform/x86: dual_accel_detect: Use the new i2c_acpi_client_count() helper 2021-08-12 17:26:36 +02:00
eeepc-laptop.c
eeepc-wmi.c
firmware_attributes_class.c platform/x86: dell-wmi-sysman: fw_attr_inuse can be static 2021-06-16 17:47:52 +02:00
firmware_attributes_class.h platform/x86: firmware_attributes_class: Create helper file for handling firmware-attributes class registration events 2021-06-16 17:47:51 +02:00
fujitsu-laptop.c
fujitsu-tablet.c
gigabyte-wmi.c platform/x86: gigabyte-wmi: added support for B660 GAMING X DDR4 motherboard 2022-04-27 16:55:54 +02:00
gpd-pocket-fan.c platform/x86: gpd pocket fan: Clean-up by using managed work init 2021-03-23 15:22:40 +01:00
hdaps.c platform/x86: hdaps: Constify static attribute_group struct 2021-06-16 17:47:54 +02:00
hp-wmi.c platform/x86: hp-wmi: support omen thermal profile policy v1 2022-03-15 10:49:37 +01:00
hp_accel.c platform/x86: hp_accel: Use SIMPLE_DEV_PM_OPS() for PM ops 2021-12-07 12:21:01 +01:00
huawei-wmi.c platform/x86: huawei-wmi: check the return value of device_create_file() 2022-03-08 16:33:15 +01:00
ibm_rtl.c
ideapad-laptop.c platform: x86: ideapad-laptop: Use ACPI_COMPANION() directly 2021-10-19 16:55:56 +02:00
intel_ips.c platform/x86: intel_ips: fix set but unused warning in read_mgtv 2021-06-16 17:47:55 +02:00
intel_ips.h
intel_scu_ipc.c platform/x86: intel_scu_ipc: Update timeout value in comment 2021-10-11 15:34:51 +02:00
intel_scu_ipcutil.c
intel_scu_pcidrv.c
intel_scu_pltdrv.c
intel_scu_wdt.c
Kconfig platform/x86: x86-android-tablets: Depend on EFI and SPI 2022-03-09 18:17:45 +01:00
lenovo-yogabook-wmi.c platform/x86: lenovo-yogabook-wmi: Add support for hall sensor on the back 2021-12-07 12:21:01 +01:00
lg-laptop.c lg-laptop: Move setting of battery charge limit to common location 2022-02-23 11:36:24 +01:00
Makefile platform/x86: Add AMD system management interface 2022-03-02 11:42:36 +01:00
meraki-mx100.c platform/x86: add meraki-mx100 platform driver 2021-08-12 09:26:28 +02:00
mlx-platform.c platform/x86: mlx-platform: Add support for new system SGN2410 2021-10-27 16:29:03 +02:00
msi-laptop.c
msi-wmi.c
mxm-wmi.c
nvidia-wmi-ec-backlight.c platform/x86: Rename wmaa-backlight-wmi to nvidia-wmi-ec-backlight 2021-10-11 14:59:45 +02:00
panasonic-laptop.c platform/x86: panasonic-laptop: Replace snprintf in show functions with sysfs_emit 2021-10-19 16:59:44 +02:00
pcengines-apuv2.c platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables 2021-08-06 14:04:43 +02:00
peaq-wmi.c
pmc_atom.c platform/x86: pmc_atom: improve critclk_systems matching for Siemens PCs 2021-12-23 18:09:41 +01:00
samsung-laptop.c platform/x86: samsung-laptop: Fix an unsigned comparison which can never be negative 2022-04-04 15:49:37 +02:00
samsung-q10.c
serial-multi-instantiate.c ACPI / scan: Create platform device for CS35L41 2022-02-02 18:12:41 +01:00
simatic-ipc.c platform/x86: simatic-ipc: add main driver for Siemens devices 2021-12-23 18:09:06 +01:00
sony-laptop.c platform/x86: sony-laptop: replace snprintf in show functions with sysfs_emit 2021-10-22 11:13:25 +02:00
system76_acpi.c platform/x86: system76_acpi: Guard System76 EC specific functionality 2021-12-23 17:26:28 +01:00
tc1100-wmi.c platform/x86: tc1100-wmi: Constify static attribute_group struct 2021-06-16 17:47:54 +02:00
think-lmi.c platform/x86: think-lmi: certificate support clean ups 2022-04-04 15:20:53 +02:00
think-lmi.h platform/x86: think-lmi: certificate support clean ups 2022-04-04 15:20:53 +02:00
thinkpad_acpi.c platform/x86: thinkpad_acpi: Correct dual fan probe 2022-05-06 13:05:57 +02:00
topstar-laptop.c
toshiba-wmi.c
toshiba_acpi.c proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
toshiba_bluetooth.c
toshiba_haps.c platform/x86: toshiba_haps: Fix missing newline in pr_debug call in toshiba_haps_notify 2021-06-16 17:47:49 +02:00
touchscreen_dmi.c platform/x86: touchscreen_dmi: Add info for the RWC NANOTE P8 AY07J 2-in-1 2022-01-24 10:41:45 +01:00
uv_sysfs.c x86/platform/uv: use default_groups in kobj_type 2021-12-30 19:32:23 +01:00
wireless-hotkey.c platform/x86: wireless-hotkey: remove hardcoded "hp" from the error message 2021-07-14 22:32:26 +02:00
wmi-bmof.c platform/x86: wmi: Make remove callback return void 2021-03-08 11:33:39 +01:00
wmi.c platform/x86: wmi: Add no_notify_data flag to struct wmi_driver 2021-12-06 22:33:39 +01:00
x86-android-tablets.c platform/x86: x86-android-tablets: Lenovo Yoga Tablet 2 830/1050 sound support 2022-03-02 11:43:45 +01:00
xiaomi-wmi.c
xo1-rfkill.c
xo15-ebook.c platform: x86: ACPI: Get rid of ACPICA message printing 2021-03-08 11:33:39 +01:00