From patchwork Wed Mar 27 22:06:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Vincent_Stehl=C3=A9?= X-Patchwork-Id: 10873969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AAEC0139A for ; Wed, 27 Mar 2019 22:07:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9768D28B76 for ; Wed, 27 Mar 2019 22:07:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B89F28C1E; Wed, 27 Mar 2019 22:07:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B801B28B76 for ; Wed, 27 Mar 2019 22:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0a8lNwyZ7lqW5rFA3of4jyqsW+yakzj0iWy5YEL3QXE=; b=sr4EtOwmHZSdmm OGsTkUctiVXZHiRWn6ajGAi5jtTLuWR5dJb29EAH2pO1q4CIeZGqOzrTLB8a6/YwJB5MI4/loWzf1 Y2lALruQ9KH3S+QJ0s4OQSq5sXrcoj994DL6AFymHEMKwSJJ28FyXupsgmWveAqhjl69t68P3AQD2 72byxUgcLZ34HWWBVAW0xYfVvp4T4gqezilwtSmpcZJO/WlQ5ZsYxRl8juZ9Zr7BZoPoP4O/Sq5Re YVslALniN7ul6KBDptAPCt0iQQljcyOORy44ML7vM9EwDpjy75CPM9vmXqVRiIvmYmGbbMdw3UZVL LDCqDf8WS+Lp2KJmKgPQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9Gi3-0002w5-Ut; Wed, 27 Mar 2019 22:07:47 +0000 Received: from smtpoutz24.laposte.net ([194.117.213.99] helo=smtp.laposte.net) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9Ghy-0002oh-42 for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2019 22:07:45 +0000 Received: from smtp.laposte.net (localhost [127.0.0.1]) by lpn-prd-vrout012 (Postfix) with ESMTP id 65B6016406E for ; Wed, 27 Mar 2019 23:07:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=laposte.net; s=mail0; t=1553724427; bh=e7EYZbrtuARyNuBC1ACysjAw4NPb4zVaHpbgrJbdSAU=; h=From:To:Cc:Subject:Date; b=WLsmxkBfzY0qGNLXY1XFBQx/9Psy/aUKNR+3m3XBimPV9Vh1LYzRiInx7HVrQf8zB NS1CqyjeV9afCCwAL6Enq1a+vU5/UjwQVSjsHT+SALX/NtRpz+IBh7kfqaJuVt2La9 hQ/8tMSJDgd2mNvsVXlxtZP3HIR8fHvf/6NQAqLPLVlXdyDZr15iCLYaKQZY2K25am 21oq6gLmJyMGkk8ot7/5rklOYr4oNyxJYocFGUe7ZLETmeuKQ3PzBIGJYP7fiq0ZwA Sdl7IRdrCt/SfypkwKuguYPnuGfvpW4O7Y/ZC95ObOd30dEyGLMtIRmqVeW4felIOX ZMl0CeAXf3pVw== Received: from smtp.laposte.net (localhost [127.0.0.1]) by lpn-prd-vrout012 (Postfix) with ESMTP id 5724E1640A3 for ; Wed, 27 Mar 2019 23:07:07 +0100 (CET) Received: from lpn-prd-vrin002 (lpn-prd-vrin002.prosodie [10.128.63.3]) by lpn-prd-vrout012 (Postfix) with ESMTP id 51AEC16406E for ; Wed, 27 Mar 2019 23:07:07 +0100 (CET) Received: from lpn-prd-vrin002 (localhost [127.0.0.1]) by lpn-prd-vrin002 (Postfix) with ESMTP id 3901A5E872A for ; Wed, 27 Mar 2019 23:07:07 +0100 (CET) Received: from romuald.bergerie (rqp06-1-88-178-86-202.fbx.proxad.net [88.178.86.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lpn-prd-vrin002 (Postfix) with ESMTPSA id D4FE55E865F; Wed, 27 Mar 2019 23:07:06 +0100 (CET) Received: from radicelle.bergerie (radicelle.bergerie [192.168.124.12]) by romuald.bergerie (Postfix) with ESMTPS id 117672E0C7BC; Wed, 27 Mar 2019 23:07:06 +0100 (CET) Received: from vincent by radicelle.bergerie with local (Exim 4.92) (envelope-from ) id 1h9GhN-00027h-U4; Wed, 27 Mar 2019 23:07:05 +0100 From: =?utf-8?q?Vincent_Stehl=C3=A9?= To: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: scpi: fix use after free Date: Wed, 27 Mar 2019 23:06:42 +0100 Message-Id: <20190327220642.8117-1-vincent.stehle@laposte.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-VR-FullState: 0 X-VR-Score: -60 X-VR-Cause-1: gggruggvucftvghtrhhoucdtuddrgedutddrkeefgddtgecutefuodetggdotefrodftvfcurfhrohhf X-VR-Cause-2: ihhlvgemucfntefrqffuvffgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhs X-VR-Cause-3: ucdlqddutddtmdenogfuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvufffkffogggt X-VR-Cause-4: gfesthekredtredtjeenucfhrhhomhepgghinhgtvghnthcuufhtvghhlhoruceovhhinhgtvghnthdr X-VR-Cause-5: shhtvghhlhgvsehlrghpohhsthgvrdhnvghtqeenucfkphepkeekrddujeekrdekiedrvddtvdenucfr X-VR-Cause-6: rghrrghmpehmohguvgepshhmthhpohhuthdpihhnvghtpeekkedrudejkedrkeeirddvtddvpdhhvghl X-VR-Cause-7: oheprhhomhhurghlugdrsggvrhhgvghrihgvpdhmrghilhhfrhhomhepvhhinhgtvghnthdrshhtvghh X-VR-Cause-8: lhgvsehlrghpohhsthgvrdhnvghtpdhrtghpthhtohepshhuuggvvghprdhhohhllhgrsegrrhhmrdgt X-VR-Cause-9: ohhmpdhrtghpthhtohepvhhinhgtvghnthdrshhtvghhlhgvsehlrghpohhsthgvrdhnvghtpdhrtghp X-VR-Cause-10: thhtohepvhhirhgvshhhrdhkuhhmrghrsehlihhnrghrohdrohhrghdprhgtphhtthhopehlihhnuhig X-VR-Cause-11: qdgrrhhmqdhkvghrnhgvlheslhhishhtshdrihhnfhhrrgguvggrugdrohhrghdprhgtphhtthhopehr X-VR-Cause-12: jhifsehrjhifhihsohgtkhhirdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv X-VR-Cause-13: rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghl X-VR-Cause-14: rdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-VR-AvState: No X-VR-State: 0 X-VR-State: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190327_150742_596712_FC4FDD45 X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , Sudeep Holla , "Rafael J. Wysocki" , =?utf-8?q?Vincent_Stehl=C3=A9?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Free the priv structure only after we are done using it. Fixes: 1690d8bb91e370ab ("cpufreq: scpi/scmi: Fix freeing of dynamic OPPs") Signed-off-by: Vincent Stehlé Cc: Sudeep Holla Cc: "Rafael J. Wysocki" Cc: Viresh Kumar --- drivers/cpufreq/scpi-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index 3f49427766b88..2b51e0718c9f6 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -189,8 +189,8 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) clk_put(priv->clk); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); - kfree(priv); dev_pm_opp_remove_all_dynamic(priv->cpu_dev); + kfree(priv); return 0; }