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: <d901822b2710a2d642f1372fbfb53f99f1e60b2e.camel@collabora.com>
Date: Mon, 28 Apr 2025 13:25:59 -0400
From: Nicolas Dufresne <nicolas.dufresne@...labora.com>
To: Detlev Casanova <detlev.casanova@...labora.com>, 
	linux-kernel@...r.kernel.org
Cc: Benjamin Gaignard <benjamin.gaignard@...labora.com>, Philipp Zabel
	 <p.zabel@...gutronix.de>, Mauro Carvalho Chehab <mchehab@...nel.org>, 
	linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org, 
	kernel@...labora.com
Subject: Re: [PATCH] media: verisilicon: Free post processor buffers on error

Le vendredi 25 avril 2025 à 15:24 -0400, Detlev Casanova a écrit :
> When initializing the post processor, it allocates the same number of

What do you think reworking as:

  During initialization, the post processor allocates the same number of

> buffers as the buf queue.
> As the init function is called in streamon(), if an allocation fails,
> streamon will return an error and streamoff() will not be called, keeping
> all post processor buffers allocated.
> 
> To avoid that, all post proc buffers are freed in case of an allocation
> error.
> 
> Fixes: 26711491a807 ("media: verisilicon: Refactor postprocessor to store more buffers")
> Signed-off-by: Detlev Casanova <detlev.casanova@...labora.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@...labora.com>

If you are fine with the suggestion, I can make the changes while
applying.

> ---
>  drivers/media/platform/verisilicon/hantro_postproc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_postproc.c b/drivers/media/platform/verisilicon/hantro_postproc.c
> index c435a393e0cb7..9f559a13d409b 100644
> --- a/drivers/media/platform/verisilicon/hantro_postproc.c
> +++ b/drivers/media/platform/verisilicon/hantro_postproc.c
> @@ -250,8 +250,10 @@ int hantro_postproc_init(struct hantro_ctx *ctx)
>  
>  	for (i = 0; i < num_buffers; i++) {
>  		ret = hantro_postproc_alloc(ctx, i);
> -		if (ret)
> +		if (ret) {
> +			hantro_postproc_free(ctx);
>  			return ret;
> +		}
>  	}
>  
>  	return 0;

-- 
Nicolas Dufresne
Principal Engineer at Collabora

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ