From: Pavel Skripkin <paskripkin@gmail.com>
To: "Christian König" <christian.koenig@amd.com>,
ray.huang@amd.com, airlied@linux.ie
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpu: ttm: fix GPF in ttm_bo_release
Date: Thu, 8 Jul 2021 13:09:10 +0300 [thread overview]
Message-ID: <20210708130910.63a15c73@gmail.com> (raw)
In-Reply-To: <20210708113701.4cea7989@gmail.com>
On Thu, 8 Jul 2021 11:37:01 +0300
Pavel Skripkin <paskripkin@gmail.com> wrote:
> On Thu, 8 Jul 2021 08:49:48 +0200
> Christian König <christian.koenig@amd.com> wrote:
>
> > Am 07.07.21 um 20:51 schrieb Pavel Skripkin:
> > > My local syzbot instance hit GPF in ttm_bo_release().
> > > Unfortunately, syzbot didn't produce a reproducer for this, but I
> > > found out possible scenario:
> > >
> > > drm_gem_vram_create() <-- drm_gem_vram_object kzalloced
> > > (bo embedded in this object)
> > > ttm_bo_init()
> > > ttm_bo_init_reserved()
> > > ttm_resource_alloc()
> > > man->func->alloc() <-- allocation failure
> > > ttm_bo_put()
> > > ttm_bo_release()
> > > ttm_mem_io_free() <-- bo->resource == NULL passed
> > > as second argument
> > > *GPF*
> > >
> > > So, I've added check in ttm_bo_release() to avoid passing
> > > NULL as second argument to ttm_mem_io_free().
>
> Hi, Christian!
>
> Thank you for quick feedback :)
>
> >
> > There is another ocassion of this a bit down before we call
> > ttm_bo_move_to_lru_tail() apart from that good catch.
> >
>
> Did you mean, that ttm_bo_move_to_lru_tail() should have NULL check
> too? I checked it's realization, and, I think, NULL check is necessary
> there, since mem pointer is dereferenced w/o any checking
>
> > But I'm wondering if we should make the functions NULL save instead
> > of the external check.
> >
>
> I tried to find more possible scenarios of GPF in ttm_bo_release(),
> but I didn't find one. But, yes, moving NULL check inside
> ttm_mem_io_free() is more general approach and it will defend this
> function from GPFs in the future.
>
>
>
> With regards,
> Pavel Skripkin
>
I misclicked and sent this email to Christian privately :(
Added all thread participants back, sorry.
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2021-07-08 10:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 18:51 [PATCH] gpu: ttm: fix GPF in ttm_bo_release Pavel Skripkin
2021-07-08 6:49 ` Christian König
[not found] ` <20210708113701.4cea7989@gmail.com>
2021-07-08 10:09 ` Pavel Skripkin [this message]
2021-07-08 10:56 ` Christian König
2021-07-08 11:04 ` Pavel Skripkin
2021-07-08 11:25 ` [PATCH v2] gpu: ttm: add missing NULL checks Pavel Skripkin
2021-07-08 11:29 ` Christian König
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=20210708130910.63a15c73@gmail.com \
--to=paskripkin@gmail.com \
--cc=airlied@linux.ie \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ray.huang@amd.com \
/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