From patchwork Tue Jun 16 15:34:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 224418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17422C433E1 for ; Tue, 16 Jun 2020 16:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E27CB2071A for ; Tue, 16 Jun 2020 16:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592323295; bh=S6WExwVSGNJ/dpy97J+ZO2L8QMT/TxVuJmTZabPgTMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=B5jLBV05tMIBo3bX9XVWqJ3YLn7/e+TNc2PBZSxczDtbSFlW503/IjA1eoh9JjnGU Yze3gRw7eBS662YKytPxbDJUwRvjINKFm5upmJSWD6sO3M+xH/MJqdhqO6uJxYttwB P57LvHBJ7vbQLRF0WTohHT8PttfE6WNEPperV8s8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732735AbgFPPwB (ORCPT ); Tue, 16 Jun 2020 11:52:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:49032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732732AbgFPPwA (ORCPT ); Tue, 16 Jun 2020 11:52:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 982FD207C4; Tue, 16 Jun 2020 15:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322720; bh=S6WExwVSGNJ/dpy97J+ZO2L8QMT/TxVuJmTZabPgTMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xWYKwdoP3+MrF/aM+AC+ckHi0u5wG1vlPtA3iEwcQRlGH+ZRe+qvMGOXNdjWpQJxU I9NczlyfFd14UAlF0xRQVxoRsFkn4FXF5Ux2bXP6YIVy5nZQ5DT7tVlnvurmYykcla lRBi8xe+HE1zilKZbWhcRZERQnhvJydQh3W8+yQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiushi Wu , "Rafael J. Wysocki" Subject: [PATCH 5.6 078/161] ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe() Date: Tue, 16 Jun 2020 17:34:28 +0200 Message-Id: <20200616153110.096495471@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153106.402291280@linuxfoundation.org> References: <20200616153106.402291280@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Qiushi Wu commit 4d8be4bc94f74bb7d096e1c2e44457b530d5a170 upstream. kobject_init_and_add() takes reference even when it fails. If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Previous commit "b8eb718348b8" fixed a similar problem. Fixes: 158c998ea44b ("ACPI / CPPC: add sysfs support to compute delivered performance") Signed-off-by: Qiushi Wu Cc: 4.10+ # 4.10+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/cppc_acpi.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -865,6 +865,7 @@ int acpi_cppc_processor_probe(struct acp "acpi_cppc"); if (ret) { per_cpu(cpc_desc_ptr, pr->id) = NULL; + kobject_put(&cpc_ptr->kobj); goto out_free; }