media: usbtv: Lock resolution while streaming
When an program is streaming (ffplay) and another program (qv4l2)
changes the TV standard from NTSC to PAL, the kernel crashes due to trying
to copy to unmapped memory.
Changing from NTSC to PAL increases the resolution in the usbtv struct,
but the video plane buffer isn't adjusted, so it overflows.
Fixes: 0e0fe3958f ("[media] usbtv: Add support for PAL video source")
Cc: stable@vger.kernel.org
Signed-off-by: Ludwig Disterhof <ludwig@disterhof.eu>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: call vb2_is_busy instead of vb2_is_streaming]
This commit is contained in:
committed by
Hans Verkuil
parent
065eb4d262
commit
7e40e0bb77
@@ -73,6 +73,10 @@ static int usbtv_configure_for_norm(struct usbtv *usbtv, v4l2_std_id norm)
|
||||
}
|
||||
|
||||
if (params) {
|
||||
if (vb2_is_busy(&usbtv->vb2q) &&
|
||||
(usbtv->width != params->cap_width ||
|
||||
usbtv->height != params->cap_height))
|
||||
return -EBUSY;
|
||||
usbtv->width = params->cap_width;
|
||||
usbtv->height = params->cap_height;
|
||||
usbtv->n_chunks = usbtv->width * usbtv->height
|
||||
|
||||
Reference in New Issue
Block a user