]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dataset: cleanup datasets that hit the memcap while loading 10905/head 10913/head
authorAndreas Herz <andreas@stamus-networks.com>
Tue, 16 Apr 2024 15:22:20 +0000 (17:22 +0200)
committerPhilippe Antoine <pantoine@oisf.net>
Thu, 18 Apr 2024 14:18:23 +0000 (16:18 +0200)
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)

src/datasets.c
src/detect-dataset.c

index d89ed8df59daa686dbdb8a1ae1e1a9b0b7c577ff..01ef5bb47c90a337139d97c593227f2ebfadf3cb 100644 (file)
@@ -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);
 
index 3d2964605e6e628f6e0b8a18296d5a04473ef65f..69eaf811133cfacf83ba3036dc1d5efe42c0dc6b 100644 (file)
@@ -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))