diff options
author | Kaushal Sanadhya <quic_ksanadhy@quicinc.com> | 2023-11-29 23:06:45 +0530 |
---|---|---|
committer | NISARG SHETH <quic_nsheth@quicinc.com> | 2023-12-22 01:37:46 +0530 |
commit | 7ee39cfc667e77c4c1bd87e63ffdda68948faa33 (patch) | |
tree | 8aba64870241909cecc95817ff0c91209ced3534 /drivers/gpu/msm/kgsl_mmu.c | |
parent | ffd5887a21a52729ff3262c173253bbc7483877f (diff) |
msm: kgsl: Do not free sharedmem if it cannot be unmapped
If sharedmem cannot be unmapped from the mmu, it can still be accessed
by the GPU. Therefore it is not safe to free the backing memory. In the
case that unmap fails, do not free it or return it to the system.
Change-Id: Iad3e86d043f129a4d71cf862865d9033d4a315e3
Signed-off-by: Lynus Vaz <quic_lvaz@quicinc.com>
Signed-off-by: Kaushal Sanadhya <quic_ksanadhy@quicinc.com>
Diffstat (limited to 'drivers/gpu/msm/kgsl_mmu.c')
-rw-r--r-- | drivers/gpu/msm/kgsl_mmu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/msm/kgsl_mmu.c b/drivers/gpu/msm/kgsl_mmu.c index 228f3396ae90..7aa68abbf91c 100644 --- a/drivers/gpu/msm/kgsl_mmu.c +++ b/drivers/gpu/msm/kgsl_mmu.c @@ -1,5 +1,5 @@ /* Copyright (c) 2002,2007-2017,2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -498,6 +498,8 @@ kgsl_mmu_unmap(struct kgsl_pagetable *pagetable, size = kgsl_memdesc_footprint(memdesc); ret = pagetable->pt_ops->mmu_unmap(pagetable, memdesc); + if (ret) + return ret; atomic_dec(&pagetable->stats.entries); atomic_long_sub(size, &pagetable->stats.mapped); |