On Tue, Jul 6, 2010 at 9:58 AM, Eric Brower <[email protected]> wrote:
> [This patch is of debatable value, given the prior patch to
> cgroup_create_cgroup_from_parent(), and that this is an internal
> function.]
>
> Check for cgroup without controllers to prevent segfault, as the
> current implementation
> depends upon a controller being configured.
>
> Signed-off-by: Eric Brower <[email protected]>
>
> diff --git a/src/api.c b/src/api.c
> index 908878e..f486ddd 100644
> --- a/src/api.c
> +++ b/src/api.c
> @@ -1502,6 +1502,12 @@ static int cgroup_find_parent(struct cgroup
> *cgroup, char **parent)
>
>        *parent = NULL;
>
> +       /* if cgroup has no controllers attached, consider it unconfigured */
> +       if (cgroup->controller[0] == NULL) {
> +               cgroup_dbg("cgroup_find_parent called on unconfigured 
> group\n");
> +               return ECGFAIL;
> +       }
> +
>        pthread_rwlock_rdlock(&cg_mount_table_lock);
>        controller = cgroup->controller[0]->name;
>        if (!cg_build_path_locked(cgroup->name, child_path, controller)) {
>

Looks good to me

Balbir

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to