Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144387024
D48168.id148302.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D48168.id148302.diff
View Options
diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c
--- a/sys/dev/hwpmc/hwpmc_x86.c
+++ b/sys/dev/hwpmc/hwpmc_x86.c
@@ -241,14 +241,17 @@
else
return (NULL);
- /* disallow sampling if we do not have an LAPIC */
- if (md != NULL && !lapic_enable_pcint())
- for (i = 0; i < md->pmd_nclass; i++) {
- if (i == PMC_CLASS_INDEX_SOFT)
- continue;
- md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;
- }
- nmi_register_handler(md->pmd_intr);
+ if (md != NULL) {
+ nmi_register_handler(md->pmd_intr);
+ /* disallow sampling if we do not have an LAPIC */
+ if (!lapic_enable_pcint())
+ for (i = 0; i < md->pmd_nclass; i++) {
+ if (i == PMC_CLASS_INDEX_SOFT)
+ continue;
+ md->pmd_classdep[i].pcd_caps &=
+ ~PMC_CAP_INTERRUPT;
+ }
+ }
return (md);
}
@@ -256,9 +259,10 @@
void
pmc_md_finalize(struct pmc_mdep *md)
{
-
- lapic_disable_pcint();
- nmi_remove_handler(md->pmd_intr);
+ if (md != NULL) {
+ lapic_disable_pcint();
+ nmi_remove_handler(md->pmd_intr);
+ }
if (cpu_vendor_id == CPU_VENDOR_AMD ||
cpu_vendor_id == CPU_VENDOR_HYGON)
pmc_amd_finalize(md);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 4:33 AM (20 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28537656
Default Alt Text
D48168.id148302.diff (1 KB)
Attached To
Mode
D48168: hwpmc_x86: Fix NULL deref when loading on unsupported hardware
Attached
Detach File
Event Timeline
Log In to Comment