From patchwork Tue Jan 24 21:11:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 92397 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1915917qgi; Tue, 24 Jan 2017 13:11:42 -0800 (PST) X-Received: by 10.99.131.65 with SMTP id h62mr42149101pge.41.1485292302677; Tue, 24 Jan 2017 13:11:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si20692216pfa.140.2017.01.24.13.11.40; Tue, 24 Jan 2017 13:11:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750952AbdAXVLj (ORCPT + 25 others); Tue, 24 Jan 2017 16:11:39 -0500 Received: from mail-it0-f54.google.com ([209.85.214.54]:36211 "EHLO mail-it0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbdAXVLi (ORCPT ); Tue, 24 Jan 2017 16:11:38 -0500 Received: by mail-it0-f54.google.com with SMTP id c7so95033233itd.1 for ; Tue, 24 Jan 2017 13:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=wZSZHQXSvM8a807x3/X3x0JDP0K3cVPpQ+vWgyPYlng=; b=h09ZdLpFsT3YxKyiQnOIO8EuId/BilDWEay165PtS/L34hZGEh+t8gTCkFOxFClTRI kRxZs4B6YEoxXpCSa3ph7wCXx2kLpmxlT8oMkZ3gbREMH+W7G/pbZQdGiW7htm7LAPmr 1rcLt9Bt2KNQwNVhhyZVO9Asn5jR35wPNJ9i0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wZSZHQXSvM8a807x3/X3x0JDP0K3cVPpQ+vWgyPYlng=; b=L/g9K2nutwU+l2+cZ3nYko2RF/xH0qJQ3dIzknPnVw+wnQ0WwLRp3/D5Ag9cgVdpvm nxqJiVQCLvHTZo6ZPceRu4G576++RwrGqYwS2aiWpcLwGNlkFjATTvoBc71ZJ5nj2xBp dKk/m9KzZ1ei65YN46+rFSTJDBnsePU6BOwa7Slsacygw2967+dSI6XWoyESZUcrIIWy IxU1/nuAwzddMjWUIUhghiAmdhOMH8wWeTEB4OrDLMuZ+4jwRkyAZ+pShJgCx45zUa4i C7iMzHoKConJ4amlEQoOuMlr6VCNPBddxwpctrVQlaNNTYrn9FyHoyx5C+TaXi+KhGna 4s3g== X-Gm-Message-State: AIkVDXISzGmTBgCvmabZzagQuwHqlxf1UME8zo1q5oOdhcsePI7TrR8zTHwcT8IE70qm2g4G X-Received: by 10.36.105.148 with SMTP id e142mr22117666itc.95.1485292297034; Tue, 24 Jan 2017 13:11:37 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k66sm289893itg.8.2017.01.24.13.11.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 13:11:36 -0800 (PST) From: Mathieu Poirier To: mingo@redhat.com, peterz@infradead.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/2] sched/core: Fix &rd->rto_mask memory leak Date: Tue, 24 Jan 2017 14:11:34 -0700 Message-Id: <1485292295-21298-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If function cpudl_init() fails the memory allocated for &rd->rto_mask needs to be freed, something this patch is addressing. Signed-off-by: Mathieu Poirier --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c56fb57f2991..5c01ac0f915a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5881,7 +5881,7 @@ static int init_rootdomain(struct root_domain *rd) init_dl_bw(&rd->dl_bw); if (cpudl_init(&rd->cpudl) != 0) - goto free_dlo_mask; + goto free_rto_mask; if (cpupri_init(&rd->cpupri) != 0) goto free_rto_mask; From patchwork Tue Jan 24 21:11:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 92398 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1916045qgi; Tue, 24 Jan 2017 13:11:59 -0800 (PST) X-Received: by 10.99.24.92 with SMTP id 28mr42970651pgy.100.1485292319113; Tue, 24 Jan 2017 13:11:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k76si20669491pfg.249.2017.01.24.13.11.58; Tue, 24 Jan 2017 13:11:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751041AbdAXVLv (ORCPT + 25 others); Tue, 24 Jan 2017 16:11:51 -0500 Received: from mail-io0-f172.google.com ([209.85.223.172]:35315 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbdAXVLj (ORCPT ); Tue, 24 Jan 2017 16:11:39 -0500 Received: by mail-io0-f172.google.com with SMTP id j18so145870443ioe.2 for ; Tue, 24 Jan 2017 13:11:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bSpxF9F5gZDnQAf019NdAxwSMLRzjVoAWgddiV+6dyw=; b=CRg5Mj0wcQNznxx3hhSJmMs1EwIhxggSuRBK2pjCsgm4A3AeQYam0y9xadWswEXwLH 4DdODQnVmuKck5EEgiHjMBfUvnQ0kb4QANLSAGP+T4wPJy+lf9I1rmg7oNAzVbHFngNo /7TtLm+dxiiyeeBtja2Izzf5GWnOD+jJqYFdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bSpxF9F5gZDnQAf019NdAxwSMLRzjVoAWgddiV+6dyw=; b=gr600aCupFaZKjLTEKGvpdts+hrq9g90ssVkAjZMyOO9jP6s/JJ+Wes52ycLDFHEoc Fs/wgSeGMSvO1aaEv/sXVq5xG+6cK9cK5OxnoZDvaO4r5EE9u08UcG1MXwvS2e6dylGz Ndogzc+BIgJrOONuQn9LU2D/s+6R4azeh+hKRCtcvEJPiC6p15yLd68L1CdeKGR2qSSL xt4ANG9rn77xcKSkWbvd8EuiAjQbFQ97Z7yR2ERPLuQ0a2I6gDiY8RdlbeKYQ3/vAuXC AKH/rBw3MnN8n0If/xxdUrW8LAWHFmxhIINP+8rVtNA9bv5+BpU/qVomKnmB6q365opO KZBA== X-Gm-Message-State: AIkVDXIb58sIuHJO1NpIdl7pMA3G2p+nu+qgC+VM3LPdYKFP4cslKWOLuq679zTBDfhmr3OC X-Received: by 10.107.135.147 with SMTP id r19mr30611579ioi.36.1485292298098; Tue, 24 Jan 2017 13:11:38 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k66sm289893itg.8.2017.01.24.13.11.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 13:11:37 -0800 (PST) From: Mathieu Poirier To: mingo@redhat.com, peterz@infradead.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] sched/core: Fix &rd->cpudl memory leak Date: Tue, 24 Jan 2017 14:11:35 -0700 Message-Id: <1485292295-21298-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485292295-21298-1-git-send-email-mathieu.poirier@linaro.org> References: <1485292295-21298-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While in the process of initialising a root domain, if function cpupri_init() fails the memory allocated in cpudl_init() is not reclaimed. Adding a new goto target to cleanup the previous initialistion of the root_domain's dl_bw structure reclaims said memory. Signed-off-by: Mathieu Poirier --- kernel/sched/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5c01ac0f915a..f06ce70757a7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5884,9 +5884,11 @@ static int init_rootdomain(struct root_domain *rd) goto free_rto_mask; if (cpupri_init(&rd->cpupri) != 0) - goto free_rto_mask; + goto free_cpudl; return 0; +free_cpudl: + cpudl_cleanup(&rd->cpudl); free_rto_mask: free_cpumask_var(rd->rto_mask); free_dlo_mask: