[PATCH 2/3] drm/amd/amdgpu: Fix crash in amdgpu_bo_reserve

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



NAK, when bo->tbo.resv is NULL then the BO is corrupted (or already 
released).

Please find the root cause of that corruption or freed memory access 
instead of adding such crude workarounds.

Regards,
Christian.

Am 06.06.2018 um 11:25 schrieb Pratik Vishwakarma:
> Fixes null pointer access in ww_mutex_lock
> where lock->base is NULL
>
> Crash dump is as follows:
> Call Trace:
> ww_mutex_lock+0x3a/0x8e
> amdgpu_bo_reserve+0x40/0x87
> amdgpu_device_suspend+0xf4/0x210
> pci_pm_suspend+0x12a/0x1a5
> ? pci_dev_driver+0x36/0x36
> dpm_run_callback+0x59/0xbf
> __device_suspend+0x215/0x33f
> async_suspend+0x1f/0x5c
> async_run_entry_fn+0x3d/0xd2
> process_one_work+0x1b0/0x314
> worker_thread+0x1cb/0x2c1
> ? create_worker+0x1da/0x1da
> kthread+0x156/0x15e
> ? kthread_flush_work+0xea/0xea
> ret_from_fork+0x22/0x40
>
> Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index 7317480..c9df7ae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -152,6 +152,8 @@ static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
>   	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
>   	int r;
>   
> +	if (&(bo->tbo.resv->lock) == NULL)
> +		return -EINVAL;
>   	r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
>   	if (unlikely(r != 0)) {
>   		if (r != -ERESTARTSYS)



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux