driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Fix memory leakage on error path. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 38bd04be7f32..a45938ae525e 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -421,8 +421,10 @@ static int hisi_soc_cache_mmap(struct file *file, struct vm_area_struct *vma) if (ret) goto out_clr; - if (vma->vm_pgoff > PAGE_SIZE) - return -EINVAL; + if (vma->vm_pgoff > PAGE_SIZE) { + ret = -EINVAL; + goto out_clr; + } ret = remap_pfn_range(vma, vma->vm_start, (addr >> PAGE_SHIFT) + vma->vm_pgoff, -- 2.33.0