Skip to contentSkip to conversation

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

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 9, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

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.

The Linux kernel CVE team has assigned CVE-2022-50634 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.8 with commit b4c7715c10c106a041b0b3fabd26151c214ea394 and fixed in 6.0.16 with commit f7e2ba8ed08138102f21f3fe6414498c93177fd8
	Issue introduced in 5.8 with commit b4c7715c10c106a041b0b3fabd26151c214ea394 and fixed in 6.1.2 with commit 5150b76aa2eb8bb8feb7f7a048417f9d39c3dd04
	Issue introduced in 5.8 with commit b4c7715c10c106a041b0b3fabd26151c214ea394 and fixed in 6.2 with commit 97f2b4ddb0aa700d673691a7d5e44d226d22bab7

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2022-50634

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/power/supply/cw2015_battery.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/f7e2ba8ed08138102f21f3fe6414498c93177fd8
	https://git.kernel.org/stable/c/5150b76aa2eb8bb8feb7f7a048417f9d39c3dd04
	https://git.kernel.org/stable/c/97f2b4ddb0aa700d673691a7d5e44d226d22bab7