From: Dan Carpenter Date: Mon, 18 May 2020 11:29:55 +0000 (+0300) Subject: drm/etnaviv: Fix a leak in submit_pin_objects() X-Git-Tag: baikal/mips/sdk5.9~13647^2~1^2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=04c457e9a589da83070227de31ac376696c5a203;p=kernel.git drm/etnaviv: Fix a leak in submit_pin_objects() If the mapping address is wrong then we have to release the reference to it before returning -EINVAL. Fixes: 45cc56bf1d7c ("drm/etnaviv: implement softpin") Signed-off-by: Dan Carpenter Signed-off-by: Lucas Stach --- diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 3b0afa156d929..54def341c1dbe 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -238,8 +238,10 @@ static int submit_pin_objects(struct etnaviv_gem_submit *submit) } if ((submit->flags & ETNA_SUBMIT_SOFTPIN) && - submit->bos[i].va != mapping->iova) + submit->bos[i].va != mapping->iova) { + etnaviv_gem_mapping_unreference(mapping); return -EINVAL; + } atomic_inc(&etnaviv_obj->gpu_active);