From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753170AbcHHTuc (ORCPT ); Mon, 8 Aug 2016 15:50:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35768 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbcHHTNs (ORCPT ); Mon, 8 Aug 2016 15:13:48 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Wenwei Tao Subject: [PATCH 4.4 34/68] cgroup: set css->id to -1 during init Date: Mon, 8 Aug 2016 21:11:09 +0200 Message-Id: <20160808180211.305435798@linuxfoundation.org> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160808180209.697765393@linuxfoundation.org> References: <20160808180209.697765393@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tejun Heo commit 8fa3b8d689a54d6d04ff7803c724fb7aca6ce98e upstream. If percpu_ref initialization fails during css_create(), the free path can end up trying to free css->id of zero. As ID 0 is unused, it doesn't cause a critical breakage but it does trigger a warning message. Fix it by setting css->id to -1 from init_and_link_css(). Signed-off-by: Tejun Heo Cc: Wenwei Tao Fixes: 01e586598b22 ("cgroup: release css->id after css_free") Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- kernel/cgroup.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4793,6 +4793,7 @@ static void init_and_link_css(struct cgr memset(css, 0, sizeof(*css)); css->cgroup = cgrp; css->ss = ss; + css->id = -1; INIT_LIST_HEAD(&css->sibling); INIT_LIST_HEAD(&css->children); css->serial_nr = css_serial_nr_next++;