summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSurajit Podder <spodder@codeaurora.org>2017-01-05 14:12:37 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-21 22:28:14 -0800
commiteaacf31ddf2b1e27cbaf68a6d04bc57b35476ce5 (patch)
tree0b7f7a8139997e6c7348399170b082301d554a9d
parentb184cdd6100fbfc21b492ab8a47e21751e61db27 (diff)
msm_vidc: Clear pendingq when releasing buffers
Clear pendingq when releasing buffers to ensure that invalid buffers are not accessed when new buffers are queued. Change-Id: I7ce2babe8bcc25b2582e92f04fc4233a6cfc8ef1 Signed-off-by: Surajit Podder <spodder@codeaurora.org>
-rw-r--r--drivers/media/platform/msm/vidc/msm_vidc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c
index babea6824c51..1b62859c2399 100644
--- a/drivers/media/platform/msm/vidc/msm_vidc.c
+++ b/drivers/media/platform/msm/vidc/msm_vidc.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -720,6 +720,7 @@ int msm_vidc_release_buffers(void *instance, int buffer_type)
struct buffer_info *bi, *dummy;
struct v4l2_buffer buffer_info;
struct v4l2_plane plane[VIDEO_MAX_PLANES];
+ struct vb2_buf_entry *temp, *next;
int i, rc = 0;
if (!inst)
@@ -807,6 +808,15 @@ free_and_unmap:
}
}
mutex_unlock(&inst->registeredbufs.lock);
+
+ mutex_lock(&inst->pendingq.lock);
+ list_for_each_entry_safe(temp, next, &inst->pendingq.list, list) {
+ if (temp->vb->type == buffer_type) {
+ list_del(&temp->list);
+ kfree(temp);
+ }
+ }
+ mutex_unlock(&inst->pendingq.lock);
return rc;
}
EXPORT_SYMBOL(msm_vidc_release_buffers);