Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 0e0fe3958fdd13d ("[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]

authored by

Ludwig Disterhof and committed by
Hans Verkuil
7e40e0bb 065eb4d2

+4
+4
drivers/media/usb/usbtv/usbtv-video.c
··· 73 73 } 74 74 75 75 if (params) { 76 + if (vb2_is_busy(&usbtv->vb2q) && 77 + (usbtv->width != params->cap_width || 78 + usbtv->height != params->cap_height)) 79 + return -EBUSY; 76 80 usbtv->width = params->cap_width; 77 81 usbtv->height = params->cap_height; 78 82 usbtv->n_chunks = usbtv->width * usbtv->height