]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vircgroupv2: fix virCgroupV2DenyDevice
authorPavel Hrdina <phrdina@redhat.com>
Wed, 25 Nov 2020 16:21:49 +0000 (17:21 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 1 Dec 2020 11:46:55 +0000 (12:46 +0100)
commit0cbcd21b1f981dcca7879130a6653725db87d33a
treeb5d8a68b37cc68951026d8978f4c1be185943fd7
parented1ba69f5a8132f8c1e73d2a1f142d70de0b564a
vircgroupv2: fix virCgroupV2DenyDevice

The original logic is incorrect. We would delete the device entry
from eBPF map only if the newval would be same as current val in the
map. In case that the device was allowed only as read-only but later
we remove all permissions for that device it would remain in the table
with empty values.

The old code would still deny the device but it's not working as
intended. Instead we will update the value in advance. If the updated
value is 0 it means that we are removing all permissions so it should
be removed from the map, otherwise we will update the value in map.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1810356

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