Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755805AbdC1Mp3 (ORCPT ); Tue, 28 Mar 2017 08:45:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34010 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755768AbdC1MpY (ORCPT ); Tue, 28 Mar 2017 08:45:24 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Shishkin Subject: [PATCH 4.9 79/88] intel_th: Dont leak module refcount on failure to activate Date: Tue, 28 Mar 2017 14:31:34 +0200 Message-Id: <20170328122751.905367091@linuxfoundation.org> X-Mailer: git-send-email 2.12.1 In-Reply-To: <20170328122748.656530096@linuxfoundation.org> References: <20170328122748.656530096@linuxfoundation.org> User-Agent: quilt/0.65 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 Content-Length: 1109 Lines: 39 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Shishkin commit e609ccef5222c73b46b322be7d3796d60bff353d upstream. Output 'activation' may fail for the reasons of the output driver, for example, if msc's buffer is not allocated. We forget, however, to drop the module reference in this case. So each attempt at activation in this case leaks a reference, preventing the module from ever unloading. This patch adds the missing module_put() in the activation error path. Signed-off-by: Alexander Shishkin Signed-off-by: Greg Kroah-Hartman --- drivers/hwtracing/intel_th/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -218,8 +218,10 @@ static int intel_th_output_activate(stru else intel_th_trace_enable(thdev); - if (ret) + if (ret) { pm_runtime_put(&thdev->dev); + module_put(thdrv->driver.owner); + } return ret; }