From 6359f576ab17011ef7aac634dec8245b40a553de Mon Sep 17 00:00:00 2001 From: Srinu Gorle Date: Wed, 7 Nov 2012 01:19:06 +0530 Subject: [PATCH] msm: vidc: Avoid memset of list elements in the buffer entry. - Due to race condition between free buffer and flush output buffers, invalid buffer is getting accessed sometimes. - Reset all the members in buffer entry except list elements. (cherry picked from commit 8105df366cf6b9f1ddbc15d561fb6a5f12540416) CRs-Fixed: 411197 Change-Id: Id95037f57d7fe4bc88b96f187953194ec838d63b Signed-off-by: Srinu Gorle Signed-off-by: Neha Pandey --- drivers/video/msm/vidc/common/vcd/vcd_sub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/video/msm/vidc/common/vcd/vcd_sub.c b/drivers/video/msm/vidc/common/vcd/vcd_sub.c index e8a35c8b9dc8..a337d7bfae48 100644 --- a/drivers/video/msm/vidc/common/vcd/vcd_sub.c +++ b/drivers/video/msm/vidc/common/vcd/vcd_sub.c @@ -784,7 +784,11 @@ u32 vcd_free_one_buffer_internal( buf_pool->allocated--; } - memset(buf_entry, 0, sizeof(struct vcd_buffer_entry)); + buf_entry->valid = buf_entry->allocated = buf_entry->in_use = 0; + buf_entry->alloc = buf_entry->virtual = buf_entry->physical = NULL; + buf_entry->sz = 0; + memset(&buf_entry->frame, 0, sizeof(struct vcd_frame_data)); + buf_pool->validated--; if (buf_pool->validated == 0) vcd_free_buffer_pool_entries(buf_pool);