diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-02-01 16:06:47 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-03-20 00:09:55 +0300 |
commit | 2f8c0810af739ec3587d00bf36cc5a6a0139be1a (patch) | |
tree | ea1b972a2c4fefc913fe6e5233efb5ef10739ae5 /drivers/media/common | |
parent | 55f1ecb1199000932cf82e357841cc7498ac904f (diff) | |
download | linux-2f8c0810af739ec3587d00bf36cc5a6a0139be1a.tar.xz |
media: vb2: set owner before calling vb2_read
Before vb2_read is called, the owner must be set since vb2_read will
actually start streaming. If vb2_read returns an error and q->fileio is
NULL, then it failed to start streaming and the owner is set back to NULL.
When the vb2 start_streaming callback is called, it expects the owner
pointer to be set, and that wasn't the case in this particular situation.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/videobuf2/videobuf2-v4l2.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 1f5d235a8441..c7a54d82a55e 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -1171,10 +1171,11 @@ ssize_t vb2_fop_read(struct file *file, char __user *buf, return -ERESTARTSYS; if (vb2_queue_is_busy(vdev->queue, file)) goto exit; + vdev->queue->owner = file->private_data; err = vb2_read(vdev->queue, buf, count, ppos, file->f_flags & O_NONBLOCK); - if (vdev->queue->fileio) - vdev->queue->owner = file->private_data; + if (!vdev->queue->fileio) + vdev->queue->owner = NULL; exit: if (lock) mutex_unlock(lock); |