Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2434img; Wed, 27 Mar 2019 15:31:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSkxj7vFjprZTlEa8BMEdIG1TqslhbJ42XQDNdoxP5ZRwsudAgXuFGL5Nw/FhaPZ+0pSUU X-Received: by 2002:a63:c145:: with SMTP id p5mr8472344pgi.339.1553725879976; Wed, 27 Mar 2019 15:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553725879; cv=none; d=google.com; s=arc-20160816; b=J70KHXn9P+Av6TPCcGnmfV+ujdF9J4kc2BHkjdED4wpV5GWAz7iTLOCFdpn/oZuGm7 mLMmbz8i7PSUPdWHhggC0Ggb+Pa+Bgs6ByEJO/ls6fPdmpVWBvuIBgBLhBQ6eAgBWyX+ NyrPPaU8X80sOH6ORKpHwGZHp44K95UvmfAiMI3Ee4itkD5qAuZMDSQoQuBt3TUVwyaB RogRlP8UqOIP6zdabeZRC0mxLaWrlQSDwR8X+dUvrmkSieQj4OQc5fuf9iDiCyzL6OML UGWI8orH9kx60L5nyJR7ZHAjnkEwOrqz9csRPrCbbt4Bo84zP/kRodO11PLUfc9HDnEm QGUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nfUru6yfnj2CssPIO3MCblKR05aL4qEKuRygi+InMZw=; b=bmd+J+ZabTYDGRJvQA2o0tSIJsDUFGQb8rUm5zJ0p5BAWT629zOYZklfZ27ncU6eGG 8hWbamHI0eZGOc6ZSzEry6jo+iILY6uE68NPO7Ei5tuoA+zB79uQ0OcDfOi6RxerAR30 su79k+mOdlUB33sUA0Wz+pCMaxhumi45TJidEzoMrNLR7OITZmVTfmVsPngsZOzpsQAd ZH9HTYMrSqF47sKp9ubrHRPKT1Y32NtEXUpu18K1GDlDl6Cnvpp3VaSmLxsdmczk7dzR iQaZ0KlCGCgzVpg3iotMkeaObD8QHUJBtArYhfQMpiXVOjNCR4MmhZDWyfUfb9vPkAN6 HQJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@laposte.net header.s=mail0 header.b=RpGuiT2p; 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=fail (p=QUARANTINE sp=REJECT dis=NONE) header.from=laposte.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si20856738plb.407.2019.03.27.15.31.00; Wed, 27 Mar 2019 15:31:19 -0700 (PDT) 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=fail header.i=@laposte.net header.s=mail0 header.b=RpGuiT2p; 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=fail (p=QUARANTINE sp=REJECT dis=NONE) header.from=laposte.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729274AbfC0Wa0 (ORCPT + 99 others); Wed, 27 Mar 2019 18:30:26 -0400 Received: from smtpoutz25.laposte.net ([194.117.213.100]:39286 "EHLO smtp.laposte.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727979AbfC0Wa0 (ORCPT ); Wed, 27 Mar 2019 18:30:26 -0400 X-Greylist: delayed 1395 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Mar 2019 18:30:24 EDT Received: from smtp.laposte.net (localhost [127.0.0.1]) by lpn-prd-vrout013 (Postfix) with ESMTP id BA48610785A for ; Wed, 27 Mar 2019 23:07:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=laposte.net; s=mail0; t=1553724428; bh=e7EYZbrtuARyNuBC1ACysjAw4NPb4zVaHpbgrJbdSAU=; h=From:To:Cc:Subject:Date; b=RpGuiT2pTvaYfk8YQTYe+CK89D25sTp3dMWhnGMfebu7rqAOYvH0YmcJrXsmdu8lr Smv5+ORY5pZrWvwNiR4OFR5j0XsYftuvYoBnNgP15Idw/SoHmTi6qvtirHjaOT8FRs hhT9Iib5fi1msJyfi7PsWW4y8YcPYCNsbeq/2xQOuFvYXdT6addlUPwoh+Zz4LoRBq 83rvulnu7gMY024rorNbvXcM4FgMxniirjKmrNRfe6C9z0I9CtippxGZJisscd23Rm 7JpKSM3oR03oax4kubKP1xK/ZNDFyeDmaMKkxwnSQnSRaMW4lo+kxPOoflv0g/I94P Wss7QZBrmQ9vA== Received: from smtp.laposte.net (localhost [127.0.0.1]) by lpn-prd-vrout013 (Postfix) with ESMTP id 5A4F4107849 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-vrout013 (Postfix) with ESMTP id 5173810785C 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 390295E8737 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=20Stehl=C3=A9?= To: linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Vincent=20Stehl=C3=A9?= , Sudeep Holla , "Rafael J. Wysocki" , Viresh Kumar 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.20.1