Skip to contentSkip to conversation

CVE-2024-50156: drm/msm: Avoid NULL dereference in msm_disp_state_print_regs()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Nov 7, 2024

lore
Share & tools
lore
#0 lore raw

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

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

drm/msm: Avoid NULL dereference in msm_disp_state_print_regs()

If the allocation in msm_disp_state_dump_regs() failed then block->state can be NULL. The msm_disp_state_print_regs() function _does_ have code to try to handle it with:

  if (*reg)
    dump_addr = *reg;

...but since "dump_addr" is initialized to NULL the above is actually a noop. The code then goes on to dereference dump_addr.

Make the function print "Registers not stored" when it sees a NULL to solve this. Since we're touching the code, fix msm_disp_state_print_regs() not to pointlessly take a double-pointer and properly mark the pointer as const.

Patchwork: https://patchwork.freedesktop.org/patch/619657/

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

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

	Issue introduced in 5.14 with commit 98659487b845 and fixed in 5.15.170 with commit 42cf045086fe
	Issue introduced in 5.14 with commit 98659487b845 and fixed in 6.1.115 with commit e8e9f2a12a62
	Issue introduced in 5.14 with commit 98659487b845 and fixed in 6.6.59 with commit f7ad91627348
	Issue introduced in 5.14 with commit 98659487b845 and fixed in 6.11.6 with commit 563aa81fd66a
	Issue introduced in 5.14 with commit 98659487b845 and fixed in 6.12-rc4 with commit 293f53263266

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-50156

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/gpu/drm/msm/disp/msm_disp_snapshot_util.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/42cf045086feae77b212f0f66e742b91a5b566b7
	https://git.kernel.org/stable/c/e8e9f2a12a6214080c8ea83220a596f6e1dedc6c
	https://git.kernel.org/stable/c/f7ad916273483748582d97cfa31054ccb19224f3
	https://git.kernel.org/stable/c/563aa81fd66a4e7e6e551a0e02bcc23957cafe2f
	https://git.kernel.org/stable/c/293f53263266bc4340d777268ab4328a97f041fa