diff options
author | Shang XiaoJing <shangxiaojing@huawei.com> | 2022-11-17 03:45:58 +0100 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2022-11-24 23:00:00 +0100 |
commit | 97f2b4ddb0aa700d673691a7d5e44d226d22bab7 (patch) | |
tree | 01daa223709ca8b32cc1b02c1662245bf289981d /block/blk-settings.c | |
parent | power: supply: z2_battery: Fix possible memleak in z2_batt_probe() (diff) | |
download | linux-97f2b4ddb0aa700d673691a7d5e44d226d22bab7.tar.xz linux-97f2b4ddb0aa700d673691a7d5e44d226d22bab7.zip |
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: b4c7715c10c1 ("power: supply: add CellWise cw2015 fuel gauge driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'block/blk-settings.c')
0 files changed, 0 insertions, 0 deletions