public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek <konradr@redhat.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org
Subject: re: [PATCH] PCI: add proper MCFG table parsing to ACPI core.
Date: Thu, 15 Jun 2006 12:08:30 -0400	[thread overview]
Message-ID: <20060615160830.GD3242@andromeda.dapyr.net> (raw)
In-Reply-To: <20060615072854.GA29713@kroah.com>

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;
 		}
 	}

  reply	other threads:[~2006-06-15 16:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-14 13:08 resubmitting intr urb in 2.4 and 2.6 kernels Sergej Pupykin
2006-06-15  7:28 ` Greg KH
2006-06-15 16:08   ` Konrad Rzeszutek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-06-28  5:32 [PATCH] PCI: fix up errors after dma bursting patch and CONFIG_PCI=n Greg KH
2005-06-28  5:32 ` [PATCH] PCI: add proper MCFG table parsing to ACPI core Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060615160830.GD3242@andromeda.dapyr.net \
    --to=konradr@redhat.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox