mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Pierre-Eric Pelloux-Prayer <pierre-eric@damsy.net>,
	Mohammed Anees <pvmohammedanees2003@gmail.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Xinhui Pan <Xinhui.Pan@amd.com>, David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>,
	Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
	David Wu <David.Wu3@amd.com>,
	Felix Kuehling <felix.kuehling@amd.com>
Subject: Re: [PATCH] drm/amdgpu: prevent BO_HANDLES error from being overwritten
Date: Wed, 9 Oct 2024 12:34:24 +0200	[thread overview]
Message-ID: <8588f179-9a69-44c3-aedc-0670ef948068@amd.com> (raw)
In-Reply-To: <d9a3fee4-bb14-4162-95b1-06177d0a9949@damsy.net>

Am 09.10.24 um 10:22 schrieb Pierre-Eric Pelloux-Prayer:
> Hi,
>
> Le 05/10/2024 à 01:59, Mohammed Anees a écrit :
>> Before this patch, if multiple BO_HANDLES chunks were submitted,
>> the error -EINVAL would be correctly set but could be overwritten
>> by the return value from amdgpu_cs_p1_bo_handles(). This patch
>> ensures that once an error condition is detected, the function
>> returns immediately, avoiding the overwriting of the error code.
>>
>> Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 1e475eb01417..543db0df9a31 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -266,8 +266,9 @@ static int amdgpu_cs_pass1(struct 
>> amdgpu_cs_parser *p,
>>               /* Only a single BO list is allowed to simplify 
>> handling. */
>>               if (p->bo_list)
>>                   ret = -EINVAL;
>> +            else
>> +                ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
>>   -            ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
>
> My bad, I've merged the wrong version of the patch.
>
> That being said, I think it'd be nicer to follow the same pattern as 
> the other checks and do:
>
>    if (p->bo_list)
>       goto free_partial_kdata;
>
> Since "ret" is initialized to -EINVAL already.
>
> Also can you add a reference to the broken commit in the commit message?
> Something like:
>
> Fixes: fec5f8e8c6bcf83 ("drm/amdgpu: disallow multiple BO_HANDLES 
> chunks in one submit")

Yeah agree with Pierre-Eric and also please add the same CC stable tag 
the original patch had so that it gets backported ASAP.

Thanks,
Christian.

>
> Thanks,
> Pierre-Eric
>
>>               if (ret)
>>                   goto free_partial_kdata;
>>               break;


  reply	other threads:[~2024-10-09 10:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-04 23:59 Mohammed Anees
2024-10-09  8:22 ` Pierre-Eric Pelloux-Prayer
2024-10-09 10:34   ` Christian König [this message]
2024-10-09 12:30   ` Mohammed Anees

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=8588f179-9a69-44c3-aedc-0670ef948068@amd.com \
    --to=christian.koenig@amd.com \
    --cc=David.Wu3@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-eric@damsy.net \
    --cc=pvmohammedanees2003@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=srinivasan.shanmugam@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

all inboxes | Powered by JetHome®