All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
To: christian.koenig-5C7GfCeVMHo@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/ttm: Always and only destroy bo->ttm_resv in ttm_bo_release_list
Date: Thu, 2 Nov 2017 18:23:22 +0100	[thread overview]
Message-ID: <3bd52b36-d2c8-8381-1f7c-94babe755eca@daenzer.net> (raw)
In-Reply-To: <da4684ab-2c6d-7543-0c5d-3483ca093bc5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 02/11/17 11:49 AM, Christian König wrote:
> Am 01.11.2017 um 17:15 schrieb Michel Dänzer:
>> From: Michel Dänzer <michel.daenzer@amd.com>
>>
>> Fixes a use-after-free due to a race condition in
>> ttm_bo_cleanup_refs_and_unlock, which allows one task to reserve a BO
>> and destroy its ttm_resv while another task is waiting for it to signal
>> in reservation_object_wait_timeout_rcu.
>>
>> Fixes: 0d2bd2ae045d "drm/ttm: fix memory leak while individualizing BOs"
>> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
> 
> Good idea, but one thing we should probably change.
> 
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo.c | 13 +++----------
>>   1 file changed, 3 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index 379ec41d2c69..a19a0ebf32ac 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -150,8 +150,7 @@ static void ttm_bo_release_list(struct kref
>> *list_kref)
>>       ttm_tt_destroy(bo->ttm);
>>       atomic_dec(&bo->glob->bo_count);
>>       dma_fence_put(bo->moving);
>> -    if (bo->resv == &bo->ttm_resv)
>> -        reservation_object_fini(&bo->ttm_resv);
>> +    reservation_object_fini(&bo->ttm_resv);
> 
> When we always call reservation_object_fini() here we should probably
> also always call reservation_object_init() in ttm_bo_init_reserved() to
> make sure the object is always initialized.

Fair enough.


> This way we can also remove the call to reservation_object_init() in
> ttm_bo_individualize_resv().

Both done in v2, thanks for the review and suggestions.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-11-02 17:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 16:15 [PATCH] drm/ttm: Always and only destroy bo->ttm_resv in ttm_bo_release_list Michel Dänzer
     [not found] ` <20171101161529.4844-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-11-02  2:30   ` Chunming Zhou
2017-11-02 10:49   ` Christian König
     [not found]     ` <da4684ab-2c6d-7543-0c5d-3483ca093bc5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-02 17:23       ` Michel Dänzer [this message]
2017-11-02 17:22   ` [PATCH v2] " Michel Dänzer
     [not found]     ` <20171102172218.7827-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-11-02 17:34       ` Christian König
  -- strict thread matches above, loose matches on Subject: below --
2017-11-01 16:15 [PATCH] " Michel Dänzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3bd52b36-d2c8-8381-1f7c-94babe755eca@daenzer.net \
    --to=michel-otuistvhuppr7s880joybq@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.