mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Koenig, Christian" <Christian.Koenig@amd.com>
To: "Das, Nirmoy" <Nirmoy.Das@amd.com>,
	Nirmoy Das <nirmoy.aiemd@gmail.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>
Cc: "airlied@linux.ie" <airlied@linux.ie>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: fix memory leak
Date: Fri, 4 Oct 2019 11:13:29 +0000	[thread overview]
Message-ID: <4d665d18-2109-675e-dd69-c15bd0b2a011@amd.com> (raw)
In-Reply-To: <32afa408-0968-2d1a-5add-593907636592@amd.com>

Am 04.10.19 um 13:00 schrieb Das, Nirmoy:
> On 10/4/19 12:44 PM, Koenig, Christian wrote:
>> First of all please send mails regarding amdgpu to the amd-gfx mailing
>> list and not lkml/dri-devel.
> Okay.
>> Am 04.10.19 um 12:17 schrieb Nirmoy Das:
>>> In amdgpu_bo_list_ioctl when idr_alloc fails
>>> don't return without freeing bo list entry.
>>>
>>> Fixes: 964d0fbf6301d ("drm/amdgpu: Allow to create BO lists in CS ioctl v3")
>>>
>>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>>> ---
>>>     drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +-
>>>     1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
>>> index 7bcf86c61999..c3e5ea544857 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
>>> @@ -284,7 +284,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
>>>     		mutex_unlock(&fpriv->bo_list_lock);
>>>     		if (r < 0) {
>>>     			amdgpu_bo_list_put(list);
>>> -			return r;
>>> +			goto error_free;
>> NAK, that is a double free. The bo list entries are freed by
>> amdgpu_bo_list_put().
> Thanks, didn't realize that.

Wait a second, what entries are you talking about?

The entries in the list object are freed when amdgpu_bo_list_put() is 
called, but the temporary info array with the handles needs to be freed 
as well.

And it looks like that is indeed leaked here.

Regards,
Christian.

>> Regards,
>> Christian.
> Regards,
>
> Nirmoy
>
>>>     		}
>>>     
>>>     		handle = r;


  reply	other threads:[~2019-10-04 11:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 10:17 Nirmoy Das
2019-10-04 10:44 ` Koenig, Christian
2019-10-04 11:00   ` Nirmoy
2019-10-04 11:13     ` Koenig, Christian [this message]
2019-10-04 11:26       ` Nirmoy
2019-10-04 11:30         ` Koenig, Christian
2019-10-04 11:36           ` Nirmoy
  -- strict thread matches above, loose matches on Subject: below --
2015-09-18  8:46 Sudip Mukherjee

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=4d665d18-2109-675e-dd69-c15bd0b2a011@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Nirmoy.Das@amd.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nirmoy.aiemd@gmail.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®