Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565740 > unrolled thread

[PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-01-24 10:30 +0100
Last post2017-01-24 23:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-01-24 10:30 +0100
    Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from  ioremap_nocache Christian König <deathsimple@vodafone.de> - 2017-01-24 11:00 +0100
      Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache Alex Deucher <alexdeucher@gmail.com> - 2017-01-24 23:20 +0100

#1565740 — [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-01-24 10:30 +0100
Subject[PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
Message-ID<t35Al-2uf-1@gated-at.bofh.it>
Here, If ioremap_nocache will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 8e35c1f..610c88f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -552,6 +552,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
 			mem->bus.addr =
 				ioremap_nocache(mem->bus.base + mem->bus.offset,
 						mem->bus.size);
+		if (!mem->bus.addr)
+			return -ENOMEM;
 
 		/*
 		 * Alpha: Use just the bus offset plus
-- 
1.9.1

[toc] | [next] | [standalone]


#1565749 — Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache

FromChristian König <deathsimple@vodafone.de>
Date2017-01-24 11:00 +0100
SubjectRe: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
Message-ID<t363s-2EC-5@gated-at.bofh.it>
In reply to#1565740
Am 24.01.2017 um 10:25 schrieb Arvind Yadav:
> Here, If ioremap_nocache will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference.
> This error check will avoid NULL pointer dereference.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

I'm not 100% sure if ioremap_nocache() can actually return NULL on 
platforms where this matters, but if that's the case the patch looks 
reasonable on first glance.

So it is Reviewed-by: Christian König <christian.koenig@amd.com>.

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 8e35c1f..610c88f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -552,6 +552,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>   			mem->bus.addr =
>   				ioremap_nocache(mem->bus.base + mem->bus.offset,
>   						mem->bus.size);
> +		if (!mem->bus.addr)
> +			return -ENOMEM;
>   
>   		/*
>   		 * Alpha: Use just the bus offset plus

[toc] | [prev] | [next] | [standalone]


#1566198

FromAlex Deucher <alexdeucher@gmail.com>
Date2017-01-24 23:20 +0100
Message-ID<t3hBv-1HD-1@gated-at.bofh.it>
In reply to#1565749
On Tue, Jan 24, 2017 at 4:55 AM, Christian König
<deathsimple@vodafone.de> wrote:
> Am 24.01.2017 um 10:25 schrieb Arvind Yadav:
>>
>> Here, If ioremap_nocache will fail. It will return NULL.
>> Kernel can run into a NULL-pointer dereference.
>> This error check will avoid NULL pointer dereference.
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>
>
> I'm not 100% sure if ioremap_nocache() can actually return NULL on platforms
> where this matters, but if that's the case the patch looks reasonable on
> first glance.
>
> So it is Reviewed-by: Christian König <christian.koenig@amd.com>.
>

Applied this and the radeon patch.

Alex

> Regards,
> Christian.
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 8e35c1f..610c88f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -552,6 +552,8 @@ static int amdgpu_ttm_io_mem_reserve(struct
>> ttm_bo_device *bdev, struct ttm_mem_
>>                         mem->bus.addr =
>>                                 ioremap_nocache(mem->bus.base +
>> mem->bus.offset,
>>                                                 mem->bus.size);
>> +               if (!mem->bus.addr)
>> +                       return -ENOMEM;
>>                 /*
>>                  * Alpha: Use just the bus offset plus
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web