lkml.org 
[lkml]   [2019]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] power: charger-manager: fix a potential NULL pointer dereference
Hi,

On Thu, Mar 14, 2019 at 01:02:47AM -0500, Kangjie Lu wrote:
> In case create_freezable_workqueue fails, the fix return -ENOMEM
> to avoid a potential NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---

Thanks, queued.

-- Sebastian

> drivers/power/supply/charger-manager.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
> index 38be91f21cc4..d29c4f338157 100644
> --- a/drivers/power/supply/charger-manager.c
> +++ b/drivers/power/supply/charger-manager.c
> @@ -1987,6 +1987,9 @@ static struct platform_driver charger_manager_driver = {
> static int __init charger_manager_init(void)
> {
> cm_wq = create_freezable_workqueue("charger_manager");
> + if (unlikely(!cm_wq))
> + return -ENOMEM;
> +
> INIT_DELAYED_WORK(&cm_monitor_work, cm_monitor_poller);
>
> return platform_driver_register(&charger_manager_driver);
> --
> 2.17.1
>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-04-05 16:00    [W:0.042 / U:0.156 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site