Re: [PATCH 3/4] media: mediatek: vcodec: free working buf on error path in vdec_vp9_slice_setup_lat()

From: Nicolas Dufresne

Date: Wed Jul 15 2026 - 17:46:31 EST


Hi,

Le mercredi 15 juillet 2026 à 17:35 -0400, Nicolas Dufresne a écrit :
> Le mercredi 06 mai 2026 à 16:42 +0800, Haoxiang Li a écrit :
> > Add an error path label in vdec_vp9_slice_setup_lat()
> > and call vdec_vp9_slice_free_working_buffer() to free
> > working buffer to prevent potential memory leak.
> >
> > Fixes: 5d418351ca8f ("media: mediatek: vcodec: support stateless VP9
> > decoding")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Haoxiang Li <lihaoxiang@xxxxxxxxxxxxxxxx>
>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>

After consideration, I will drop path 3 and 4. The working buffer is
implementing a re-alloc scheme. Even when the alloc fails, some buffer remains,
which you didn't cleanup. In the end, its not very useful to clean them up as
closing the driver FD will do that (calling IF deinit). I'll pick the two first,
as its fair cleanup.

Nicolas

>
> > ---
> >  .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c        | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
> > index 0f47b2671353..673b17d0dd8d 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
> > @@ -1172,10 +1172,12 @@ static int vdec_vp9_slice_setup_lat(struct
> > vdec_vp9_slice_instance *instance,
> >  
> >   ret = vdec_vp9_slice_setup_tile_buffer(instance, vsi, bs);
> >   if (ret)
> > - goto err;
> > + goto alloc_err;
> >  
> >   return 0;
> >  
> > +alloc_err:
> > + vdec_vp9_slice_free_working_buffer(instance);
> >  err:
> >   return ret;
> >  }

Attachment: signature.asc
Description: This is a digitally signed message part