From: Shilpa Nagpal (shinagpa) Date: Thu, 31 Jul 2025 12:14:35 +0000 (+0000) Subject: Pull request #4835: file_api: multi-process snort file cache crash fix X-Git-Tag: 3.9.3.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0cdfacf608cccb1791bc5210bd08fb757f44064;p=thirdparty%2Fsnort3.git Pull request #4835: file_api: multi-process snort file cache crash fix Merge in SNORT/snort3 from ~SHINAGPA/snort3:mp_file_fix to master Squashed commit of the following: commit b72873ff0d9785dad40e2fd293aab1c697b10c06 Author: Shilpa Nagpal Date: Mon Jul 28 16:17:08 2025 +0530 file_api: multi-process snort file cache crash fix --- diff --git a/src/file_api/file_cache.cc b/src/file_api/file_cache.cc index 90589e3df..0ba4e7b49 100644 --- a/src/file_api/file_cache.cc +++ b/src/file_api/file_cache.cc @@ -276,6 +276,11 @@ FileContext* FileCache::get_file(Flow* flow, uint64_t file_id, bool to_create, if (to_create and !file) file = add(hashKey, timeout, cache_full, cache_expire); + if (file and !file->get_config()) + { + FileConfig *fc = get_file_config(SnortConfig::get_conf()); + file->set_config(fc); + } return file; } diff --git a/src/file_api/file_flows.cc b/src/file_api/file_flows.cc index 62b90d07f..de855e5bb 100644 --- a/src/file_api/file_flows.cc +++ b/src/file_api/file_flows.cc @@ -276,13 +276,6 @@ FileContext* FileFlows::get_file_context( FileCache* file_cache = FileService::get_file_cache(); assert(file_cache); context = file_cache->get_file(flow, file_id, false, true); - if (context) - { - FileConfig *fc = get_file_config(SnortConfig::get_conf()); - - if (!context->get_config()) - context->set_config(fc); - } FILE_DEBUG(file_trace, DEFAULT_TRACE_OPTION_ID, TRACE_DEBUG_LEVEL, GET_CURRENT_PACKET, "get_file_context:trying to get context from cache\n"); }