From: Anoop Saldanha Date: Wed, 26 Jun 2013 11:44:51 +0000 (+0530) Subject: Coverity 1038523: Fix using cuda buffer slice that has been returned to the pool. X-Git-Tag: suricata-2.0beta1~84 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fb4aae9939af80065d0284b91608daf040f1963;p=thirdparty%2Fsuricata.git Coverity 1038523: Fix using cuda buffer slice that has been returned to the pool. --- diff --git a/src/util-cuda-buffer.c b/src/util-cuda-buffer.c index a5401f6a68..acbeaed072 100644 --- a/src/util-cuda-buffer.c +++ b/src/util-cuda-buffer.c @@ -191,12 +191,17 @@ void CudaBufferCullCompletedSlices(CudaBufferData *cb_data, cb_data->slice_tail = NULL; } max_culled_slice->next = NULL; - SCMutexUnlock(&cb_data->m); } else { SCMutexUnlock(&cb_data->m); return; } + culled_info->d_buffer_start_offset = slice_head->start_offset; + culled_info->d_buffer_len = (max_culled_slice->end_offset - + slice_head->start_offset + 1); + culled_info->op_buffer_start_offset = cb_data->op_buffer_read; + SCMutexUnlock(&cb_data->m); + /* push out the used slices to the the slice_pool */ SCMutexLock(&slice_pool_mutex); slice_temp = slice_head; @@ -212,13 +217,6 @@ void CudaBufferCullCompletedSlices(CudaBufferData *cb_data, culled_info->no_of_items++; SCMutexUnlock(&slice_pool_mutex); - SCMutexLock(&cb_data->m); - culled_info->d_buffer_start_offset = slice_head->start_offset; - culled_info->d_buffer_len = (max_culled_slice->end_offset - - slice_head->start_offset + 1); - culled_info->op_buffer_start_offset = cb_data->op_buffer_read; - SCMutexUnlock(&cb_data->m); - return; }