> alloc_buf() takes a device reference before dma_alloc_coherent(), but its
> failure label only frees the buffer:
> 
>   get_device() -> dma_alloc_coherent() fails -> kfree(buf)
>                 -> device reference is permanently leaked
> 
> Release the reference on the failure path as free_buf() does on success.
> 
> Found by LLM-assisted static analysis. Build tested with allmodconfig;
> no runtime fault-injection test.
> 
> Fixes: 1b6370463e88 ("virtio_console: Add support for remoteproc serial")
> Signed-off-by: Ziheng Wei <[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