All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Simon Richter <Simon.Richter@hogyros.de>
Cc: <intel-xe@lists.freedesktop.org>, <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v3] drm/ttm: Avoid NULL pointer deref for evicted BOs
Date: Mon, 13 Oct 2025 09:27:08 -0700	[thread overview]
Message-ID: <aO0oXPwaRa3RfmCU@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251013161241.709916-1-Simon.Richter@hogyros.de>

On Tue, Oct 14, 2025 at 01:11:33AM +0900, Simon Richter wrote:
> It is possible for a BO to exist that is not currently associated with a
> resource, e.g. because it has been evicted.
> 
> When devcoredump tries to read the contents of all BOs for dumping, we need
> to expect this as well -- in this case, ENODATA is recorded instead of the
> buffer contents.
> 
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6271

I think we need a fixes / cc stable but I can add that for you when merging.

Anyways patch LGTM:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> Signed-off-by: Simon Richter <Simon.Richter@hogyros.de>
> ---
>  drivers/gpu/drm/ttm/ttm_bo_vm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> index b47020fca199..a101ff95b234 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> @@ -434,6 +434,11 @@ int ttm_bo_access(struct ttm_buffer_object *bo, unsigned long offset,
>  	if (ret)
>  		return ret;
>  
> +	if (!bo->resource) {
> +		ret = -ENODATA;
> +		goto unlock;
> +	}
> +
>  	switch (bo->resource->mem_type) {
>  	case TTM_PL_SYSTEM:
>  		fallthrough;
> @@ -448,6 +453,7 @@ int ttm_bo_access(struct ttm_buffer_object *bo, unsigned long offset,
>  			ret = -EIO;
>  	}
>  
> +unlock:
>  	ttm_bo_unreserve(bo);
>  
>  	return ret;
> -- 
> 2.47.3
> 

  reply	other threads:[~2025-10-13 16:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-12 12:45 [PATCH 0/1] Avoid crash during dump when finding an evicted BO Simon Richter
2025-10-12 12:45 ` [PATCH 1/1] drm/ttm: Avoid NULL pointer deref for evicted BOs Simon Richter
2025-10-12 23:09   ` Matthew Brost
2025-10-13 16:02     ` [PATCH v2] " Simon Richter
2025-10-13 16:11       ` [PATCH v3] " Simon Richter
2025-10-13 16:27         ` Matthew Brost [this message]
2025-12-05 17:46           ` Lin, Shuicheng
2025-12-05 18:25             ` Matthew Brost
2025-12-08  7:54               ` Christian König
2025-10-12 12:52 ` ✗ CI.checkpatch: warning for Avoid crash during dump when finding an evicted BO Patchwork
2025-10-12 12:53 ` ✓ CI.KUnit: success " Patchwork
2025-10-12 13:35 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-12 14:47 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-13 18:03 ` ✓ CI.KUnit: success for Avoid crash during dump when finding an evicted BO (rev3) Patchwork
2025-10-13 18:39 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-13 22:03 ` ✗ Xe.CI.Full: failure " Patchwork

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=aO0oXPwaRa3RfmCU@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=Simon.Richter@hogyros.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.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.