From: Myron Stowe <myron.stowe@hp.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Corey Minyard <minyard@acm.org>,
Andrew Morton <akpm@linux-foundation.org>,
Matthew Garrett <mjg@redhat.com>, Len Brown <len.brown@intel.com>,
openipmi-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] ipmi: Fix memleaking for add_smi when duplicating happen
Date: Tue, 27 Jul 2010 09:44:42 -0600 [thread overview]
Message-ID: <1280245482.2419.1.camel@zim> (raw)
In-Reply-To: <4C4E674A.2040605@kernel.org>
On Mon, 2010-07-26 at 21:57 -0700, Yinghai Lu wrote:
> need free the temp info struct when we have duplicated ones
Nice catch on these. Could you improve the patch description please.
Myron
>
> -v2: seperate printing change to another patch
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> drivers/char/ipmi/ipmi_si_intf.c | 35 ++++++++++++++++++++++++++++-------
> 1 file changed, 28 insertions(+), 7 deletions(-)
>
> Index: linux-2.6/drivers/char/ipmi/ipmi_si_intf.c
> ===================================================================
> --- linux-2.6.orig/drivers/char/ipmi/ipmi_si_intf.c
> +++ linux-2.6/drivers/char/ipmi/ipmi_si_intf.c
> @@ -1804,9 +1804,12 @@ static int hotmod_handler(const char *va
> info->irq_setup = std_irq_setup;
> info->slave_addr = ipmb;
>
> - if (!add_smi(info))
> + if (!add_smi(info)) {
> if (try_smi_init(info))
> cleanup_one_si(info);
> + } else {
> + kfree(info);
> + }
> } else {
> /* remove */
> struct smi_info *e, *tmp_e;
> @@ -1890,9 +1893,12 @@ static __devinit void hardcode_find_bmc(
> info->irq_setup = std_irq_setup;
> info->slave_addr = slave_addrs[i];
>
> - if (!add_smi(info))
> + if (!add_smi(info)) {
> if (try_smi_init(info))
> cleanup_one_si(info);
> + } else {
> + kfree(info);
> + }
> }
> }
>
> @@ -2088,7 +2094,8 @@ static __devinit int try_init_spmi(struc
> }
> info->io.addr_data = spmi->addr.address;
>
> - add_smi(info);
> + if (add_smi(info))
> + kfree(info);
>
> return 0;
> }
> @@ -2204,7 +2211,10 @@ static int __devinit ipmi_pnp_probe(stru
> res, info->io.regsize, info->io.regspacing,
> info->irq);
>
> - return add_smi(info);
> + if (add_smi(info))
> + goto err_free;
> +
> + return 0;
>
> err_free:
> kfree(info);
> @@ -2362,7 +2372,8 @@ static __devinit void try_init_dmi(struc
> if (info->irq)
> info->irq_setup = std_irq_setup;
>
> - add_smi(info);
> + if (add_smi(info))
> + kfree(info);
> }
>
> static void __devinit dmi_find_bmc(void)
> @@ -2468,7 +2479,10 @@ static int __devinit ipmi_pci_probe(stru
> &pdev->resource[0], info->io.regsize, info->io.regspacing,
> info->irq);
>
> - return add_smi(info);
> + if (add_smi(info))
> + kfree(info);
> +
> + return 0;
> }
>
> static void __devexit ipmi_pci_remove(struct pci_dev *pdev)
> @@ -2581,7 +2595,12 @@ static int __devinit ipmi_of_probe(struc
>
> dev_set_drvdata(&dev->dev, info);
>
> - return add_smi(info);
> + if (add_smi(info)) {
> + kfree(info);
> + return -EBUSY;
> + }
> +
> + return 0;
> }
>
> static int __devexit ipmi_of_remove(struct of_device *dev)
> @@ -3018,6 +3037,8 @@ static __devinit void default_find_bmc(v
> info->io.addr_data);
> } else
> cleanup_one_si(info);
> + } else {
> + kfree(info);
> }
> }
> }
>
--
Myron Stowe HP Open Source Linux Lab (OSLL)
next prev parent reply other threads:[~2010-07-27 15:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 1:25 [PATCH] ipmi: Fix memleaking for add_smi when duplicating happen Yinghai Lu
2010-07-27 2:05 ` Corey Minyard
2010-07-27 4:41 ` Yinghai Lu
2010-07-27 14:42 ` Corey Minyard
2010-07-27 4:57 ` [PATCH 1/2] " Yinghai Lu
2010-07-27 15:44 ` Myron Stowe [this message]
2010-07-27 4:58 ` [PATCH 2/2] ipmi: print info for spmi and smbios path like acpi and pci Yinghai Lu
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=1280245482.2419.1.camel@zim \
--to=myron.stowe@hp.com \
--cc=akpm@linux-foundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minyard@acm.org \
--cc=mjg@redhat.com \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=yinghai@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.