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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y2p9QX2r+0MoY1+C@phenom.ffwll.local>
Date:   Tue, 8 Nov 2022 17:01:05 +0100
From:   Daniel Vetter <daniel@...ll.ch>
To:     Maíra Canal <mcanal@...lia.com>
Cc:     Melissa Wen <mwen@...lia.com>, Emma Anholt <emma@...olt.net>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        André Almeida <andrealmeid@...lia.com>,
        "Juan A . Suarez" <jasuarez@...lia.com>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] drm/v3d: add missing mutex_destroy

On Mon, Nov 07, 2022 at 07:46:56PM -0300, Maíra Canal wrote:
> v3d_perfmon_open_file() instantiates a mutex for a particular file
> instance, but it never destroys it by calling mutex_destroy() in
> v3d_perfmon_close_file().
> 
> Similarly, v3d_perfmon_create_ioctl() instantiates a mutex for a
> particular perfmon, but it never destroys it by calling mutex_destroy()
> in v3d_perfmon_destroy_ioctl().
> 
> So, add the missing mutex_destroy on both cases.
> 
> Signed-off-by: Maíra Canal <mcanal@...lia.com>
> ---
>  drivers/gpu/drm/v3d/v3d_perfmon.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_perfmon.c b/drivers/gpu/drm/v3d/v3d_perfmon.c
> index 48aaaa972c49..292c73544255 100644
> --- a/drivers/gpu/drm/v3d/v3d_perfmon.c
> +++ b/drivers/gpu/drm/v3d/v3d_perfmon.c
> @@ -113,6 +113,7 @@ void v3d_perfmon_close_file(struct v3d_file_priv *v3d_priv)
>  	idr_for_each(&v3d_priv->perfmon.idr, v3d_perfmon_idr_del, NULL);
>  	idr_destroy(&v3d_priv->perfmon.idr);
>  	mutex_unlock(&v3d_priv->perfmon.lock);
> +	mutex_destroy(&v3d_priv->perfmon.lock);
>  }
>  
>  int v3d_perfmon_create_ioctl(struct drm_device *dev, void *data,
> @@ -177,6 +178,7 @@ int v3d_perfmon_destroy_ioctl(struct drm_device *dev, void *data,
>  	if (!perfmon)
>  		return -EINVAL;
>  
> +	mutex_destroy(&perfmon->lock);

This one looks wrong, I think this should be put into v3d_perfmon_put.
There is also an error case in v3d_perfmon_create_ioctl() that I think you
missed, right above the kfree(perfmon).

With these two fixes this is Reviewed-by: Daniel Vetter <daniel.vetter@...ll.ch>


>  	v3d_perfmon_put(perfmon);
>  
>  	return 0;
> -- 
> 2.38.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ