public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	jason@jlekstrand.net, Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Fix bug in user proto-context creation that leaked contexts
Date: Tue, 5 Oct 2021 10:25:53 +0100	[thread overview]
Message-ID: <3ce7b650-ef10-66e1-1370-99b0522909d4@linux.intel.com> (raw)
In-Reply-To: <20211001154859.GA5892@jons-linux-dev-box>


On 01/10/2021 16:48, Matthew Brost wrote:
> On Fri, Oct 01, 2021 at 09:40:19AM +0100, Tvrtko Ursulin wrote:
>>
>> + Daniel as reviewer and maybe merge, avoid falling through cracks at least.
>>
> 
> Ty, working on push rights myself.

I ended up pushing it myself to avoid having a potential crash in the 
driver for too long. Hope people will not mind.

Regards,

Tvrtko

>> On 22/09/2021 20:43, Matthew Brost wrote:
>>> Set number of engines before attempting to create contexts so the
>>> function free_engines can clean up properly. Also check return of
>>> alloc_engines for NULL.
>>>
>>> v2:
>>>    (Tvrtko)
>>>     - Send as stand alone patch
>>>    (John Harrison)
>>>     - Check for alloc_engines returning NULL
>>>
>>> Cc: Jason Ekstrand <jason@jlekstrand.net>
>>> Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
>>> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
>>> Cc: <stable@vger.kernel.org>
>>> ---
>>>    drivers/gpu/drm/i915/gem/i915_gem_context.c | 6 +++++-
>>>    1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
>>> index c2ab0e22db0a..9627c7aac6a3 100644
>>> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
>>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
>>> @@ -898,6 +898,11 @@ static struct i915_gem_engines *user_engines(struct i915_gem_context *ctx,
>>>    	unsigned int n;
>>>    	e = alloc_engines(num_engines);
>>> +	if (!e) {
>>> +		return ERR_PTR(-ENOMEM);
>>> +	}
>>
>> Ideally remove the braces and respin.
>>
> 
> Yep, checkpatch didn't like this. Will respin.
>   
>>> +	e->num_engines = num_engines;
>>
>> Theoretically you could have put it next to "e->engines[n] = ce" assignment
>> so the pattern is the same as in default_engines(). Kind of makes more sense
>> that the number is not set before anything is created, but as it doesn't
>> really matter since free_engines handles sparse arrays so there is argument
>> to have a simpler single assignment as well.
>>
> 
> I like a single assignment, let's not overthink this.
>   
>>> +
>>>    	for (n = 0; n < num_engines; n++) {
>>>    		struct intel_context *ce;
>>>    		int ret;
>>> @@ -931,7 +936,6 @@ static struct i915_gem_engines *user_engines(struct i915_gem_context *ctx,
>>>    			goto free_engines;
>>>    		}
>>>    	}
>>> -	e->num_engines = num_engines;
>>>    	return e;
>>>
>>
>> Fix looks good to me. I did not want to butt in but since more than a week
>> has passed without it getting noticed:
>>
> 
> Again, ty.
> 
> Matt
> 
>> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Regards,
>>
>> Tvrtko

  reply	other threads:[~2021-10-05  9:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 19:43 [Intel-gfx] [PATCH] drm/i915: Fix bug in user proto-context creation that leaked contexts Matthew Brost
2021-09-22 21:21 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-09-22 21:53 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-09-23  0:42 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-10-01  8:40 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
2021-10-01 15:48   ` Matthew Brost
2021-10-05  9:25     ` Tvrtko Ursulin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-01 15:58 Matthew Brost

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=3ce7b650-ef10-66e1-1370-99b0522909d4@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jason@jlekstrand.net \
    --cc=matthew.brost@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