amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.10 1/1] drm/amdgpu: Ensure the AMDGPU file descriptor is legitimate
@ 2022-04-12 15:20 Lee Jones
  2022-04-14 10:39 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Jones @ 2022-04-12 15:20 UTC (permalink / raw)
  To: lee.jones
  Cc: dri-devel, David Airlie, Felix Kuehling, stable, amd-gfx,
	Daniel Vetter, Alex Deucher, Christian König

[ Upstream commit b40a6ab2cf9213923bf8e821ce7fa7f6a0a26990 ]

This is a partial cherry-pick of the above upstream commit.

It ensures the file descriptor passed in by userspace is a valid one.

Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 26f8a21383774..1b4c7ced8b92c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1024,11 +1024,15 @@ int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
 					   struct dma_fence **ef)
 {
 	struct amdgpu_device *adev = get_amdgpu_device(kgd);
-	struct drm_file *drm_priv = filp->private_data;
-	struct amdgpu_fpriv *drv_priv = drm_priv->driver_priv;
-	struct amdgpu_vm *avm = &drv_priv->vm;
+	struct amdgpu_fpriv *drv_priv;
+	struct amdgpu_vm *avm;
 	int ret;
 
+	ret = amdgpu_file_to_fpriv(filp, &drv_priv);
+	if (ret)
+		return ret;
+	avm = &drv_priv->vm;
+
 	/* Already a compute VM? */
 	if (avm->process_info)
 		return -EINVAL;
-- 
2.35.1.1178.g4f1659d476-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 1/1] drm/amdgpu: Ensure the AMDGPU file descriptor is legitimate
  2022-04-12 15:20 [PATCH 5.10 1/1] drm/amdgpu: Ensure the AMDGPU file descriptor is legitimate Lee Jones
@ 2022-04-14 10:39 ` Greg KH
  2022-05-09 14:49   ` Lee Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2022-04-14 10:39 UTC (permalink / raw)
  To: Lee Jones
  Cc: dri-devel, David Airlie, Felix Kuehling, stable, amd-gfx,
	Daniel Vetter, Alex Deucher, Christian König

On Tue, Apr 12, 2022 at 04:20:57PM +0100, Lee Jones wrote:
> [ Upstream commit b40a6ab2cf9213923bf8e821ce7fa7f6a0a26990 ]
> 
> This is a partial cherry-pick of the above upstream commit.
> 
> It ensures the file descriptor passed in by userspace is a valid one.
> 
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 1/1] drm/amdgpu: Ensure the AMDGPU file descriptor is legitimate
  2022-04-14 10:39 ` Greg KH
@ 2022-05-09 14:49   ` Lee Jones
  2022-05-09 16:20     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Jones @ 2022-05-09 14:49 UTC (permalink / raw)
  To: Greg KH
  Cc: dri-devel, David Airlie, Felix Kuehling, stable, amd-gfx,
	Daniel Vetter, Alex Deucher, Christian König

On Thu, 14 Apr 2022, Greg KH wrote:

> On Tue, Apr 12, 2022 at 04:20:57PM +0100, Lee Jones wrote:
> > [ Upstream commit b40a6ab2cf9213923bf8e821ce7fa7f6a0a26990 ]
> > 
> > This is a partial cherry-pick of the above upstream commit.
> > 
> > It ensures the file descriptor passed in by userspace is a valid one.
> > 
> > Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: "Christian König" <christian.koenig@amd.com>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> Now queued up, thanks.

Could you also back-port this into v5.4 please?

FYI, in the v5.10.y tree, it's now called:

  f0c31f192f38c drm/amdkfd: Use drm_priv to pass VM from KFD to amdgpu

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 1/1] drm/amdgpu: Ensure the AMDGPU file descriptor is legitimate
  2022-05-09 14:49   ` Lee Jones
@ 2022-05-09 16:20     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-05-09 16:20 UTC (permalink / raw)
  To: Lee Jones
  Cc: dri-devel, David Airlie, Felix Kuehling, stable, amd-gfx,
	Daniel Vetter, Alex Deucher, Christian König

On Mon, May 09, 2022 at 03:49:03PM +0100, Lee Jones wrote:
> On Thu, 14 Apr 2022, Greg KH wrote:
> 
> > On Tue, Apr 12, 2022 at 04:20:57PM +0100, Lee Jones wrote:
> > > [ Upstream commit b40a6ab2cf9213923bf8e821ce7fa7f6a0a26990 ]
> > > 
> > > This is a partial cherry-pick of the above upstream commit.
> > > 
> > > It ensures the file descriptor passed in by userspace is a valid one.
> > > 
> > > Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: "Christian König" <christian.koenig@amd.com>
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > > ---
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 10 +++++++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > Now queued up, thanks.
> 
> Could you also back-port this into v5.4 please?
> 
> FYI, in the v5.10.y tree, it's now called:
> 
>   f0c31f192f38c drm/amdkfd: Use drm_priv to pass VM from KFD to amdgpu
> 

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-09 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 15:20 [PATCH 5.10 1/1] drm/amdgpu: Ensure the AMDGPU file descriptor is legitimate Lee Jones
2022-04-14 10:39 ` Greg KH
2022-05-09 14:49   ` Lee Jones
2022-05-09 16:20     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).