Re: [PATCH v3] misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps()
From: Srinivas Kandagatla
Date: Fri Nov 27 2026 - 04:55:42 EST
On Wed, 05 Aug 2026 14:09:40 +0800, Jianping Li wrote:
> DMA handles passed as invoke arguments (scalars beyond nbufs) may refer
> to the same dma_buf fd as an input/output buffer argument. Taking an
> extra reference for such DMA handle maps leads to duplicate mappings and
> an unbalanced reference count, since DMA handle maps are released
> separately when the DSP returns the fd through the fdlist.
>
> Fix this by not taking an extra reference for DMA handle arguments
> (take_ref = false) and tagging them with FASTRPC_MAP_DMA_HANDLE. As
> these maps are borrowed references, fastrpc_get_args() re-validates the
> map via fastrpc_map_lookup() before dereferencing it, so it is not used
> after being freed. fastrpc_put_args() only releases maps flagged as
> FASTRPC_MAP_DMA_HANDLE and clears the flag to guarantee the map is freed
> exactly once.
>
> [...]
Applied, thanks!
[1/1] misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps()
commit: d943eec5a618cef0e2ba77b799c6ee27fae873dc
Best regards,
--
Srinivas Kandagatla <srini@xxxxxxxxxx>