From: Huang Rui <ray.huang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
Cc: Tom StDenis <Tom.StDenis-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/2] drm/ttm: set ttm_buffer_object pointer as null after it's freed
Date: Mon, 10 Sep 2018 17:23:21 +0800 [thread overview]
Message-ID: <20180910092320.GA22247@hr-amur2> (raw)
In-Reply-To: <d40314d2-f1c4-b353-bda6-50aed5dda8db-5C7GfCeVMHo@public.gmane.org>
On Mon, Sep 10, 2018 at 11:00:04AM +0200, Christian König wrote:
> Hi Ray,
>
> well those patches doesn't make sense, the pointer is only local to
> the function.
You're right.
I narrowed it with gdb dump from ttm_bo_bulk_move_lru_tail+0x2b, the
use-after-free should be in below codes:
man = &bulk->tt[i].first->bdev->man[TTM_PL_TT];
ttm_bo_bulk_move_helper(&bulk->tt[i], &man->lru[i], false);
Is there a case, when orignal bo is destroyed in the bulk pos, but it
doesn't update pos->first pointer, then we still use it during the bulk
moving?
Thanks,
Ray
>
> Regards,
> Christian.
>
> Am 10.09.2018 um 10:57 schrieb Huang Rui:
> >It avoids to be refered again after freed.
> >
> >Signed-off-by: Huang Rui <ray.huang@amd.com>
> >Cc: Christian König <christian.koenig@amd.com>
> >Cc: Tom StDenis <Tom.StDenis@amd.com>
> >---
> > drivers/gpu/drm/ttm/ttm_bo.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> >diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> >index 138c989..d3ef5f8 100644
> >--- a/drivers/gpu/drm/ttm/ttm_bo.c
> >+++ b/drivers/gpu/drm/ttm/ttm_bo.c
> >@@ -54,6 +54,7 @@ static struct attribute ttm_bo_count = {
> > static void ttm_bo_default_destroy(struct ttm_buffer_object *bo)
> > {
> > kfree(bo);
> >+ bo = NULL;
> > }
> > static inline int ttm_mem_type_from_place(const struct ttm_place *place,
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-09-10 9:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 8:57 [PATCH 1/2] drm/ttm: set ttm_buffer_object pointer as null after it's freed Huang Rui
[not found] ` <1536569876-27262-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2018-09-10 8:57 ` [PATCH 2/2] drm/amdgpu: set tbo pointer as null after amdgpu bo is freed Huang Rui
2018-09-10 9:00 ` [PATCH 1/2] drm/ttm: set ttm_buffer_object pointer as null after it's freed Christian König
[not found] ` <d40314d2-f1c4-b353-bda6-50aed5dda8db-5C7GfCeVMHo@public.gmane.org>
2018-09-10 9:23 ` Huang Rui [this message]
2018-09-10 9:25 ` Christian König
2018-09-10 11:58 ` Huang Rui
2018-09-10 12:05 ` Huang Rui
2018-09-10 12:49 ` Christian König
[not found] ` <746c5afd-9264-7dfa-4e3c-425ea82453ff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-10 12:59 ` Tom St Denis
[not found] ` <382aab77-b9e2-1d18-ecd8-cd763227e5d0-5C7GfCeVMHo@public.gmane.org>
2018-09-10 13:04 ` Christian König
[not found] ` <c26b96d6-a9b2-8609-4779-bf1f25402fe7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-10 13:05 ` Tom St Denis
[not found] ` <1e1de90f-dc8c-4395-2375-3351f06d80b4-5C7GfCeVMHo@public.gmane.org>
2018-09-10 13:10 ` Christian König
[not found] ` <6d66a7c9-5904-2b23-4a65-f4995753009d-5C7GfCeVMHo@public.gmane.org>
2018-09-11 7:34 ` Huang Rui
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=20180910092320.GA22247@hr-amur2 \
--to=ray.huang-5c7gfcevmho@public.gmane.org \
--cc=Tom.StDenis-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox