> 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: [email protected]
> Signed-off-by: Alex Kazinsky <[email protected]>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1


Reply via email to