lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44140361-33c3-ff97-b28f-64c26bf87d5c@igalia.com>
Date:   Mon, 5 Dec 2022 21:37:26 -0300
From:   Maíra Canal <mcanal@...lia.com>
To:     Melissa Wen <mwen@...lia.com>, emma@...olt.net, airlied@...il.com,
        daniel@...ll.ch
Cc:     Thomas Zimmermann <tzimmermann@...e.de>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        kernel-dev@...lia.com
Subject: Re: [PATCH v2 1/2] drm/v3d: cleanup BOs properly when lookup_bos
 fails

On 12/5/22 10:55, Melissa Wen wrote:
> When v3d_lookup_bos fails to `allocate validated BO pointers`,
> job->bo_count was already set to args->bo_count, but job->bo points to
> NULL. In this scenario, we must verify that job->bo is not NULL before
> iterating on it to proper clean up a job. Also, drm_gem_object_put
> already checks that the object passed is not NULL, doing the job->bo[i]
> checker redundant.
> 
> Signed-off-by: Melissa Wen <mwen@...lia.com>

Reviewed-by: Maíra Canal <mcanal@...lia.com>

Best Regards,
- Maíra Canal

> ---
>  drivers/gpu/drm/v3d/v3d_gem.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
> index 96af1cb5202a..31a37572c11d 100644
> --- a/drivers/gpu/drm/v3d/v3d_gem.c
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -363,11 +363,11 @@ v3d_job_free(struct kref *ref)
>  	struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
>  	int i;
>  
> -	for (i = 0; i < job->bo_count; i++) {
> -		if (job->bo[i])
> +	if (job->bo) {
> +		for (i = 0; i < job->bo_count; i++)
>  			drm_gem_object_put(job->bo[i]);
> +		kvfree(job->bo);
>  	}
> -	kvfree(job->bo);
>  
>  	dma_fence_put(job->irq_fence);
>  	dma_fence_put(job->done_fence);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ