Skip to content
Commit 97f2b4dd authored by Shang XiaoJing's avatar Shang XiaoJing Committed by Sebastian Reichel
Browse files

power: supply: cw2015: Fix potential null-ptr-deref in cw_bat_probe()



cw_bat_probe() calls create_singlethread_workqueue() and not checked the
ret value, which may return NULL. And a null-ptr-deref may happen:

cw_bat_probe()
    create_singlethread_workqueue() # failed, cw_bat->wq is NULL
    queue_delayed_work()
        queue_delayed_work_on()
            __queue_delayed_work()  # warning here, but continue
                __queue_work()      # access wq->flags, null-ptr-deref

Check the ret value and return -ENOMEM if it is NULL.

Fixes: b4c7715c ("power: supply: add CellWise cw2015 fuel gauge driver")
Signed-off-by: default avatarShang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 955bee20
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment