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] [day] [month] [year] [list]
Message-ID: <c152e9a7-55ce-424c-8468-a4e861792582@amlogic.com>
Date:   Mon, 4 Mar 2019 10:29:54 +0800
From:   Liang Yang <liang.yang@...ogic.com>
To:     Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
        <linux-amlogic@...ts.infradead.org>,
        <linux-mtd@...ts.infradead.org>
CC:     <bbrezillon@...nel.org>, <miquel.raynal@...tlin.com>,
        <richard@....at>, <jianxin.pan@...ogic.com>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] mtd: rawnand: meson: fix a potential memory leak in
 meson_nfc_read_buf

Hello Martin,

Thank you very much.

On 2019/3/2 1:38, Martin Blumenstingl wrote:
> meson_nfc_dma_buffer_setup() is called with the "info" buffer which is
> allocated a few lines before using kzalloc(). If
> meson_nfc_dma_buffer_setup() fails we need to free the allocated "info"
> buffer instead of only freeing it upon success.
> 
> Fixes: 8fae856c53500a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
> ---
>   drivers/mtd/nand/raw/meson_nand.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index a1d8506b61c7..38db4fd61459 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -534,7 +534,7 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len)
>   	ret = meson_nfc_dma_buffer_setup(nand, buf, len, info,
>   					 PER_INFO_BYTE, DMA_FROM_DEVICE);
>   	if (ret)
> -		return ret;
> +		goto out;
>   Looks good to me.
Acked-by: Liang Yang <liang.yang@...ogic.com>

>   	cmd = NFC_CMD_N2M | (len & GENMASK(5, 0));
>   	writel(cmd, nfc->reg_base + NFC_REG_CMD);
> @@ -542,6 +542,8 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len)
>   	meson_nfc_drain_cmd(nfc);
>   	meson_nfc_wait_cmd_finish(nfc, 1000);
>   	meson_nfc_dma_buffer_release(nand, len, PER_INFO_BYTE, DMA_FROM_DEVICE);
> +
> +out:
Looks good to me.
Acked-by: Liang Yang <liang.yang@...ogic.com>
>   	kfree(info);
>   
>   	return ret;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ