提交 b2b476f5 编写于 作者: P Pawel Osciak 提交者: Mauro Carvalho Chehab

V4L/DVB: v4l: videobuf: prevent passing a NULL to dma_free_coherent()

When a driver that uses videobuf-dma-contig is used with the USERPTR
memory access method a kernel oops might happen: a NULL address may be
passed to dma_free_coherent(). This happens when an application calls
REQBUFS and then exits without queuing any buffers. This patch fixes
that bug.
Signed-off-by: NPawel Osciak <p.osciak@samsung.com>
Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 a08c7c68
......@@ -393,8 +393,10 @@ void videobuf_dma_contig_free(struct videobuf_queue *q,
}
/* read() method */
dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle);
mem->vaddr = NULL;
if (mem->vaddr) {
dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle);
mem->vaddr = NULL;
}
}
EXPORT_SYMBOL_GPL(videobuf_dma_contig_free);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册