diff mbox series

cpufreq: Fixed kernel crash caused by cpufreq issues

Message ID 20240411231818.2471-1-sensor1010@163.com
State New
Headers show
Series cpufreq: Fixed kernel crash caused by cpufreq issues | expand

Commit Message

李哲 April 11, 2024, 11:18 p.m. UTC
When the cpufreq_driver does not provide an exit() function.
cpufreq offline operations can result in a kernel crash.

Signed-off-by: Lizhe <sensor1010@163.com>
---
 drivers/cpufreq/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Viresh Kumar April 12, 2024, 6:33 a.m. UTC | #1
On 11-04-24, 16:18, Lizhe wrote:
> When the cpufreq_driver does not provide an exit() function.
> cpufreq offline operations can result in a kernel crash.
> 
> Signed-off-by: Lizhe <sensor1010@163.com>
> ---
>  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);

Hmm, saw this just now.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Rafael J. Wysocki April 12, 2024, 11:26 a.m. UTC | #2
On Fri, Apr 12, 2024 at 1:19 AM Lizhe <sensor1010@163.com> wrote:
>
> When the cpufreq_driver does not provide an exit() function.
> cpufreq offline operations can result in a kernel crash.
>
> Signed-off-by: Lizhe <sensor1010@163.com>
> ---
>  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);
> --

I've applied the patch from Viresh that addresses both issues with
missing ->exit() driver callback checks and therefore is more
complete.

Also I'm not going to apply any other patches you have sent because
there were obvious mistakes in some of them and you sent updates
without version numbering and without any information regarding what
changed with respect to the previous version(s).  Also some patches
were sent in multiple copies (I think) without telling me which one to
look at.  All of that is too confusing to be treated seriously and
quite disrespectful to the prospective reviewers (who might allocate
their time to more productive things).

If you want to send the changes once again, it is fine because they
generally do some nice cleanups, but please follow the patch
submission and kernel development process documentation as Greg has
already advised you.

Thanks!
diff mbox series

Patch

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);