В ядре Linux устранена следующая уязвимость:
drm/amd/display: добавлены проверки нулевого указателя в функции атрибута курсора dc_stream. Функция dc_stream_set_cursor_attributes() в настоящее время разыменовывает
указатель `stream` и вложенные члены `stream->ctx->dc->current_state`
без проверки NULL. Все вызывающие эти функции, например, в
`dcn30_apply_idle_power_optimizations()` и
`amdgpu_dm_plane_handle_cursor_update()`, уже выполняет проверки NULL
перед вызовом этих функций.
Исправления ниже:
драйверы/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:336 dc_stream_program_cursor_attributes()
ошибка: ранее мы предполагали, что «поток» может иметь значение null (см. строку 334).
драйверы/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c
327 bool dc_stream_program_cursor_attributes(
328 структура dc_stream_state *поток,
329 const struct dc_cursor_attributes *attributes)
330 {
331 структура постоянного тока *постоянный ток;
332 bool reset_idle_optimizations = ложь;
333
334 постоянного тока = поток? поток->ctx->dc: NULL;
^^^^^^
Старый код предполагал, что поток может быть NULL.
335
--> 336 if (dc_stream_set_cursor_attributes(поток, атрибуты)) {
^^^^^^
Рефакторинг добавил непроверяемое разыменование.
драйверы/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c
313 bool dc_stream_set_cursor_attributes(
314 структура dc_stream_state *поток,
315 const struct dc_cursor_attributes *attributes)
316 {
317 логический результат = ложь;
318
319 if (dc_stream_check_cursor_attributes(поток, поток->ctx->dc->current_state, атрибуты)) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Здесь. Эта функция используется для проверки того, имеет ли поток значение NULL, и возвращает false в
начало. Вероятно, нам следует добавить это обратно.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: drm/amd/display: Add NULL pointer checks in dc_stream cursor attribute functions The function dc_stream_set_cursor_attributes() currently dereferences the `stream` pointer and nested members `stream->ctx->dc->current_state` without checking for NULL. All callers of these functions, such as in `dcn30_apply_idle_power_optimizations()` and `amdgpu_dm_plane_handle_cursor_update()`, already perform NULL checks before calling these functions. Fixes below: drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:336 dc_stream_program_cursor_attributes() error: we previously assumed 'stream' could be null (see line 334) drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c 327 bool dc_stream_program_cursor_attributes( 328 struct dc_stream_state *stream, 329 const struct dc_cursor_attributes *attributes) 330 { 331 struct dc *dc; 332 bool reset_idle_optimizations = false; 333 334 dc = stream ? stream->ctx->dc : NULL; ^^^^^^ The old code assumed stream could be NULL. 335 --> 336 if (dc_stream_set_cursor_attributes(stream, attributes)) { ^^^^^^ The refactor added an unchecked dereference. drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c 313 bool dc_stream_set_cursor_attributes( 314 struct dc_stream_state *stream, 315 const struct dc_cursor_attributes *attributes) 316 { 317 bool result = false; 318 319 if (dc_stream_check_cursor_attributes(stream, stream->ctx->dc->current_state, attributes)) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Here. This function used to check for if stream as NULL and return false at the start. Probably we should add that back.