platform/x86/intel/pmt: Block mmap when callback is present
Subsystems (2)
PATCH 1/1 platform/x86/intel/pmt: Block mmap when callback is present
With the introduction of the .read_telem() callback, control for access to a devices data area must be done by the callback owner.
This means that an area cannot be mmap-ed with the default PMT handler.
If the .read_telem() callback is present, do not support mmap.
Fixes 045a513040cc ("platform/x86/intel/pmt: Use PMT callbacks")
Signed-off-by Michael J. Ruhl <[email protected]>
--- drivers/platform/x86/intel/pmt/class.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/pmt/class.c +8 -1
@@ -417,7 +417,14 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,sysfs_bin_attr_init (&entry->pmt_bin_attr); entry->pmt_bin_attr.attr.name = ns->name; entry->pmt_bin_attr.attr.mode =0440 ; - entry->pmt_bin_attr.mmap = intel_pmt_mmap; + +/* +* The read_telem callback controls access to the memory area. Block +* usage if the read_telem callback is present. +*/ +if (!(entry->cb && entry->cb->read_telem)) + entry->pmt_bin_attr.mmap = intel_pmt_mmap; + entry->pmt_bin_attr.read = intel_pmt_read; entry->pmt_bin_attr.size = entry->size;
Signature · 1 line
2.43.0