Mellanox/nv_peer_memory

nv_dma_unmap() is not protected by nv_mem_context->is_callback

drossetti opened this issue · 8 comments

in nv_dma_unmap(), if NV_DMA_MAPPING is defined, nvidia_p2p_dma_unmap_pages is called, which frees dma_mapping, even without setting nv_mem_context->sg_allocated.

later in nv_mem_put_pages(), sg_free_table() is called if nv_mem_context->sg_allocated!=0, even if NV_DMA_MAPPING is defined, which is incorrect.

I propose to have the call to sg_free_table() protected by NV_DMA_MAPPING==0

looking better, the call to sg_free_table() is always need.

but nv_dma_unmap() is not protected by nv_mem_context->is_callback, as in nv_mem_put_pages().

changing synopsis

minor issue, nv_mem_put_pages does not set sg_allocated = 0

Right, sg_free_table should be called always since sg_head is allocated in both cases.
nv_mem_context->is_callback protection fix will be pushed.

closing