aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Walls <awalls@md.metrocast.net>2011-03-27 19:19:15 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-04-13 08:41:02 -0400
commit0f890ab1b51a5e59f078f046229825076d1e3c77 (patch)
tree8a53eee601349f8ad5c9aed837ac752a25e9936b
parent974ceab8fd76d795cb6d77b7573a383d2e733ee6 (diff)
[media] cx18: Fix list BUG for IDX stream, triggerable in cx18_probe() error clean up,
If allocating stream buffers for one of the primary streams (e.g. YUV) failed during card probe, the error path clean up would try to manipulate the yet unitialized IDX stream structures. This caused a BUG due to unitialized list heads. Detect that case and ignore the uninitialized IDX stream. Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/cx18/cx18-streams.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index c6e2ca3b1149..6fbc356113c1 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -350,9 +350,17 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister)
350 350
351 /* No struct video_device, but can have buffers allocated */ 351 /* No struct video_device, but can have buffers allocated */
352 if (type == CX18_ENC_STREAM_TYPE_IDX) { 352 if (type == CX18_ENC_STREAM_TYPE_IDX) {
353 /* If the module params didn't inhibit IDX ... */
353 if (cx->stream_buffers[type] != 0) { 354 if (cx->stream_buffers[type] != 0) {
354 cx->stream_buffers[type] = 0; 355 cx->stream_buffers[type] = 0;
355 cx18_stream_free(&cx->streams[type]); 356 /*
357 * Before calling cx18_stream_free(),
358 * check if the IDX stream was actually set up.
359 * Needed, since the cx18_probe() error path
360 * exits through here as well as normal clean up
361 */
362 if (cx->streams[type].buffers != 0)
363 cx18_stream_free(&cx->streams[type]);
356 } 364 }
357 continue; 365 continue;
358 } 366 }