From: "Das, Nirmoy" <nirmoy.das@linux.intel.com>
To: "Gupta, Anshuman" <anshuman.gupta@intel.com>,
"Das, Nirmoy" <nirmoy.das@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Cc: "Auld, Matthew" <matthew.auld@intel.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Do not dereference NULL bo->resource
Date: Tue, 20 Sep 2022 10:13:19 +0200 [thread overview]
Message-ID: <b169cc9f-a272-7d2a-da61-82470b5eaeb2@linux.intel.com> (raw)
In-Reply-To: <CY5PR11MB62113BCB450D45C1DC8201DD954D9@CY5PR11MB6211.namprd11.prod.outlook.com>
On 9/19/2022 5:29 PM, Gupta, Anshuman wrote:
>
>> -----Original Message-----
>> From: Das, Nirmoy <nirmoy.das@intel.com>
>> Sent: Monday, September 19, 2022 8:33 PM
>> To: intel-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org; Auld, Matthew
>> <matthew.auld@intel.com>; Gupta, Anshuman <anshuman.gupta@intel.com>
>> Subject: [PATCH] drm/i915: Do not dereference NULL bo->resource
>>
>> bo->resource could be NULL hence add a NULL check for resource before
>> bo->dereferencing it.
> Will bo->resource will be NULL only in case of object is smem or it can be NULL even in lmem case as well ?
It can happen with lmem too. I think we should just use
i915_gem_object_is_lmem() instead of i915_ttm_cpu_maps_iomem here.
Nirmoy
> Thanks,
> Anshuman Gupta.
>> References: https://gitlab.freedesktop.org/drm/intel/-/issues/6850
>> Fixes: ad74457a6b5a96 ("drm/i915/dgfx: Release mmap on rpm suspend")
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>> drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>> b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>> index 0544b0a4a43a..8608801cd9ab 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>> @@ -513,7 +513,7 @@ static void i915_ttm_delete_mem_notify(struct
>> ttm_buffer_object *bo)
>>
>> if (likely(obj)) {
>> /* ttm_bo_release() already has dma_resv_lock */
>> - if (i915_ttm_cpu_maps_iomem(bo->resource))
>> + if (bo->resource && i915_ttm_cpu_maps_iomem(bo-
>>> resource))
>> wakeref = intel_runtime_pm_get(&to_i915(obj-
>>> base.dev)->runtime_pm);
>> __i915_gem_object_pages_fini(obj);
>> --
>> 2.37.3
next prev parent reply other threads:[~2022-09-20 8:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 15:02 [Intel-gfx] [PATCH] drm/i915: Do not dereference NULL bo->resource Nirmoy Das
2022-09-19 15:29 ` Gupta, Anshuman
2022-09-20 8:13 ` Das, Nirmoy [this message]
2022-09-19 23:32 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-09-20 7:46 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=b169cc9f-a272-7d2a-da61-82470b5eaeb2@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=anshuman.gupta@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=nirmoy.das@intel.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