All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms
@ 2020-06-09  9:20 Liu ChengZhe
  2020-06-09 10:02 ` Nirmoy
  2020-06-09 11:00 ` Chauhan, Madhav
  0 siblings, 2 replies; 3+ messages in thread
From: Liu ChengZhe @ 2020-06-09  9:20 UTC (permalink / raw)
  To: amd-gfx; +Cc: Liu ChengZhe

if guest driver failed to enter full GPU access, amdgpu_driver_load_kms
will unload kms and free dev->dev_private, drm_dev_register would access
null pointer. Driver will enter an error state and can't be unloaded.

Signed-off-by: Liu ChengZhe <ChengZhe.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 667aad1f15c0..9c81a3d0b546 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1165,7 +1165,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 
 	pci_set_drvdata(pdev, dev);
 
-	amdgpu_driver_load_kms(dev, ent->driver_data);
+	ret = amdgpu_driver_load_kms(dev, ent->driver_data);
+	if (ret)
+		goto err_pci;
 
 retry_init:
 	ret = drm_dev_register(dev, ent->driver_data);
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms
  2020-06-09  9:20 [PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms Liu ChengZhe
@ 2020-06-09 10:02 ` Nirmoy
  2020-06-09 11:00 ` Chauhan, Madhav
  1 sibling, 0 replies; 3+ messages in thread
From: Nirmoy @ 2020-06-09 10:02 UTC (permalink / raw)
  To: amd-gfx

Acked-by: Nirmoy Das <nirmoy.das@amd.com>

On 6/9/20 11:20 AM, Liu ChengZhe wrote:
> if guest driver failed to enter full GPU access, amdgpu_driver_load_kms
> will unload kms and free dev->dev_private, drm_dev_register would access
> null pointer. Driver will enter an error state and can't be unloaded.
>
> Signed-off-by: Liu ChengZhe <ChengZhe.Liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 667aad1f15c0..9c81a3d0b546 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1165,7 +1165,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>   
>   	pci_set_drvdata(pdev, dev);
>   
> -	amdgpu_driver_load_kms(dev, ent->driver_data);
> +	ret = amdgpu_driver_load_kms(dev, ent->driver_data);
> +	if (ret)
> +		goto err_pci;
>   
>   retry_init:
>   	ret = drm_dev_register(dev, ent->driver_data);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* RE: [PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms
  2020-06-09  9:20 [PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms Liu ChengZhe
  2020-06-09 10:02 ` Nirmoy
@ 2020-06-09 11:00 ` Chauhan, Madhav
  1 sibling, 0 replies; 3+ messages in thread
From: Chauhan, Madhav @ 2020-06-09 11:00 UTC (permalink / raw)
  To: Liu, Cheng Zhe, amd-gfx; +Cc: Liu, Cheng Zhe

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Liu ChengZhe
Sent: Tuesday, June 9, 2020 2:50 PM
To: amd-gfx@lists.freedesktop.org
Cc: Liu, Cheng Zhe <ChengZhe.Liu@amd.com>
Subject: [PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms

[CAUTION: External Email]

if guest driver failed to enter full GPU access, amdgpu_driver_load_kms will unload kms and free dev->dev_private, drm_dev_register would access null pointer. Driver will enter an error state and can't be unloaded.

Signed-off-by: Liu ChengZhe <mailto:ChengZhe.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 667aad1f15c0..9c81a3d0b546 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1165,7 +1165,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,

        pci_set_drvdata(pdev, dev);

-       amdgpu_driver_load_kms(dev, ent->driver_data);
+       ret = amdgpu_driver_load_kms(dev, ent->driver_data);
+       if (ret)
+               goto err_pci;

Looks good to me. Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com>

 retry_init:
        ret = drm_dev_register(dev, ent->driver_data);
--
2.25.1

_______________________________________________
amd-gfx mailing list
mailto:amd-gfx@lists.freedesktop.org
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2020-06-09 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09  9:20 [PATCH] drm/amd/amdgpu: handle return value of amdgpu_driver_load_kms Liu ChengZhe
2020-06-09 10:02 ` Nirmoy
2020-06-09 11:00 ` Chauhan, Madhav

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.