Skip to content

Commit

Permalink
msm: kgsl: Correctly clean up dma buffer attachment in case of error
Browse files Browse the repository at this point in the history
In kgsl_ioctl_gpuobj_import(), user memory of type KGSL_USER_MEM_TYPE_ADDR
can also lead to setting up a dma buffer. When attaching mem entry to
process fails, dma buffer attachment is cleaned up only in case of
KGSL_USER_MEM_TYPE_DMABUF. Similar situation can arise in case of
kgsl_ioctl_map_user_mem(). Fix this by obtaining user memory type from
the memdesc flags.

Bug: 161544755
Change-Id: I502bd0ae19241802e8f835f20391b2ce67999418
Signed-off-by: Puranam V G Tejaswi <[email protected]>
Signed-off-by: engstk <[email protected]>
  • Loading branch information
Puranam V G Tejaswi authored and engstk committed Feb 2, 2021
1 parent f6c02eb commit c04f211
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/msm/kgsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2711,7 +2711,7 @@ long kgsl_ioctl_gpuobj_import(struct kgsl_device_private *dev_priv,
return 0;

unmap:
if (param->type == KGSL_USER_MEM_TYPE_DMABUF) {
if (kgsl_memdesc_usermem_type(&entry->memdesc) == KGSL_MEM_ENTRY_ION) {
kgsl_destroy_ion(dev_priv->device, entry->priv_data);
entry->memdesc.sgt = NULL;
}
Expand Down Expand Up @@ -3025,7 +3025,7 @@ long kgsl_ioctl_map_user_mem(struct kgsl_device_private *dev_priv,
return result;

error_attach:
switch (memtype) {
switch (kgsl_memdesc_usermem_type(&entry->memdesc)) {
case KGSL_MEM_ENTRY_ION:
kgsl_destroy_ion(dev_priv->device, entry->priv_data);
entry->memdesc.sgt = NULL;
Expand Down

0 comments on commit c04f211

Please sign in to comment.