From patchwork Thu Apr 11 23:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5ZOy?= X-Patchwork-Id: 788188 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 844584AED1; Thu, 11 Apr 2024 23:19:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712877560; cv=none; b=NTOaNRr5R6WYaIiWauFv9EMDINRk2Hrte6BsAe4NA3d6G59LjTHaWE78eBsZ9SDN58/rXMS/5lFJrIA/fCZgxr0jTzIgrPKeNRKvtv6UEZ/ydompn7/7eojsnVHOn4NNX9sYeCbmcCy1Zi5/As1PsLVDjFKmmvaQdCuN6f7/V+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712877560; c=relaxed/simple; bh=aNmoCty2E2taxbJGZXgC0zkBJXRsGV5eZ6MA4fcTBgM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=p9nZgl3cDmnOJEfT0RjjCheF9oPAS1WjqAvn2UbITGa1jlJg/KNddZS0Uy1MEI9Om8cnoPRHF27OHYjbT0dhyw5GfuxwNKMXHL4GKg0TXJC5QymbSlxRORqIskVDkbqrqTNjKjLnCKzJvbsqkqYyWc2Tv0N0NoODY4z9ivqjYWA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=amFCXyaU; arc=none smtp.client-ip=117.135.210.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="amFCXyaU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=c5Pzo m9ggE+lnrPwITXXUuzreNabMc9C3d5zN36J6+c=; b=amFCXyaUffXBkkMLeLToV JsIFN/Qm4MymU9dGml6IAyca4lHTkUtHFbzhsGjv1wSWHmjoQbGkRdQhdfN2L2J9 uHNOntu12Fg3/vXXR8spzqbXE2tNbH4Xkjfi0r3/B+sF+/pkRxre47zBbsiEWH75 AM+fIY9fJOOryPQUIJv234= Received: from localhost.localdomain (unknown [101.86.127.38]) by gzga-smtp-mta-g3-3 (Coremail) with SMTP id _____wD3H47CbxhmuzOoAA--.32437S4; Fri, 12 Apr 2024 07:18:51 +0800 (CST) From: Lizhe To: rafael@kernel.org, viresh.kumar@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lizhe Subject: [PATCH] cpufreq: Fixed kernel crash caused by cpufreq issues Date: Thu, 11 Apr 2024 16:18:18 -0700 Message-Id: <20240411231818.2471-1-sensor1010@163.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: _____wD3H47CbxhmuzOoAA--.32437S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF1UAr1xWw1fKr4rJrW3trb_yoW3Crg_ur 1rWr1xXr4Duw10vF17Cr4Svr1Yy3W3WrnavF18t39xJa4UAr9Yyw18Xrn3Xa4rX3yxGFZr XrWUtF1UCr1kGjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRXyCLJUUUUU== X-CM-SenderInfo: 5vhq20jurqiii6rwjhhfrp/1tbiSBy9q2XAk244cQAAsT When the cpufreq_driver does not provide an exit() function. cpufreq offline operations can result in a kernel crash. Signed-off-by: Lizhe Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 04d349372de3..e8660bc7d232 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1739,7 +1739,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) } /* We did light-weight exit earlier, do full tear down now */ - if (cpufreq_driver->offline) + if (cpufreq_driver->offline && cpufreq_driver->exit) cpufreq_driver->exit(policy); up_write(&policy->rwsem);