mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: detach previous attachment on re-mapping
If the dmabuf attachment is not stored in the dmabuf priv data, on re-mapping the buffer, new attachment is prepared and the same is detached on finding existing mapping. Prior attachment is not detached in nvgpu_vm_find_mapping. However mapped_buffer stores the recent attachment that is detached. Hence on last unmap it will result in NULL access. Hence, detach the attachment stored in mapped_buffer in nvgpu_vm_find_mapping. Bug 2834141 Change-Id: I0c3c0b1c684b4984dba4f39edb8610b94961291e Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2290313 Tested-by: Debarshi Dutta <ddutta@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-by: Lakshmanan M <lm@nvidia.com> Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
249418b90b
commit
ded9241b1d
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -155,7 +155,8 @@ struct nvgpu_mapped_buf *nvgpu_vm_find_mapping(struct vm_gk20a *vm,
|
|||||||
* If we find the mapping here then that means we have mapped it already
|
* If we find the mapping here then that means we have mapped it already
|
||||||
* and the prior pin and get must be undone.
|
* and the prior pin and get must be undone.
|
||||||
*/
|
*/
|
||||||
gk20a_mm_unpin(os_buf->dev, os_buf->dmabuf, os_buf->attachment,
|
gk20a_mm_unpin(os_buf->dev, os_buf->dmabuf,
|
||||||
|
mapped_buffer->os_priv.attachment,
|
||||||
mapped_buffer->os_priv.sgt);
|
mapped_buffer->os_priv.sgt);
|
||||||
dma_buf_put(os_buf->dmabuf);
|
dma_buf_put(os_buf->dmabuf);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user