All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Yang Li <yang.lee@linux.alibaba.com>, alexander.deucher@amd.com
Cc: christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com,
	daniel@ffwll.ch, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH -next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram()
Date: Wed, 26 Oct 2022 16:37:47 -0400	[thread overview]
Message-ID: <010a38ff-591b-b1b7-8f81-0b580a41b69e@amd.com> (raw)
In-Reply-To: <20221026020054.57114-1-yang.lee@linux.alibaba.com>

On 2022-10-25 22:00, Yang Li wrote:
> ./drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:985:58-62: ERROR: p is NULL but dereferenced.
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2549
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

The patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

I applied to our amd-staging-drm-next branch.

Thanks,
   Felix


> ---
>
> change in v2:
> According to Felix's suggestion, move the pr_debug up before the kfd_unref_process
> call.
>
>   drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 20d6b2578927..b9c8d29d95aa 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -978,12 +978,10 @@ static vm_fault_t svm_migrate_to_ram(struct vm_fault *vmf)
>   out_unlock_svms:
>   	mutex_unlock(&p->svms.lock);
>   out_unref_process:
> +	pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr);
>   	kfd_unref_process(p);
>   out_mmput:
>   	mmput(mm);
> -
> -	pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr);
> -
>   	return r ? VM_FAULT_SIGBUS : 0;
>   }
>   

WARNING: multiple messages have this Message-ID (diff)
From: Felix Kuehling <felix.kuehling@amd.com>
To: Yang Li <yang.lee@linux.alibaba.com>, alexander.deucher@amd.com
Cc: Xinhui.Pan@amd.com, Abaci Robot <abaci@linux.alibaba.com>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, christian.koenig@amd.com
Subject: Re: [PATCH -next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram()
Date: Wed, 26 Oct 2022 16:37:47 -0400	[thread overview]
Message-ID: <010a38ff-591b-b1b7-8f81-0b580a41b69e@amd.com> (raw)
In-Reply-To: <20221026020054.57114-1-yang.lee@linux.alibaba.com>

On 2022-10-25 22:00, Yang Li wrote:
> ./drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:985:58-62: ERROR: p is NULL but dereferenced.
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2549
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

The patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

I applied to our amd-staging-drm-next branch.

Thanks,
   Felix


> ---
>
> change in v2:
> According to Felix's suggestion, move the pr_debug up before the kfd_unref_process
> call.
>
>   drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 20d6b2578927..b9c8d29d95aa 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -978,12 +978,10 @@ static vm_fault_t svm_migrate_to_ram(struct vm_fault *vmf)
>   out_unlock_svms:
>   	mutex_unlock(&p->svms.lock);
>   out_unref_process:
> +	pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr);
>   	kfd_unref_process(p);
>   out_mmput:
>   	mmput(mm);
> -
> -	pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr);
> -
>   	return r ? VM_FAULT_SIGBUS : 0;
>   }
>   

WARNING: multiple messages have this Message-ID (diff)
From: Felix Kuehling <felix.kuehling@amd.com>
To: Yang Li <yang.lee@linux.alibaba.com>, alexander.deucher@amd.com
Cc: Xinhui.Pan@amd.com, Abaci Robot <abaci@linux.alibaba.com>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
	airlied@gmail.com, christian.koenig@amd.com
Subject: Re: [PATCH -next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram()
Date: Wed, 26 Oct 2022 16:37:47 -0400	[thread overview]
Message-ID: <010a38ff-591b-b1b7-8f81-0b580a41b69e@amd.com> (raw)
In-Reply-To: <20221026020054.57114-1-yang.lee@linux.alibaba.com>

On 2022-10-25 22:00, Yang Li wrote:
> ./drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:985:58-62: ERROR: p is NULL but dereferenced.
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2549
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

The patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

I applied to our amd-staging-drm-next branch.

Thanks,
   Felix


> ---
>
> change in v2:
> According to Felix's suggestion, move the pr_debug up before the kfd_unref_process
> call.
>
>   drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 20d6b2578927..b9c8d29d95aa 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -978,12 +978,10 @@ static vm_fault_t svm_migrate_to_ram(struct vm_fault *vmf)
>   out_unlock_svms:
>   	mutex_unlock(&p->svms.lock);
>   out_unref_process:
> +	pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr);
>   	kfd_unref_process(p);
>   out_mmput:
>   	mmput(mm);
> -
> -	pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr);
> -
>   	return r ? VM_FAULT_SIGBUS : 0;
>   }
>   

  reply	other threads:[~2022-10-26 20:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  2:00 [PATCH -next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram() Yang Li
2022-10-26  2:00 ` Yang Li
2022-10-26  2:00 ` Yang Li
2022-10-26 20:37 ` Felix Kuehling [this message]
2022-10-26 20:37   ` Felix Kuehling
2022-10-26 20:37   ` Felix Kuehling
  -- strict thread matches above, loose matches on Subject: below --
2022-10-25  7:28 Yang Li
2022-10-25  7:28 ` Yang Li
2022-10-25  7:28 ` Yang Li
2022-10-25 19:39 ` Felix Kuehling
2022-10-25 19:39   ` Felix Kuehling
2022-10-25 19:39   ` Felix Kuehling

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=010a38ff-591b-b1b7-8f81-0b580a41b69e@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=abaci@linux.alibaba.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yang.lee@linux.alibaba.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 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.