Re: [PATCH 1/4] security: Grab a reference to virSecurityManager for transactions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 21, 2018 at 11:29 AM +0200, Michal Privoznik <mprivozn@xxxxxxxxxx> wrote:
> This shouldn't be needed per-se. Security manager shouldn't
> disappear during transactions - it's immutable. However, it
> doesn't hurt to grab a reference either - transaction code uses
> it after all.
>
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---

[…snip…]

> diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
> index 056637e4cb..31e42afee7 100644
> --- a/src/security/security_selinux.c
> +++ b/src/security/security_selinux.c
> @@ -156,6 +156,7 @@ virSecuritySELinuxContextListFree(void *opaque)
>      for (i = 0; i < list->nItems; i++)
>          virSecuritySELinuxContextItemFree(list->items[i]);
>

BTW, isn’t here VIR_FREE(list->items); missing? (see your commit
ca250269b0af24b319989807ee50f2a87b421922).

> +    virObjectUnref(list->manager);
>      VIR_FREE(list);
>  }
>
> @@ -1054,12 +1055,12 @@ virSecuritySELinuxTransactionStart(virSecurityManagerPtr mgr)
>      if (VIR_ALLOC(list) < 0)
>          return -1;
>
> -    list->manager = mgr;
> +    list->manager = virObjectRef(mgr);
>
>      if (virThreadLocalSet(&contextList, list) < 0) {
>          virReportSystemError(errno, "%s",
>                               _("Unable to set thread local variable"));
> -        VIR_FREE(list);
> +        virSecuritySELinuxContextListFree(list);
>          return -1;
>      }
>
> --
> 2.16.4
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Reviewed-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>

--
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux