lkml.org 
[lkml]   [2006]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectre: [PATCH] PCI: add proper MCFG table parsing to ACPI core.
Hey Greg,

This a bit late (yours patch was posted about a year ago), but
a co-worker of spotted part of the code that looks like a memory
leak. Looking at the code it seems that pci_mmcfg_config should
be free-ed if MMCONFIG is above 4GB.

> +/* The physical address of the MMCONFIG aperture. Set from ACPI
> tables. */
> + config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config);
> + pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL);
> + memcpy(pci_mmcfg_config, &mcfg->config, config_size);
> + for (i = 0; i < pci_mmcfg_config_num; ++i) {
> + if (mcfg->config[i].base_reserved) {
> + printk(KERN_ERR PREFIX
> + "MMCONFIG not in low 4GB of memory\n");
> + return -ENODEV;

Here is a proposed patch. What are your thoughts?

diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 40e5aba..fbe9308 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -202,6 +202,8 @@ int __init acpi_parse_mcfg(unsigned long
if (mcfg->config[i].base_reserved) {
printk(KERN_ERR PREFIX
"MMCONFIG not in low 4GB of memory\n");
+ kfree(pci_mmcfg_config);
+ pci_mmcfg_config_num = 0;
return -ENODEV;
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-06-15 18:10    [W:0.039 / U:1.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site