diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-10-13 06:05:17 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-10-13 11:06:04 +0200 |
commit | f25e10b1c915dc4e88d38426dfedebfbbd8c0634 (patch) | |
tree | 71a3b9c5051168bcac2e324b8c673a034590dae7 /src/core/bpf-firewall.c | |
parent | Merge pull request #20987 from yuwata/sd-dhcp6-enum-cleanups (diff) | |
download | systemd-f25e10b1c915dc4e88d38426dfedebfbbd8c0634.tar.xz systemd-f25e10b1c915dc4e88d38426dfedebfbbd8c0634.zip |
core/bpf-firewall: add missing oom check
Fixes CID#1464627.
Diffstat (limited to 'src/core/bpf-firewall.c')
-rw-r--r-- | src/core/bpf-firewall.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/bpf-firewall.c b/src/core/bpf-firewall.c index 7067a0dfcc..2c202f1ea6 100644 --- a/src/core/bpf-firewall.c +++ b/src/core/bpf-firewall.c @@ -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); |