[1/2] drm/v3d: remove duplicated kfree in v3d_submit_cl_ioctl()
diff mbox series

Message ID 20200601123202.3892415-1-yukuai3@huawei.com
State New
Headers show
Series
  • [1/2] drm/v3d: remove duplicated kfree in v3d_submit_cl_ioctl()
Related show

Commit Message

yukuai (C) June 1, 2020, 12:32 p.m. UTC
kfree() is called twice for the same variable 'bin', the first is
introduced in commit 0d352a3a8a1f ("drm/v3d: don't leak bin job if
v3d_job_init fails."), while the second is introduced in
commit 29cd13cfd762 ("drm/v3d: Fix memory leak in v3d_submit_cl_ioctl").
The latter one should fail since there is a conflict, however, it got
merged somehow.

Fix it by removing the function call which is introduced later.

Fixes: 29cd13cfd762 ("drm/v3d: Fix memory leak in v3d_submit_cl_ioctl")
Signed-off-by: yu kuai <yukuai3@huawei.com>
---
 drivers/gpu/drm/v3d/v3d_gem.c | 1 -
 1 file changed, 1 deletion(-)

Comments

yukuai (C) June 9, 2020, 2:19 p.m. UTC | #1
ping ?

On 2020/6/1 20:32, yu kuai wrote:
> kfree() is called twice for the same variable 'bin', the first is
> introduced in commit 0d352a3a8a1f ("drm/v3d: don't leak bin job if
> v3d_job_init fails."), while the second is introduced in
> commit 29cd13cfd762 ("drm/v3d: Fix memory leak in v3d_submit_cl_ioctl").
> The latter one should fail since there is a conflict, however, it got
> merged somehow.
> 
> Fix it by removing the function call which is introduced later.
> 
> Fixes: 29cd13cfd762 ("drm/v3d: Fix memory leak in v3d_submit_cl_ioctl")
> Signed-off-by: yu kuai <yukuai3@huawei.com>
> ---
>   drivers/gpu/drm/v3d/v3d_gem.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
> index 549dde83408b..271567600921 100644
> --- a/drivers/gpu/drm/v3d/v3d_gem.c
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -570,7 +570,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
>   		if (ret) {
>   			kfree(bin);
>   			v3d_job_put(&render->base);
> -			kfree(bin);
>   			return ret;
>   		}
>   
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
index 549dde83408b..271567600921 100644
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -570,7 +570,6 @@  v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
 		if (ret) {
 			kfree(bin);
 			v3d_job_put(&render->base);
-			kfree(bin);
 			return ret;
 		}