From b37efa24b519a2ca3b27e32258ca24470ab48075 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 27 Jun 2011 14:41:00 +0200 Subject: vpu module: fix queue corruption We must call videobuf_stop in vpu_release, otherwise there might be buffers left which are not dequeued on vpu close. These buffers are freed but still in the list and thus get reused next time. Signed-off-by: Sascha Hauer --- module/imx-vpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module/imx-vpu.c b/module/imx-vpu.c index 0cb78d6..5557c1b 100644 --- a/module/imx-vpu.c +++ b/module/imx-vpu.c @@ -249,6 +249,7 @@ struct vpu_instance { int format; struct videobuf_queue vidq; int in_use; + int videobuf_init; dma_addr_t bitstream_buf_phys; void __iomem *bitstream_buf; @@ -1245,6 +1246,11 @@ static int vpu_release(struct file *file) struct vpu_regs *regs = vpu->regs; int i; + if (instance->videobuf_init) { + videobuf_stop(&instance->vidq); + instance->videobuf_init = 0; + } + dma_free_coherent(NULL, regs->para_buf_size, instance->para_buf, instance->para_buf_phys); dma_free_coherent(NULL, SLICE_SAVE_SIZE, instance->slice_mem_buf, @@ -1580,6 +1586,8 @@ static int vpu_reqbufs(struct file *file, void *priv, instance, NULL); + instance->videobuf_init = 1; + /* Allocate buffers */ ret = videobuf_reqbufs(&instance->vidq, reqbuf); -- cgit v1.2.3