]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vircgroupv2devices: Avoid double close on map FD
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 6 Jan 2020 14:06:20 +0000 (15:06 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 6 Jan 2020 16:30:17 +0000 (17:30 +0100)
commit529100d9f724e164a5c73608986aaedfea0be4de
tree341f7cff47c5836250a5d0ad10e6125c2186175e
parentff878fe77cd79148f860d1c559ddab122e8d3113
vircgroupv2devices: Avoid double close on map FD

When allowing/denying a device in devices CGroupV2 we have to
write a BPF program for it. The program we put there is merely
static and all it does it looks up a device in a hash table (also
known as map in BPF terminology). A map is referenced via an FD
which can be acquired via virBPFCreateMap() and like any other FD
it should be closed when no longer needed. However, we close it
twice: the first time in virCgroupV2DevicesAttachProg() which
closes it unconditionally, and the second time in either
virCgroupV2DevicesCreateProg() or
virCgroupV2DevicesPrepareProg(). Remove the second close.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/util/vircgroupv2devices.c