[media] au0828: fix case where STREAMOFF being called on stopped stream causes BUG()
authorDevin Heitmueller <dheitmueller@kernellabs.com>
Tue, 7 Aug 2012 01:47:03 +0000 (22:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 9 Aug 2012 23:38:35 +0000 (20:38 -0300)
We weren't checking whether the resource was in use before calling
res_free(), so applications which called STREAMOFF on a v4l2 device that
wasn't already streaming would cause a BUG() to be hit (MythTV).

Reported-by: Larry Finger <larry.finger@lwfinger.net>
Reported-by: Jay Harbeston <jharbestonus@gmail.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/au0828/au0828-video.c

index df9232281d64a4eed52ea490befa926864d7e213..4d5b670973add0ab6d33e35e88cc5b997547c338 100644 (file)
@@ -1702,14 +1702,18 @@ static int vidioc_streamoff(struct file *file, void *priv,
                        (AUVI_INPUT(i).audio_setup)(dev, 0);
                }
 
-               videobuf_streamoff(&fh->vb_vidq);
-               res_free(fh, AU0828_RESOURCE_VIDEO);
+               if (res_check(fh, AU0828_RESOURCE_VIDEO)) {
+                       videobuf_streamoff(&fh->vb_vidq);
+                       res_free(fh, AU0828_RESOURCE_VIDEO);
+               }
        } else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
                dev->vbi_timeout_running = 0;
                del_timer_sync(&dev->vbi_timeout);
 
-               videobuf_streamoff(&fh->vb_vbiq);
-               res_free(fh, AU0828_RESOURCE_VBI);
+               if (res_check(fh, AU0828_RESOURCE_VBI)) {
+                       videobuf_streamoff(&fh->vb_vbiq);
+                       res_free(fh, AU0828_RESOURCE_VBI);
+               }
        }
 
        return 0;
This page took 0.031576 seconds and 5 git commands to generate.