author | apollo.ling <apollo.ling@amlogic.com> | 2019-10-17 08:00:16 (GMT) |
---|---|---|
committer | Apollo Ling <apollo.ling@amlogic.com> | 2019-10-29 02:06:42 (GMT) |
commit | 5108ba13c1f423fffe7ce7e407b09946215c99f6 (patch) | |
tree | e3f87aec36934b71f40cb5322acd00964b577799 | |
parent | bdf00f956395d7169988436b23122a6816694464 (diff) | |
download | media_modules-5108ba13c1f423fffe7ce7e407b09946215c99f6.zip media_modules-5108ba13c1f423fffe7ce7e407b09946215c99f6.tar.gz media_modules-5108ba13c1f423fffe7ce7e407b09946215c99f6.tar.bz2 |
vdec: avoid double release same resources [1/1]
PD#SWPL-10720
Problem:
Media AutoTest system met kernel crash and RAM DUMP
Solution:
check to avoid double release same resources
Verify:
P215
Change-Id: I58928ad333036aa4e146798f50764a9e201c4ecd
Signed-off-by: apollo.ling <apollo.ling@amlogic.com>
-rw-r--r-- | drivers/frame_provider/decoder/utils/vdec_input.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/frame_provider/decoder/utils/vdec_input.c b/drivers/frame_provider/decoder/utils/vdec_input.c index d819885..8550575 100644 --- a/drivers/frame_provider/decoder/utils/vdec_input.c +++ b/drivers/frame_provider/decoder/utils/vdec_input.c @@ -998,11 +998,26 @@ EXPORT_SYMBOL(vdec_input_next_input_chunk); void vdec_input_release_chunk(struct vdec_input_s *input, struct vframe_chunk_s *chunk) { + struct vframe_chunk_s *p; + u32 chunk_valid = 0; unsigned long flags; struct vframe_block_list_s *block = chunk->block; struct vframe_block_list_s *tofreeblock = NULL; flags = vdec_input_lock(input); + list_for_each_entry(p, &input->vframe_chunk_list, list) { + if (p == chunk) { + chunk_valid = 1; + break; + } + } + /* 2 threads go here, the other done the deletion,so return*/ + if (chunk_valid == 0) { + vdec_input_unlock(input, flags); + pr_err("%s chunk is deleted,so return.\n", __func__); + return; + } + list_del(&chunk->list); input->have_frame_num--; ATRACE_COUNTER(MEM_NAME, input->have_frame_num); |