diff options
author | Devin Heitmueller <dheitmueller@kernellabs.com> | 2012-08-06 21:47:03 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-09 19:38:35 -0400 |
commit | a595c1ce4c9d572cf53513570b9f1a263d7867f2 (patch) | |
tree | 5d5250050642d88849bdcdc10422212875ce3335 | |
parent | 4a03dafc7b0a347854bc0a8652ffa314150fd1e5 (diff) |
[media] au0828: fix case where STREAMOFF being called on stopped stream causes BUG()
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>
-rw-r--r-- | drivers/media/video/au0828/au0828-video.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index df9232281d64..4d5b670973ad 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c | |||
@@ -1702,14 +1702,18 @@ static int vidioc_streamoff(struct file *file, void *priv, | |||
1702 | (AUVI_INPUT(i).audio_setup)(dev, 0); | 1702 | (AUVI_INPUT(i).audio_setup)(dev, 0); |
1703 | } | 1703 | } |
1704 | 1704 | ||
1705 | videobuf_streamoff(&fh->vb_vidq); | 1705 | if (res_check(fh, AU0828_RESOURCE_VIDEO)) { |
1706 | res_free(fh, AU0828_RESOURCE_VIDEO); | 1706 | videobuf_streamoff(&fh->vb_vidq); |
1707 | res_free(fh, AU0828_RESOURCE_VIDEO); | ||
1708 | } | ||
1707 | } else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 1709 | } else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
1708 | dev->vbi_timeout_running = 0; | 1710 | dev->vbi_timeout_running = 0; |
1709 | del_timer_sync(&dev->vbi_timeout); | 1711 | del_timer_sync(&dev->vbi_timeout); |
1710 | 1712 | ||
1711 | videobuf_streamoff(&fh->vb_vbiq); | 1713 | if (res_check(fh, AU0828_RESOURCE_VBI)) { |
1712 | res_free(fh, AU0828_RESOURCE_VBI); | 1714 | videobuf_streamoff(&fh->vb_vbiq); |
1715 | res_free(fh, AU0828_RESOURCE_VBI); | ||
1716 | } | ||
1713 | } | 1717 | } |
1714 | 1718 | ||
1715 | return 0; | 1719 | return 0; |