From: Andreas Herz Date: Tue, 16 Apr 2024 15:22:20 +0000 (+0200) Subject: dataset: cleanup datasets that hit the memcap while loading X-Git-Tag: suricata-7.0.5~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59800113b8459406dcd1c758e87dda4a4623cda7;p=thirdparty%2Fsuricata.git dataset: cleanup datasets that hit the memcap while loading Datasets that hit the memcap limit need to be discarded if the memcap is hit or otherwise the datasets are still loaded with partial data while the signature is not loaded due to the memcap error. Ticket: #6678 (cherry picked from commit 1f9600e487173b785de186184d93633b246425fd) --- diff --git a/src/datasets.c b/src/datasets.c index d89ed8df59..01ef5bb47c 100644 --- a/src/datasets.c +++ b/src/datasets.c @@ -746,6 +746,11 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save, break; } + if (set->hash && SC_ATOMIC_GET(set->hash->memcap_reached)) { + SCLogError("dataset too large for set memcap"); + goto out_err; + } + SCLogDebug("set %p/%s type %u save %s load %s", set, set->name, set->type, set->save, set->load); diff --git a/src/detect-dataset.c b/src/detect-dataset.c index 3d2964605e..69eaf81113 100644 --- a/src/detect-dataset.c +++ b/src/detect-dataset.c @@ -407,10 +407,6 @@ int DetectDatasetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst SCLogError("failed to set up dataset '%s'.", name); return -1; } - if (set->hash && SC_ATOMIC_GET(set->hash->memcap_reached)) { - SCLogError("dataset too large for set memcap"); - return -1; - } cd = SCCalloc(1, sizeof(DetectDatasetData)); if (unlikely(cd == NULL))