diff mbox

[1/4] drm/radeon: add extra check in radeon_ttm_tt_unpin_userptr

Message ID 1427816220-1670-1-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König March 31, 2015, 3:36 p.m. UTC
From: Christian König <christian.koenig@amd.com>

We somehow try to free the SG table twice.

Bugs: https://bugs.freedesktop.org/show_bug.cgi?id=89734

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: <stable@vger.kernel.org>
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Alex Deucher March 31, 2015, 4:13 p.m. UTC | #1
On Tue, Mar 31, 2015 at 11:36 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> We somehow try to free the SG table twice.
>
> Bugs: https://bugs.freedesktop.org/show_bug.cgi?id=89734
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Cc: <stable@vger.kernel.org>

For the series:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

I've added the first two to my -fixes tree.

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index d02aa1d..b292aca 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -598,6 +598,10 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
>         enum dma_data_direction direction = write ?
>                 DMA_BIDIRECTIONAL : DMA_TO_DEVICE;
>
> +       /* double check that we don't free the table twice */
> +       if (!ttm->sg->sgl)
> +               return;
> +
>         /* free the sg table and pages again */
>         dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
>
> --
> 1.9.1
>
Christian König April 8, 2015, 9:46 a.m. UTC | #2
On 31.03.2015 18:13, Alex Deucher wrote:
> On Tue, Mar 31, 2015 at 11:36 AM, Christian König
> <deathsimple@vodafone.de> wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> We somehow try to free the SG table twice.
>>
>> Bugs: https://bugs.freedesktop.org/show_bug.cgi?id=89734
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Cc: <stable@vger.kernel.org>
> For the series:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
> I've added the first two to my -fixes tree.

Could you add the other two to your -next tree? You probably need to 
merge with -fixes to do so.

Regards,
Christian.

>
> Alex
>
>> ---
>>   drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
>> index d02aa1d..b292aca 100644
>> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
>> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
>> @@ -598,6 +598,10 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
>>          enum dma_data_direction direction = write ?
>>                  DMA_BIDIRECTIONAL : DMA_TO_DEVICE;
>>
>> +       /* double check that we don't free the table twice */
>> +       if (!ttm->sg->sgl)
>> +               return;
>> +
>>          /* free the sg table and pages again */
>>          dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
>>
>> --
>> 1.9.1
>>
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index d02aa1d..b292aca 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -598,6 +598,10 @@  static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 	enum dma_data_direction direction = write ?
 		DMA_BIDIRECTIONAL : DMA_TO_DEVICE;
 
+	/* double check that we don't free the table twice */
+	if (!ttm->sg->sgl)
+		return;
+
 	/* free the sg table and pages again */
 	dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);