[lvc-project] [PATCH] drm/qxl: Handle failure to reference the surface release buffer
Fedor Pchelkin
pchelkin at ispras.ru
Wed Nov 25 23:44:34 MSK 2026
On Fri, 13. Nov 15:06, Alex Kazinsky wrote:
> When allocating a surface destroy release, qxl_release_list_add()
> takes a reference to the buffer shared with the create release.
> If allocation of the list entry fails, the error is ignored and
> the destroy command is submitted without holding that reference.
>
> Once the current release buffer has changed and the create release
> has been freed, the buffer may be freed while the destroy release
> still points to it. Garbage collection can then access the freed
> buffer through qxl_release_map().
>
> Check the return value, free the new release and propagate the error
> before submitting the command. Increment release_count after successful
> release allocation to balance the decrement in qxl_release_free() on
> both the error and normal completion paths.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE static
> analysis tool.
>
> Fixes: 8002db6336dd ("qxl: convert qxl driver to proper use for reservations")
> Cc: stable at vger.kernel.org
> Signed-off-by: Alex Kazinsky <a.kazinsky at ideco.ru>
Для ветки 5.10 просьба отправить отдельный патч в lvc-patches, там
возникает ошибка сборки
drivers/gpu/drm/qxl/qxl_release.c: In function 'qxl_alloc_surface_release_reserved':
drivers/gpu/drm/qxl/qxl_release.c:305:35: error: 'struct qxl_device' has no member named 'release_count'; did you mean 'release_ring'?
305 | atomic_inc(&qdev->release_count);
| ^~~~~~~~~~~~~
| release_ring
И, кстати, для тех драйверов, которые можно пощупать локально например в
тестовой ВМ, не будет лишним пробовать написать (ну или сгенерировать)
репродьюсер, воспроизводящий и подтверждающий проблему. Это поможет и нам
всем дополнительно удостовериться в корректности патча, и в межд.
сообществе на такое как правило реагируют более активно. Можете взять
на заметку.
More information about the lvc-project
mailing list