]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/bpf-firewall: add missing oom check
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Oct 2021 04:05:17 +0000 (13:05 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Oct 2021 09:06:04 +0000 (18:06 +0900)
Fixes CID#1464627.

src/core/bpf-firewall.c

index 7067a0dfcca2b2a77850c7140ccbe690b2fff0b7..2c202f1ea60431cbaad2472fa384450751fddfd4 100644 (file)
@@ -657,7 +657,9 @@ static int attach_custom_bpf_progs(Unit *u, const char *path, int attach_type, S
         assert(u);
 
         set_clear(*set_installed);
-        set_ensure_allocated(set_installed, &bpf_program_hash_ops);
+        r = set_ensure_allocated(set_installed, &bpf_program_hash_ops);
+        if (r < 0)
+                return log_oom();
 
         SET_FOREACH_MOVE(prog, *set_installed, *set) {
                 r = bpf_program_cgroup_attach(prog, attach_type, path, BPF_F_ALLOW_MULTI);