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]
Date:   Sat, 13 Jun 2020 17:08:58 +0200
From:   Christian König <christian.koenig@....com>
To:     Xiyu Yang <xiyuyang19@...an.edu.cn>, Huang Rui <ray.huang@....com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Sumit Semwal <sumit.semwal@...aro.org>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        linux-media@...r.kernel.org, linaro-mm-sig@...ts.linaro.org
Cc:     yuanxzhang@...an.edu.cn, kjlu@....edu,
        Xin Tan <tanxin.ctf@...il.com>
Subject: Re: [PATCH] drm/ttm: Fix dma_fence refcnt leak in
 ttm_bo_vm_fault_reserved

Am 13.06.20 um 14:28 schrieb Xiyu Yang:
> ttm_bo_vm_fault_reserved() invokes dma_fence_get(), which returns a
> reference of the specified dma_fence object to "moving" with increased
> refcnt.
>
> When ttm_bo_vm_fault_reserved() returns, local variable "moving" becomes
> invalid, so the refcount should be decreased to keep refcount balanced.
>
> The reference counting issue happens in several exception handling paths
> of ttm_bo_vm_fault_reserved(). When those error scenarios occur such as
> "err" equals to -EBUSY, the function forgets to decrease the refcnt
> increased by dma_fence_get(), causing a refcnt leak.
>
> Fix this issue by calling dma_fence_put() when no_wait_gpu flag is
> equals to true.
>
> Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
> Signed-off-by: Xin Tan <tanxin.ctf@...il.com>

Good catch, Reviewed-by: Christian König <christian.koenig@....com>.

Going to pick that up for drm-misc-fixes.

Christian.

> ---
>   drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> index a43aa7275f12..fa03fab02076 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> @@ -300,8 +300,10 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
>   			break;
>   		case -EBUSY:
>   		case -ERESTARTSYS:
> +			dma_fence_put(moving);
>   			return VM_FAULT_NOPAGE;
>   		default:
> +			dma_fence_put(moving);
>   			return VM_FAULT_SIGBUS;
>   		}
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ