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: <CAJuUDwtUUv_nMEwijRydWmseL1aYOAoAfEdLVnoHWPWKdVgS-A@mail.gmail.com>
Date:   Tue, 10 Apr 2018 11:54:36 +0200
From:   Xue Liu <liuxuenetmail@...il.com>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc:     Alexander Aring <alex.aring@...il.com>,
        Stefan Schmidt <stefan@....samsung.com>,
        linux-wpan - ML <linux-wpan@...r.kernel.org>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ieee802154: mcr20a: Fix memory leak in mcr20a_probe

Hallo,

Thanks for the fix. It looks good.

ACK-by: Xue Liu <liuxuenetmail@...il.com>

On 5 April 2018 at 18:20, Gustavo A. R. Silva <gustavo@...eddedor.com> wrote:
> Free allocated memory for pdata before return.
>
> Addresses-Coverity-ID: 1466096 ("Resource leak")
> Fixes: 8c6ad9cc5157 ("ieee802154: Add NXP MCR20A IEEE 802.15.4 transceiver driver")
> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
> ---
>  drivers/net/ieee802154/mcr20a.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
> index 55a22c7..944470d 100644
> --- a/drivers/net/ieee802154/mcr20a.c
> +++ b/drivers/net/ieee802154/mcr20a.c
> @@ -1267,7 +1267,7 @@ mcr20a_probe(struct spi_device *spi)
>         ret = mcr20a_get_platform_data(spi, pdata);
>         if (ret < 0) {
>                 dev_crit(&spi->dev, "mcr20a_get_platform_data failed.\n");
> -               return ret;
> +               goto free_pdata;
>         }
>
>         /* init reset gpio */
> @@ -1275,7 +1275,7 @@ mcr20a_probe(struct spi_device *spi)
>                 ret = devm_gpio_request_one(&spi->dev, pdata->rst_gpio,
>                                             GPIOF_OUT_INIT_HIGH, "reset");
>                 if (ret)
> -                       return ret;
> +                       goto free_pdata;
>         }
>
>         /* reset mcr20a */
> @@ -1291,7 +1291,8 @@ mcr20a_probe(struct spi_device *spi)
>         hw = ieee802154_alloc_hw(sizeof(*lp), &mcr20a_hw_ops);
>         if (!hw) {
>                 dev_crit(&spi->dev, "ieee802154_alloc_hw failed\n");
> -               return -ENOMEM;
> +               ret = -ENOMEM;
> +               goto free_pdata;
>         }
>
>         /* init mcr20a local data */
> @@ -1366,6 +1367,8 @@ mcr20a_probe(struct spi_device *spi)
>
>  free_dev:
>         ieee802154_free_hw(lp->hw);
> +free_pdata:
> +       kfree(pdata);
>
>         return ret;
>  }
> --
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ