lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTin8F8xb5QSOB-3JwEOJLbKFTUOcyg93-SHn4mar@mail.gmail.com>
Date:	Thu, 8 Jul 2010 09:24:41 -0600
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Kulikov Vasiliy <segooon@...il.com>
Cc:	Kernel Janitors <kernel-janitors@...r.kernel.org>,
	"David S. Miller" <davem@...emloft.net>,
	John Linn <john.linn@...inx.com>,
	Jiri Pirko <jpirko@...hat.com>,
	Brian Hill <brian.hill@...inx.com>, netdev@...r.kernel.org
Subject: Re: [PATCH 2/4] ll_temac: fix memory leak

On Thu, Jul 8, 2010 at 6:10 AM, Kulikov Vasiliy <segooon@...il.com> wrote:
> If of_iomap() or irq_of_parse_and_map() fail then np must be freed.
>
> Signed-off-by: Kulikov Vasiliy <segooon@...il.com>

Looks correct to me.

g.

> ---
>  drivers/net/ll_temac_main.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
> index 5bca20b..a2da3d7 100644
> --- a/drivers/net/ll_temac_main.c
> +++ b/drivers/net/ll_temac_main.c
> @@ -999,19 +999,22 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
>                        dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
>                } else {
>                        dev_err(&op->dev, "unable to map DMA registers\n");
> +                       of_node_put(np);
>                        goto err_iounmap;
>                }
>        }
>
>        lp->rx_irq = irq_of_parse_and_map(np, 0);
>        lp->tx_irq = irq_of_parse_and_map(np, 1);
> +
> +       of_node_put(np); /* Finished with the DMA node; drop the reference */
> +
>        if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) {
>                dev_err(&op->dev, "could not determine irqs\n");
>                rc = -ENOMEM;
>                goto err_iounmap_2;
>        }
>
> -       of_node_put(np); /* Finished with the DMA node; drop the reference */
>
>        /* Retrieve the MAC address */
>        addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
> --
> 1.7.0.4
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ