public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Fix some errors in the devfreq core layer when governor is NULL
@ 2026-04-01  3:28 Yaxiong Tian
  2026-04-01  3:30 ` [PATCH v2 1/4] PM / devfreq: Fix possible null pointer issue in devfreq_add_governor() Yaxiong Tian
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Yaxiong Tian @ 2026-04-01  3:28 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, cw00.choi, zhanjie9, nm
  Cc: linux-pm, linux-kernel, Yaxiong Tian

While doing some development work with devfreq_add_governor()/
devfreq_remove_governor(), I discovered several bugs caused when
devfreq->governor is NULL. Specifically:

1) A possible null pointer issue in devfreq_add_governor(), caused
by devfreq_remove_governor() setting devfreq->governor to NULL in
certain situations, while devfreq_add_governor() lacks corresponding
checks for devfreq->governor.

2) When operating on governor and available_governors under /sys,
there are also some unexpected errors.

For issue 1, the solution is similar to Jie Zhan's PATCH.
https://lore.kernel.org/linux-pm/20260326123428.800407-6-zhanjie9@hisilicon.com/

The original v1 approach actually changed the original logic, which is incorrect.

See the following patches for details.

change in v2:
1) rebase to  linux-next(20260326) /devfreq-next 
2) remove some code to fix null pointer in patch1
3) add  sysfs_update_group() in patch2


Yaxiong Tian (4):
  PM / devfreq: Fix possible null pointer issue in
    devfreq_add_governor()
  PM / devfreq: Fix available_governors_show() when no governor is set
  PM / devfreq: Fix governor_store() failing when device has no current
    governor
  PM / devfreq: Optimize error return value of governor_show()

 drivers/devfreq/devfreq.c | 57 +++++++++++----------------------------
 1 file changed, 16 insertions(+), 41 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-04-30  3:29 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  3:28 [PATCH v2 0/4] Fix some errors in the devfreq core layer when governor is NULL Yaxiong Tian
2026-04-01  3:30 ` [PATCH v2 1/4] PM / devfreq: Fix possible null pointer issue in devfreq_add_governor() Yaxiong Tian
2026-04-02  3:06   ` Jie Zhan
2026-04-29 21:49   ` Choi Chanwoo
2026-04-01  3:30 ` [PATCH v2 2/4] PM / devfreq: Fix available_governors_show() when no governor is set Yaxiong Tian
2026-04-02  3:10   ` Jie Zhan
2026-04-29 21:49   ` Choi Chanwoo
2026-04-01  3:31 ` [PATCH v2 3/4] PM / devfreq: Fix governor_store() failing when device has no current governor Yaxiong Tian
2026-04-02  3:21   ` Jie Zhan
2026-04-02  5:47     ` Yaxiong Tian
2026-04-02  6:52       ` Jie Zhan
2026-04-29 22:28   ` Choi Chanwoo
2026-04-30  3:29     ` Yaxiong Tian
2026-04-30  3:20   ` [PATCH v3 " Yaxiong Tian
2026-04-01  3:31 ` [PATCH v2 4/4] PM / devfreq: Optimize error return value of governor_show() Yaxiong Tian
2026-04-02  3:38   ` Jie Zhan
2026-04-29 21:50   ` Choi Chanwoo
2026-04-28  2:50 ` [PATCH v2 0/4] Fix some errors in the devfreq core layer when governor is NULL Jie Zhan
2026-04-28  2:59   ` Yaxiong Tian
2026-04-29  2:04     ` Jie Zhan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox