diff options
| author | Michael J. Ruhl <[email protected]> | 2025-07-13 17:29:31 +0000 |
|---|---|---|
| committer | Ilpo Järvinen <[email protected]> | 2025-07-22 14:38:44 +0000 |
| commit | 54d5cd4719c5e87f33d271c9ac2e393147d934f8 (patch) | |
| tree | 4baaee5e3305d02ef69bd7a7d8009ccbe9a6f366 /drivers/platform/x86/intel/pmt/class.h | |
| parent | platform/x86: samsung-laptop: Expose charge_types (diff) | |
| download | kernel-54d5cd4719c5e87f33d271c9ac2e393147d934f8.tar.gz kernel-54d5cd4719c5e87f33d271c9ac2e393147d934f8.zip | |
platform/x86/intel/pmt: fix a crashlog NULL pointer access
Usage of the intel_pmt_read() for binary sysfs, requires a pcidev. The
current use of the endpoint value is only valid for telemetry endpoint
usage.
Without the ep, the crashlog usage causes the following NULL pointer
exception:
BUG: kernel NULL pointer dereference, address: 0000000000000000
Oops: Oops: 0000 [#1] SMP NOPTI
RIP: 0010:intel_pmt_read+0x3b/0x70 [pmt_class]
Code:
Call Trace:
<TASK>
? sysfs_kf_bin_read+0xc0/0xe0
kernfs_fop_read_iter+0xac/0x1a0
vfs_read+0x26d/0x350
ksys_read+0x6b/0xe0
__x64_sys_read+0x1d/0x30
x64_sys_call+0x1bc8/0x1d70
do_syscall_64+0x6d/0x110
Augment struct intel_pmt_entry with a pointer to the pcidev to avoid
the NULL pointer exception.
Fixes: 045a513040cc ("platform/x86/intel/pmt: Use PMT callbacks")
Cc: [email protected]
Reviewed-by: David E. Box <[email protected]>
Reviewed-by: Tejas Upadhyay <[email protected]>
Signed-off-by: Michael J. Ruhl <[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 'drivers/platform/x86/intel/pmt/class.h')
| -rw-r--r-- | drivers/platform/x86/intel/pmt/class.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel/pmt/class.h b/drivers/platform/x86/intel/pmt/class.h index fdf7e79d8c0d..ebd49e2cb2d5 100644 --- a/drivers/platform/x86/intel/pmt/class.h +++ b/drivers/platform/x86/intel/pmt/class.h @@ -40,6 +40,7 @@ struct intel_pmt_header { struct intel_pmt_entry { struct telem_endpoint *ep; + struct pci_dev *pcidev; struct intel_pmt_header header; struct bin_attribute pmt_bin_attr; struct kobject *kobj; |
