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: <ea67fa6b-0fcd-4b59-861f-360e74a4d70a@gmail.com>
Date:   Mon, 23 May 2022 09:57:46 +0800
From:   Hangyu Hua <hbh25y@...il.com>
To:     maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
        tzimmermann@...e.de, airlied@...ux.ie, daniel@...ll.ch
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpu: drm: fix possible memory leak in drm_addmap_core()

On 2022/5/9 13:44, Hangyu Hua wrote:
> map->handle need to be handled correctly when map->type is _DRM_SHM or
> _DRM_CONSISTENT just like map->type is _DRM_REGISTERS.
> 
> Fixes: 8d153f7107ff ("drm: update user token hashing and map handles")
> Signed-off-by: Hangyu Hua <hbh25y@...il.com>
> ---
>   drivers/gpu/drm/drm_bufs.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index fcca21e8efac..2b3f504c5f9c 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -344,6 +344,15 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
>   	if (!list) {
>   		if (map->type == _DRM_REGISTERS)
>   			iounmap(map->handle);
> +		else if (map->type == _DRM_SHM) {
> +			dev->sigdata.lock = dev->master->lock.hw_lock = NULL;
> +			vfree(map->handle);
> +		} else if (map->type == _DRM_CONSISTENT) {
> +			dma_free_coherent(dev->dev,
> +					  map->size,
> +					  map->handle,
> +					  map->offset);
> +		}
>   		kfree(map);
>   		return -EINVAL;
>   	}
> @@ -361,6 +370,15 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
>   	if (ret) {
>   		if (map->type == _DRM_REGISTERS)
>   			iounmap(map->handle);
> +		else if (map->type == _DRM_SHM) {
> +			dev->sigdata.lock = dev->master->lock.hw_lock = NULL;
> +			vfree(map->handle);
> +		} else if (map->type == _DRM_CONSISTENT) {
> +			dma_free_coherent(dev->dev,
> +					  map->size,
> +					  map->handle,
> +					  map->offset);
> +		}
>   		kfree(map);
>   		kfree(list);
>   		mutex_unlock(&dev->struct_mutex);

Gentel ping.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ