* [PATCH 1/2] drm/amdgpu: Fix size overflow
@ 2021-04-07 13:04 xinhui pan
2021-04-07 13:04 ` [PATCH 2/2] drm/radeon: " xinhui pan
2021-04-07 14:00 ` [PATCH 1/2] drm/amdgpu: " Christian König
0 siblings, 2 replies; 3+ messages in thread
From: xinhui pan @ 2021-04-07 13:04 UTC (permalink / raw)
To: amd-gfx; +Cc: alexander.deucher, xinhui pan, christian.koenig
ttm->num_pages is uint32. Hit overflow when << PAGE_SHIFT directly
Fix: 230c079fd (drm/ttm: make num_pages uint32_t)
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index fbaa4c148cca..936b3cfdde55 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -830,7 +830,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev,
/* Allocate an SG array and squash pages into it */
r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0,
- ttm->num_pages << PAGE_SHIFT,
+ (u64)ttm->num_pages << PAGE_SHIFT,
GFP_KERNEL);
if (r)
goto release_sg;
--
2.25.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] drm/radeon: Fix size overflow
2021-04-07 13:04 [PATCH 1/2] drm/amdgpu: Fix size overflow xinhui pan
@ 2021-04-07 13:04 ` xinhui pan
2021-04-07 14:00 ` [PATCH 1/2] drm/amdgpu: " Christian König
1 sibling, 0 replies; 3+ messages in thread
From: xinhui pan @ 2021-04-07 13:04 UTC (permalink / raw)
To: amd-gfx; +Cc: alexander.deucher, xinhui pan, christian.koenig
ttm->num_pages is uint32. Hit overflow when << PAGE_SHIFT directly
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
---
drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 2a61cff325e4..b3fb84b45923 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -360,7 +360,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_device *bdev, struct ttm_tt *ttm
if (gtt->userflags & RADEON_GEM_USERPTR_ANONONLY) {
/* check that we only pin down anonymous memory
to prevent problems with writeback */
- unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE;
+ unsigned long end = gtt->userptr + (u64)ttm->num_pages * PAGE_SIZE;
struct vm_area_struct *vma;
vma = find_vma(gtt->usermm, gtt->userptr);
if (!vma || vma->vm_file || vma->vm_end < end)
@@ -382,7 +382,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_device *bdev, struct ttm_tt *ttm
} while (pinned < ttm->num_pages);
r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0,
- ttm->num_pages << PAGE_SHIFT,
+ (u64)ttm->num_pages << PAGE_SHIFT,
GFP_KERNEL);
if (r)
goto release_sg;
--
2.25.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu: Fix size overflow
2021-04-07 13:04 [PATCH 1/2] drm/amdgpu: Fix size overflow xinhui pan
2021-04-07 13:04 ` [PATCH 2/2] drm/radeon: " xinhui pan
@ 2021-04-07 14:00 ` Christian König
1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2021-04-07 14:00 UTC (permalink / raw)
To: xinhui pan, amd-gfx; +Cc: alexander.deucher, christian.koenig
Am 07.04.21 um 15:04 schrieb xinhui pan:
> ttm->num_pages is uint32. Hit overflow when << PAGE_SHIFT directly
>
> Fix: 230c079fd (drm/ttm: make num_pages uint32_t)
>
> Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com> for the series.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index fbaa4c148cca..936b3cfdde55 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -830,7 +830,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev,
>
> /* Allocate an SG array and squash pages into it */
> r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0,
> - ttm->num_pages << PAGE_SHIFT,
> + (u64)ttm->num_pages << PAGE_SHIFT,
> GFP_KERNEL);
> if (r)
> goto release_sg;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-07 14:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 13:04 [PATCH 1/2] drm/amdgpu: Fix size overflow xinhui pan
2021-04-07 13:04 ` [PATCH 2/2] drm/radeon: " xinhui pan
2021-04-07 14:00 ` [PATCH 1/2] drm/amdgpu: " Christian König
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.