[libvirt] [PATCH 5/6] lxc: Avoid possible NULL dereference on *root prior to opendir().

Daniel P. Berrange berrange at redhat.com
Mon Jan 7 18:28:48 UTC 2013


On Mon, Jan 07, 2013 at 12:09:33PM -0500, John Ferlan wrote:
> If running on older Linux without mounted cgroups then its possible that
> *root would be NULL.
> ---
>  src/lxc/lxc_container.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index d3a2968..d234426 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -1762,6 +1762,12 @@ static int lxcContainerIdentifyCGroups(struct lxcContainerCGroup **mountsret,
>          VIR_DEBUG("Grabbed '%s'", mntent.mnt_dir);
>      }
>  
> +    if (!*root) {
> +        VIR_DEBUG("No mounted cgroups found");
> +        ret = 0;
> +        goto cleanup;
> +    }
> +
>      VIR_DEBUG("Checking for symlinks in %s", *root);
>      if (!(dh = opendir(*root))) {
>          virReportSystemError(errno,

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list