From: Tejun Heo Subject: Re: [PATCH 4/4] cgroup: implement task_cgroup_path_from_hierarchy() Date: Sun, 14 Apr 2013 20:46:13 -0700 Message-ID: <20130415034613.GK3050@htj.dyndns.org> References: <1365964619-14762-1-git-send-email-tj@kernel.org> <1365964619-14762-5-git-send-email-tj@kernel.org> <516B7753.9060503@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=dOvaMfJhy6AH8a7Fo83et3m5DsVi85qoyxY4q6NSXy0=; b=QoIyTVh1K/aJZaYtq1GNYquL9/NgZOLdzFy7AhRNwIqyLtYfCmHQsKmBoY5YjStu6U Js6m25X+uyfIRHDFNup1i0mxA9/JuVnINtNQs5g78UWi020n8AsfqbDRQ5eg4IqQX2LE ofO64eIf83OhLDyAgVGDs4tX/JcI1j1LM4gk65SyKZ9ICdJ/u1bepcoSgPbFVWTinCQm xtfVW16uKyMaqmeLskFwtm2m+Jkwv4u24goHyK0ZTlRu0ruePMUhmZFyzSY/PY9vkVcT vceUd4zRndLnD1rvD58bOKKnRSHDVbhOw9oF0zi3i5zXJwM+TbNERcwMzyDKpU4036xp bkWQ== Content-Disposition: inline In-Reply-To: <516B7753.9060503-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Li Zefan Cc: greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, kay-tD+1rO4QERM@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, lennart-mdGvqq1h2p+GdvJs77BJ7Q@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org On Mon, Apr 15, 2013 at 11:43:15AM +0800, Li Zefan wrote: > > +int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id, > > + char *buf, size_t buflen) > > +{ > > + struct cgroupfs_root *root; > > + struct cgroup *cgrp = NULL; > > + int ret = -ENOENT; > > + > > + mutex_lock(&cgroup_mutex); > > + > > + root = idr_find(&cgroup_hierarchy_idr, hierarchy_id); > > + if (root) { > > + cgrp = task_cgroup_from_root(task, root); > > task_cgroup_from_root() will never return NULL, and there's a BUG_ON(!res) in it. @hierarchy_id may come from userland, so we probably should update task_cgroup_from_root() to return NULL if the id is invalid. Will add a patch. Thanks. -- tejun