From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH 1/5] cgroup: fix a subtle bug in descendant pre-order walk Date: Fri, 24 May 2013 10:51:29 +0900 Message-ID: <20130524015129.GA19755@mtj.dyndns.org> References: <1369101025-28335-1-git-send-email-tj@kernel.org> <1369101025-28335-2-git-send-email-tj@kernel.org> 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=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=k+tOLgiUziMAu5ql1LZCwJpwhStR5tk06PnRrdJZfHo=; b=AZfXIZ6Sbf91cPSpCSSnh271hLulYcocNnym7RzFfcUnghq+hMdvUVxULlooCmmj8u 7s6zIkpzDWbTP6kVFJ8tX46KymPWpUY8nYtatFOKik6hqImrUoHkkFtY2yX509otq/Gl K2gAYpo6Gry37b2XAvn6xDTEVkU9xlYCHJ7j6/nQFDJkur6jppSqLArGcc9uOoGvVEfh brL8d7tGbFrl2vloOtfWLzb9x7WYGWVHxOe+ZflaZP/4LpuW5yb/d2kY0AAPDhQX+pHY 7PgYyNPeZ4uyyBK8LDqWxOO/Iy0Ju2vha/hMENgnJQpObR4K2TfTKRnsiUvDg/blm4vf CcWQ== Content-Disposition: inline In-Reply-To: <1369101025-28335-2-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@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: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org Cc: serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, mhocko-AlSwsSmVLrQ@public.gmane.org, hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Tue, May 21, 2013 at 10:50:21AM +0900, Tejun Heo wrote: > When cgroup_next_descendant_pre() initiates a walk, it checks whether > the subtree root doesn't have any children and if not returns NULL. > Later code assumes that the subtree isn't empty. This is broken > because the subtree may become empty inbetween, which can lead to the > traversal escaping the subtree by walking to the sibling of the > subtree root. > > There's no reason to have the early exit path. Remove it along with > the later assumption that the subtree isn't empty. This simplifies > the code a bit and fixes the subtle bug. > > While at it, fix the comment of cgroup_for_each_descendant_pre() which > was incorrectly referring to ->css_offline() instead of > ->css_online(). > > Signed-off-by: Tejun Heo > Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Applied to cgroup/for-3.10-fixes. Thanks. -- tejun