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: <9a10b435045556f5625afe83bd41bc4d4f9be80b.camel@kernel.org>
Date: Tue, 28 Jan 2025 10:39:58 +0100
From: Amit Shah <amit@...nel.org>
To: oushixiong1025@....com
Cc: Arnd Bergmann <arnd@...db.de>, Greg Kroah-Hartman
	 <gregkh@...uxfoundation.org>, virtualization@...ts.linux.dev, 
	linux-kernel@...r.kernel.org, Shixiong Ou <oushixiong@...inos.cn>
Subject: Re: [PATCH] virtio_console: Convert to use devm funcs

On Tue, 2025-01-28 at 13:52 +0800, oushixiong1025@....com wrote:
> From: Shixiong Ou <oushixiong@...inos.cn>
> 
> Convert to devm_* funcs so that no need to manual free in error path.
> 
> Signed-off-by: Shixiong Ou <oushixiong@...inos.cn>
> ---
>  drivers/char/virtio_console.c | 43 ++++++++++++++-------------------
> --
>  1 file changed, 17 insertions(+), 26 deletions(-)

[...]

> -		goto free;
> +		return err;

[...]

> -
> -free:
> -	kfree(portdev->out_vqs);
> -	kfree(portdev->in_vqs);
> -	kfree(vqs_info);
> -	kfree(vqs);
> -
> -	return err;
>  }

Hm, I'm not entirely sure about this - the devm_ interface is better,
but to me that just says that it's an extra safety net that avoids
memleaks when we forget to kfree, and not that we deliberately do not
free and get lax about managing allocated memory.

So I'd prefer a patch that keeps all current frees as they are, but
with the added advantage of using the devm interfaces.

		Amit

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ