]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/etnaviv: Fix a leak in submit_pin_objects()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 18 May 2020 11:29:55 +0000 (14:29 +0300)
committerLucas Stach <l.stach@pengutronix.de>
Tue, 19 May 2020 09:18:59 +0000 (11:18 +0200)
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 <dan.carpenter@oracle.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c

index 3b0afa156d92994ad21aef0d910e95b6f0a45240..54def341c1dbe7c83df0e4b57fbf57f7c784031f 100644 (file)
@@ -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);