core/bpf-firewall: add missing oom check

Fixes CID#1464627.
This commit is contained in:
Yu Watanabe
2021-10-13 13:05:17 +09:00
parent df618f259a
commit f25e10b1c9

View 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);