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>] [day] [month] [year] [list]
Date:   Mon, 13 Dec 2021 10:26:41 +0800
From:   "xkernel.wang@...mail.com" <xkernel.wang@...mail.com>
To:     mpe <mpe@...erman.id.au>, agust <agust@...x.de>
Cc:     benh <benh@...nel.crashing.org>, paulus <paulus@...ba.org>,
        linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] powerpc: mpc52xx_gpt: fix a potential memory leak

Michael Ellerman <mpe@...erman.id.au> wrote:
> > When some internal memory errors happend in of_iomap(), we should free
> > gpt to prevent memory leak.
>
> But it's allocated with devm_kzalloc(), so the devres core is meant to
> free it for us isn't it?

Yes, maybe you are right. I did that as I mentioned when gpt-regs is NULL, it 
will return -ENOMEM, which is the same when gpt is NULL. So I suppose to 
free it in time is better:
>	gpt = devm_kzalloc(&ofdev->dev, sizeof *gpt, GFP_KERNEL);
>	if (!gpt)
>		return -ENOMEM;

cheers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ