diff options
author | Philipp Zabel | 2014-08-05 19:00:17 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab | 2014-08-21 22:25:25 +0200 |
commit | 18fd0cceb99fdfd551bb6520703f8e1be4f3f364 (patch) | |
tree | cc82334f83e6fc73f2ba0c2b07cf1584955d3d0e /drivers/media/platform/coda/coda-common.c | |
parent | [media] coda: improve allocation error messages (diff) | |
download | kernel-qcow2-linux-18fd0cceb99fdfd551bb6520703f8e1be4f3f364.tar.gz kernel-qcow2-linux-18fd0cceb99fdfd551bb6520703f8e1be4f3f364.tar.xz kernel-qcow2-linux-18fd0cceb99fdfd551bb6520703f8e1be4f3f364.zip |
[media] coda: fix timestamp list handling
Lock modification of the timestamp list with bitstream_mutex and do not
try to remove a timestamp element if the list is empty. This can happen
if the userspace feeds us garbage or multiple encoded frames in a single
buffer.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/coda/coda-common.c')
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index 0f8a2c970405..e84b32088fc0 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -1116,12 +1116,14 @@ static void coda_stop_streaming(struct vb2_queue *q) if (!ctx->streamon_out && !ctx->streamon_cap) { struct coda_timestamp *ts; + mutex_lock(&ctx->bitstream_mutex); while (!list_empty(&ctx->timestamp_list)) { ts = list_first_entry(&ctx->timestamp_list, struct coda_timestamp, list); list_del(&ts->list); kfree(ts); } + mutex_unlock(&ctx->bitstream_mutex); kfifo_init(&ctx->bitstream_fifo, ctx->bitstream.vaddr, ctx->bitstream.size); ctx->runcounter = 0; |