Re: [PATCH] media: videobuf2: always set buffer vb2 pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 28, 2021 at 12:46 PM Sergey Senozhatsky
<senozhatsky@xxxxxxxxxxxx> wrote:
>
> We need to always link allocated vb2_dc_buf back to vb2_buffer because
> we dereference vb2 in prepare() and finish() callbacks.
>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> ---
>  drivers/media/common/videobuf2/videobuf2-dma-contig.c | 3 +++
>  1 file changed, 3 insertions(+)
>

Acked-by: Tomasz Figa <tfiga@xxxxxxxxxxxx>

Best regards,
Tomasz

> diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
> index b052a4e36961..38767791955d 100644
> --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
> +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
> @@ -600,6 +600,7 @@ static void *vb2_dc_get_userptr(struct vb2_buffer *vb, struct device *dev,
>
>         buf->dev = dev;
>         buf->dma_dir = vb->vb2_queue->dma_dir;
> +       buf->vb = vb;
>
>         offset = lower_32_bits(offset_in_page(vaddr));
>         vec = vb2_create_framevec(vaddr, size);
> @@ -788,6 +789,8 @@ static void *vb2_dc_attach_dmabuf(struct vb2_buffer *vb, struct device *dev,
>                 return ERR_PTR(-ENOMEM);
>
>         buf->dev = dev;
> +       buf->vb = vb;
> +
>         /* create attachment for the dmabuf with the user device */
>         dba = dma_buf_attach(dbuf, buf->dev);
>         if (IS_ERR(dba)) {
> --
> 2.33.0.685.g46640cef36-goog
>



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux