CVE-2024-47720
Severity CVSS v4.0:
Pending analysis
Type:
CWE-476
NULL Pointer Dereference
Publication date:
21/10/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
drm/amd/display: Add null check for set_output_gamma in dcn30_set_output_transfer_func<br />
<br />
This commit adds a null check for the set_output_gamma function pointer<br />
in the dcn30_set_output_transfer_func function. Previously,<br />
set_output_gamma was being checked for nullity at line 386, but then it<br />
was being dereferenced without any nullity check at line 401. This<br />
could potentially lead to a null pointer dereference error if<br />
set_output_gamma is indeed null.<br />
<br />
To fix this, we now ensure that set_output_gamma is not null before<br />
dereferencing it. We do this by adding a nullity check for<br />
set_output_gamma before the call to set_output_gamma at line 401. If<br />
set_output_gamma is null, we log an error message and do not call the<br />
function.<br />
<br />
This fix prevents a potential null pointer dereference error.<br />
<br />
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:401 dcn30_set_output_transfer_func()<br />
error: we previously assumed &#39;mpc->funcs->set_output_gamma&#39; could be null (see line 386)<br />
<br />
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c<br />
373 bool dcn30_set_output_transfer_func(struct dc *dc,<br />
374 struct pipe_ctx *pipe_ctx,<br />
375 const struct dc_stream_state *stream)<br />
376 {<br />
377 int mpcc_id = pipe_ctx->plane_res.hubp->inst;<br />
378 struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;<br />
379 const struct pwl_params *params = NULL;<br />
380 bool ret = false;<br />
381<br />
382 /* program OGAM or 3DLUT only for the top pipe*/<br />
383 if (pipe_ctx->top_pipe == NULL) {<br />
384 /*program rmu shaper and 3dlut in MPC*/<br />
385 ret = dcn30_set_mpc_shaper_3dlut(pipe_ctx, stream);<br />
386 if (ret == false && mpc->funcs->set_output_gamma) {<br />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If this is NULL<br />
<br />
387 if (stream->out_transfer_func.type == TF_TYPE_HWPWL)<br />
388 params = &stream->out_transfer_func.pwl;<br />
389 else if (pipe_ctx->stream->out_transfer_func.type ==<br />
390 TF_TYPE_DISTRIBUTED_POINTS &&<br />
391 cm3_helper_translate_curve_to_hw_format(<br />
392 &stream->out_transfer_func,<br />
393 &mpc->blender_params, false))<br />
394 params = &mpc->blender_params;<br />
395 /* there are no ROM LUTs in OUTGAM */<br />
396 if (stream->out_transfer_func.type == TF_TYPE_PREDEFINED)<br />
397 BREAK_TO_DEBUGGER();<br />
398 }<br />
399 }<br />
400<br />
--> 401 mpc->funcs->set_output_gamma(mpc, mpcc_id, params);<br />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Then it will crash<br />
<br />
402 return ret;<br />
403 }
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.9 (including) | 5.15.168 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.113 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.54 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.10.13 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.11 (including) | 6.11.2 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/08ae395ea22fb3d9b318c8bde28c0dfd2f5fa4d2
- https://git.kernel.org/stable/c/44948d3cb943602ba4a0b5ed3c91ae0525838fb1
- https://git.kernel.org/stable/c/64886a4e6f1dce843c0889505cf0673b5211e16a
- https://git.kernel.org/stable/c/72ee32d0907364104fbcf4f68dd5ae63cd8eae9e
- https://git.kernel.org/stable/c/84edd5a3f5fa6aafa4afcaf9f101f46426c620c9
- https://git.kernel.org/stable/c/ddf9ff244d704e1903533f7be377615ed34b83e7
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



