[libvirt] [PATCH for 6.0.0] vircgroupv2devices: free BPF map when replacing with new one
Jiri Denemark
jdenemar at redhat.com
Mon Jan 13 13:52:04 UTC 2020
On Mon, Jan 13, 2020 at 14:20:26 +0100, Pavel Hrdina wrote:
> This leaks the FD of BPF map which means it will not be freed.
>
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
> src/util/vircgroupv2devices.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c
> index 402ce3f86f..445f9c53fc 100644
> --- a/src/util/vircgroupv2devices.c
> +++ b/src/util/vircgroupv2devices.c
> @@ -311,6 +311,11 @@ virCgroupV2DevicesAttachProg(virCgroupPtr group,
> VIR_FORCE_CLOSE(group->unified.devices.progfd);
> }
>
> + if (group->unified.devices.mapfd > 0) {
> + VIR_DEBUG("Closing existing map that was replaced by new one.");
> + VIR_FORCE_CLOSE(group->unified.devices.mapfd);
> + }
> +
> group->unified.devices.progfd = progfd;
> group->unified.devices.mapfd = mapfd;
> group->unified.devices.max = max;
Reviewed-by: Jiri Denemark <jdenemar at redhat.com>
More information about the libvir-list
mailing list