Skip to content

Commit 6f55d06

Browse files
committed
platform/x86/intel/pmt: fix a crashlog NULL pointer access
JIRA: https://issues.redhat.com/browse/RHEL-120895 commit 54d5cd4 Author: Michael J. Ruhl <[email protected]> Date: Sun Jul 13 13:29:31 2025 -0400 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: 045a513 ("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]> Signed-off-by: David Arcari <[email protected]>
1 parent d73098d commit 6f55d06

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/platform/x86/intel/pmt/class.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ intel_pmt_read(struct file *filp, struct kobject *kobj,
9999
if (count > entry->size - off)
100100
count = entry->size - off;
101101

102-
count = pmt_telem_read_mmio(entry->ep->pcidev, entry->cb, entry->header.guid, buf,
102+
count = pmt_telem_read_mmio(entry->pcidev, entry->cb, entry->header.guid, buf,
103103
entry->base, off, count);
104104

105105
return count;
@@ -283,6 +283,7 @@ static int intel_pmt_populate_entry(struct intel_pmt_entry *entry,
283283
return -EINVAL;
284284
}
285285

286+
entry->pcidev = pci_dev;
286287
entry->guid = header->guid;
287288
entry->size = header->size;
288289
entry->cb = ivdev->priv_data;

drivers/platform/x86/intel/pmt/class.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct intel_pmt_header {
4040

4141
struct intel_pmt_entry {
4242
struct telem_endpoint *ep;
43+
struct pci_dev *pcidev;
4344
struct intel_pmt_header header;
4445
struct bin_attribute pmt_bin_attr;
4546
struct kobject *kobj;

0 commit comments

Comments
 (0)