habanalabs: fix vma fields assignments order in hl_hw_block_mmap()
authorTomer Tayar <ttayar@habana.ai>
Fri, 29 Jul 2022 13:30:48 +0000 (16:30 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Sun, 18 Sep 2022 10:29:51 +0000 (13:29 +0300)
commit5f46217221dfdda94244d88ac6c1354293fc681b
treefd85824f40c113ec56dd03b5c26b9fe12d6b3b0a
parent7fa6c0fe8b2154f84162b8aacbe581df722a6f0c
habanalabs: fix vma fields assignments order in hl_hw_block_mmap()

In hl_hw_block_mmap(), the vma's 'vm_private_data' and 'vm_ops' fields
are assigned before filling the content of the private data.
In between there is a call to the ASIC hw_block_mmap() function, and if
it fails, the vma close function will be called with a bad private data
value.
Fix the order of assignments to avoid this issue.

In hl_hw_block_mmap() the vma's 'vm_private_data and vm_ops are assigned
before setting the

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/memory.c