Skip to content

Commit

Permalink
media: videobuf2: always set buffer vb2 pointer
Browse files Browse the repository at this point in the history
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@chromium.org>
Tested-by: Chen-Yu Tsai <wenst@chromium.org>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Sergey Senozhatsky authored and Mauro Carvalho Chehab committed Oct 19, 2021
1 parent cd0e5e8 commit 67f8513
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/common/videobuf2/videobuf2-dma-contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 67f8513

Please sign in to comment.