Skip to content

Commit

Permalink
habanalabs: clear vm_pgoff before doing the mmap
Browse files Browse the repository at this point in the history
The driver use vm_pgoff to hold the CB idr handle. Before we actually call
the mapping function, we need to clear the handle so there won't be any
garbage left in vm_pgoff.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
  • Loading branch information
Oded Gabbay committed Sep 22, 2020
1 parent 3174ac9 commit c5e0ec6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/misc/habanalabs/common/command_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ int hl_cb_mmap(struct hl_fpriv *hpriv, struct vm_area_struct *vma)
u32 handle, user_cb_size;
int rc;

/* We use the page offset to hold the idr and thus we need to clear
* it before doing the mmap itself
*/
handle = vma->vm_pgoff;
vma->vm_pgoff = 0;

/* reference was taken here */
cb = hl_cb_get(hdev, &hpriv->cb_mgr, handle);
Expand Down

0 comments on commit c5e0ec6

Please sign in to comment.