From: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
To: Ruoyu Wang <ruoyuw560@gmail.com>,
zack.rusin@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/vmwgfx: Handle MOBs without page-table BOs
Date: Tue, 7 Jul 2026 18:46:23 -0700 [thread overview]
Message-ID: <cf87fcef-2689-41b6-9e0c-3c26253ca278@broadcom.com> (raw)
In-Reply-To: <20260707150544.2272933-1-ruoyuw560@gmail.com>
On 7/7/26 8:05 AM, Ruoyu Wang wrote:
> Single-page MOBs and small OTable bases use depth-0 page-table entries
> and do not allocate a page-table BO. Their existing teardown paths were
> written to tolerate that by checking a local BO pointer before reserving
> or fencing it.
>
> Commit 668b206601c5 ("drm/vmwgfx: Stop using raw ttm_buffer_object's")
> changed pt_bo from a raw TTM buffer object pointer to a vmwgfx BO pointer
> and converted those local BO initializers to &pt_bo->tbo. That
> dereferences pt_bo before the existing NULL checks, so depth-0 MOBs can
> crash during OTable teardown or MOB unbind.
>
> Keep the previous conditional behavior by deriving the TTM BO only when
> the MOB has a page-table BO.
>
> This issue was found by a static analysis checker and confirmed by
> manual source review.
>
> Fixes: 668b206601c5 ("drm/vmwgfx: Stop using raw ttm_buffer_object's")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> index de7a504de9ce5..7cfd96e6e3489 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> @@ -204,7 +204,9 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv,
> if (otable->page_table == NULL)
> return;
>
> - bo = &otable->page_table->pt_bo->tbo;
> + bo = NULL;
You can initialize bo as NULL, like in vmw_mob_unbind().
> + if (otable->page_table->pt_bo)
> + bo = &otable->page_table->pt_bo->tbo;
> cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
> if (unlikely(cmd == NULL))
> return;
> @@ -555,7 +557,10 @@ void vmw_mob_unbind(struct vmw_private *dev_priv,
> SVGA3dCmdDestroyGBMob body;
> } *cmd;
> int ret;
> - struct ttm_buffer_object *bo = &mob->pt_bo->tbo;
> + struct ttm_buffer_object *bo = NULL;
> +
> + if (mob->pt_bo)
> + bo = &mob->pt_bo->tbo;
>
> if (bo) {
> ret = ttm_bo_reserve(bo, false, true, NULL);
--
Maaz Mombasawala <maaz.mombasawala@broadcom.com>
next prev parent reply other threads:[~2026-07-08 1:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 15:05 Ruoyu Wang
2026-07-08 1:46 ` Maaz Mombasawala [this message]
2026-07-08 3:35 ` Zack Rusin
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=cf87fcef-2689-41b6-9e0c-3c26253ca278@broadcom.com \
--to=maaz.mombasawala@broadcom.com \
--cc=airlied@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ruoyuw560@gmail.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=zack.rusin@broadcom.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
all inboxes | Powered by JetHome®