[media] cx18: Fix list BUG for IDX stream, triggerable in cx18_probe() error clean up,
authorAndy Walls <awalls@md.metrocast.net>
Sun, 27 Mar 2011 23:19:15 +0000 (20:19 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 13 Apr 2011 12:41:02 +0000 (09:41 -0300)
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>
drivers/media/video/cx18/cx18-streams.c

index c6e2ca3b1149ad37305a04dc40befac5b0ef8996..6fbc356113c18077352876da72ef0a93dbc3abdc 100644 (file)
@@ -350,9 +350,17 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister)
 
                /* No struct video_device, but can have buffers allocated */
                if (type == CX18_ENC_STREAM_TYPE_IDX) {
+                       /* If the module params didn't inhibit IDX ... */
                        if (cx->stream_buffers[type] != 0) {
                                cx->stream_buffers[type] = 0;
-                               cx18_stream_free(&cx->streams[type]);
+                               /*
+                                * Before calling cx18_stream_free(),
+                                * check if the IDX stream was actually set up.
+                                * Needed, since the cx18_probe() error path
+                                * exits through here as well as normal clean up
+                                */
+                               if (cx->streams[type].buffers != 0)
+                                       cx18_stream_free(&cx->streams[type]);
                        }
                        continue;
                }
This page took 0.025593 seconds and 5 git commands to generate.