Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163437796
D48168.id148330.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.id148330.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
@@ -230,7 +230,7 @@
pmc_md_initialize(void)
{
int i;
- struct pmc_mdep *md;
+ struct pmc_mdep *md = NULL;
/* determine the CPU kind */
if (cpu_vendor_id == CPU_VENDOR_AMD ||
@@ -238,17 +238,18 @@
md = pmc_amd_initialize();
else if (cpu_vendor_id == CPU_VENDOR_INTEL)
md = pmc_intel_initialize();
- else
+
+ if (md == NULL)
return (NULL);
+ nmi_register_handler(md->pmd_intr);
/* disallow sampling if we do not have an LAPIC */
- if (md != NULL && !lapic_enable_pcint())
+ 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;
}
- nmi_register_handler(md->pmd_intr);
return (md);
}
@@ -256,9 +257,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
Fri, Jul 24, 5:00 AM (11 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35431550
Default Alt Text
D48168.id148330.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