PM / devfreq: Unlock mutex and free devfreq struct in error path
Subsystems (2)
PATCH v2 1/1 PM / devfreq: Unlock mutex and free devfreq struct in error path
The devfreq->lock is held for time of setup. Release the lock in the error path, before jumping to the end of the function.
Change the goto destination which frees the allocated memory.
---
v2:
- added fixes tag and CC stable v5.9+
- used capital letter in commit header
drivers/devfreq/devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/devfreq/devfreq.c +2 -1
@@ -822,7 +822,8 @@ struct devfreq *devfreq_add_device(struct device *dev,if (devfreq->profile->timer <0 || devfreq->profile->timer >=DEVFREQ_TIMER_NUM ) { - goto err_out; +mutex_unlock (&devfreq->lock); + goto err_dev; }if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
Signature · 1 line
2.17.1
Quoted 23 lines · Lukasz Luba
The
devfreq->lockis held for time of setup. Release the lock in the error path, before jumping to the end of the function.Change the goto destination which frees the allocated memory.
Cc v5.9+ <[email protected]> # v5.9+Fixes 4dc3bab8687f ("PM / devfreq: Add support delayed timer for polling mode")Signed-off-by Lukasz Luba <[email protected]>---
v2:
- added fixes tag and CC stable v5.9+
- used capital letter in commit headerdrivers/devfreq/devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/devfreq/devfreq.c +0
-0
drivers/devfreq/devfreq.c struct devfreq *devfreq_add_device(struct device *dev, · line 829
Quoted 9 lines
drivers/devfreq/devfreq.c +2
-1@@ -822,7 +822,8 @@ struct devfreq *devfreq_add_device(struct device *dev,if (devfreq->profile->timer <0 || devfreq->profile->timer >=DEVFREQ_TIMER_NUM ) { - goto err_out; +mutex_unlock (&devfreq->lock); + goto err_dev; }if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
Applied it. Thanks.
Signature · 3 lines
Best Regards, Chanwoo Choi Samsung Electronics
Quoted 31 lines · Chanwoo Choi
Quoted 30 lines · Lukasz Luba
The
devfreq->lockis held for time of setup. Release the lock in the error path, before jumping to the end of the function.Change the goto destination which frees the allocated memory.
Cc v5.9+ <[email protected]> # v5.9+Fixes 4dc3bab8687f ("PM / devfreq: Add support delayed timer for polling mode")Signed-off-by Lukasz Luba <[email protected]>---
v2:
- added fixes tag and CC stable v5.9+
- used capital letter in commit headerdrivers/devfreq/devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/devfreq/devfreq.c +2
-1@@ -822,7 +822,8 @@ struct devfreq *devfreq_add_device(struct device *dev,if (devfreq->profile->timer <0 || devfreq->profile->timer >=DEVFREQ_TIMER_NUM ) { - goto err_out; +mutex_unlock (&devfreq->lock); + goto err_dev; }
Quoted 6 lines
drivers/devfreq/devfreq.c struct devfreq *devfreq_add_device(struct device *dev, · line 829
Quoted 2 lines
drivers/devfreq/devfreq.c +0
-0if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {Applied it. Thanks.
Thank you Chanwoo!
Regards,
Lukasz