Subject: CVE-2024-38637: greybus: lights: check return of get_channel_from_mode

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

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

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

greybus: lights: check return of get_channel_from_mode

If channel for the given node is not found we return null from
get_channel_from_mode. Make sure we validate the return pointer
before using it in two of the missing places.

This was originally reported in [0]:
Found by Linux Verification Center (linuxtesting.org) with SVACE.

[0] https://lore.kernel.org/all/[email-masked]

The Linux kernel CVE team has assigned CVE-2024-38637 to this issue.

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

	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 4.19.316 with commit 8f4a76d477f0
	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 5.4.278 with commit e2c64246e5dc
	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 5.10.219 with commit eac10cf3a97f
	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 5.15.161 with commit 330f6bcdcef0
	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 6.1.93 with commit 9b41a9b9c8be
	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 6.6.33 with commit 518e2c46b5db
	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 6.9.4 with commit 895cdd9aa954
	Issue introduced in 4.9 with commit 2870b52bae4c and fixed in 6.10 with commit a1ba19a1ae7c

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-2024-38637
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/staging/greybus/light.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/8f4a76d477f0cc3c54d512f07f6f88c8e1c1e07b
	https://git.kernel.org/stable/c/e2c64246e5dc8c0d35ec41770b85e2b4cafdff21
	https://git.kernel.org/stable/c/eac10cf3a97ffd4b4deb0a29f57c118225a42850
	https://git.kernel.org/stable/c/330f6bcdcef03f70f81db5f2ed6747af656a09f2
	https://git.kernel.org/stable/c/9b41a9b9c8be8c552f10633453fdb509e83b66f8
	https://git.kernel.org/stable/c/518e2c46b5dbce40b1aa0100001d03c3ceaa7d38
	https://git.kernel.org/stable/c/895cdd9aa9546523df839f9cc1488a0ecc1e0731
	https://git.kernel.org/stable/c/a1ba19a1ae7cd1e324685ded4ab563e78fe68648