* [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-15 5:42 ` Samuel Holland
0 siblings, 0 replies; 12+ messages in thread
From: Samuel Holland @ 2022-06-15 5:42 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Maxime Ripard
Cc: Samuel Holland, Daniel Vetter, David Airlie, Ondrej Jirman,
dri-devel, linux-arm-kernel, linux-kernel, linux-sunxi
If the component driver fails to bind, or is unbound, the driver data
for the top-level platform device points to a freed drm_device. If the
system is then suspended, the driver passes this dangling pointer to
drm_mode_config_helper_suspend(), which crashes.
Fix this by only setting the driver data while the platform driver holds
a reference to the drm_device.
Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display driver")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 275f7e4a03ae..8841dba989ee 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -73,7 +73,6 @@ static int sun4i_drv_bind(struct device *dev)
goto free_drm;
}
- dev_set_drvdata(dev, drm);
drm->dev_private = drv;
INIT_LIST_HEAD(&drv->frontend_list);
INIT_LIST_HEAD(&drv->engine_list);
@@ -114,6 +113,8 @@ static int sun4i_drv_bind(struct device *dev)
drm_fbdev_generic_setup(drm, 32);
+ dev_set_drvdata(dev, drm);
+
return 0;
finish_poll:
@@ -130,6 +131,7 @@ static void sun4i_drv_unbind(struct device *dev)
{
struct drm_device *drm = dev_get_drvdata(dev);
+ dev_set_drvdata(dev, NULL);
drm_dev_unregister(drm);
drm_kms_helper_poll_fini(drm);
drm_atomic_helper_shutdown(drm);
--
2.35.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-15 5:42 ` Samuel Holland
0 siblings, 0 replies; 12+ messages in thread
From: Samuel Holland @ 2022-06-15 5:42 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Maxime Ripard
Cc: Ondrej Jirman, Samuel Holland, David Airlie, linux-kernel,
dri-devel, linux-sunxi, linux-arm-kernel
If the component driver fails to bind, or is unbound, the driver data
for the top-level platform device points to a freed drm_device. If the
system is then suspended, the driver passes this dangling pointer to
drm_mode_config_helper_suspend(), which crashes.
Fix this by only setting the driver data while the platform driver holds
a reference to the drm_device.
Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display driver")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 275f7e4a03ae..8841dba989ee 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -73,7 +73,6 @@ static int sun4i_drv_bind(struct device *dev)
goto free_drm;
}
- dev_set_drvdata(dev, drm);
drm->dev_private = drv;
INIT_LIST_HEAD(&drv->frontend_list);
INIT_LIST_HEAD(&drv->engine_list);
@@ -114,6 +113,8 @@ static int sun4i_drv_bind(struct device *dev)
drm_fbdev_generic_setup(drm, 32);
+ dev_set_drvdata(dev, drm);
+
return 0;
finish_poll:
@@ -130,6 +131,7 @@ static void sun4i_drv_unbind(struct device *dev)
{
struct drm_device *drm = dev_get_drvdata(dev);
+ dev_set_drvdata(dev, NULL);
drm_dev_unregister(drm);
drm_kms_helper_poll_fini(drm);
drm_atomic_helper_shutdown(drm);
--
2.35.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-15 5:42 ` Samuel Holland
0 siblings, 0 replies; 12+ messages in thread
From: Samuel Holland @ 2022-06-15 5:42 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Maxime Ripard
Cc: Samuel Holland, Daniel Vetter, David Airlie, Ondrej Jirman,
dri-devel, linux-arm-kernel, linux-kernel, linux-sunxi
If the component driver fails to bind, or is unbound, the driver data
for the top-level platform device points to a freed drm_device. If the
system is then suspended, the driver passes this dangling pointer to
drm_mode_config_helper_suspend(), which crashes.
Fix this by only setting the driver data while the platform driver holds
a reference to the drm_device.
Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display driver")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 275f7e4a03ae..8841dba989ee 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -73,7 +73,6 @@ static int sun4i_drv_bind(struct device *dev)
goto free_drm;
}
- dev_set_drvdata(dev, drm);
drm->dev_private = drv;
INIT_LIST_HEAD(&drv->frontend_list);
INIT_LIST_HEAD(&drv->engine_list);
@@ -114,6 +113,8 @@ static int sun4i_drv_bind(struct device *dev)
drm_fbdev_generic_setup(drm, 32);
+ dev_set_drvdata(dev, drm);
+
return 0;
finish_poll:
@@ -130,6 +131,7 @@ static void sun4i_drv_unbind(struct device *dev)
{
struct drm_device *drm = dev_get_drvdata(dev);
+ dev_set_drvdata(dev, NULL);
drm_dev_unregister(drm);
drm_kms_helper_poll_fini(drm);
drm_atomic_helper_shutdown(drm);
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
2022-06-15 5:42 ` Samuel Holland
(?)
@ 2022-06-15 15:53 ` Jernej Škrabec
-1 siblings, 0 replies; 12+ messages in thread
From: Jernej Škrabec @ 2022-06-15 15:53 UTC (permalink / raw)
To: Chen-Yu Tsai, Maxime Ripard, Samuel Holland
Cc: Samuel Holland, Daniel Vetter, David Airlie, Ondrej Jirman,
dri-devel, linux-arm-kernel, linux-kernel, linux-sunxi
Dne sreda, 15. junij 2022 ob 07:42:53 CEST je Samuel Holland napisal(a):
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display
driver")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-15 15:53 ` Jernej Škrabec
0 siblings, 0 replies; 12+ messages in thread
From: Jernej Škrabec @ 2022-06-15 15:53 UTC (permalink / raw)
To: Chen-Yu Tsai, Maxime Ripard, Samuel Holland
Cc: Ondrej Jirman, Samuel Holland, David Airlie, linux-kernel,
dri-devel, linux-sunxi, linux-arm-kernel
Dne sreda, 15. junij 2022 ob 07:42:53 CEST je Samuel Holland napisal(a):
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display
driver")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-15 15:53 ` Jernej Škrabec
0 siblings, 0 replies; 12+ messages in thread
From: Jernej Škrabec @ 2022-06-15 15:53 UTC (permalink / raw)
To: Chen-Yu Tsai, Maxime Ripard, Samuel Holland
Cc: Samuel Holland, Daniel Vetter, David Airlie, Ondrej Jirman,
dri-devel, linux-arm-kernel, linux-kernel, linux-sunxi
Dne sreda, 15. junij 2022 ob 07:42:53 CEST je Samuel Holland napisal(a):
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display
driver")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
2022-06-15 5:42 ` Samuel Holland
(?)
@ 2022-06-16 7:51 ` Maxime Ripard
-1 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2022-06-16 7:51 UTC (permalink / raw)
To: Samuel Holland
Cc: Chen-Yu Tsai, Jernej Skrabec, Daniel Vetter, David Airlie,
Ondrej Jirman, dri-devel, linux-arm-kernel, linux-kernel,
linux-sunxi
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]
Hi,
On Wed, Jun 15, 2022 at 12:42:53AM -0500, Samuel Holland wrote:
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display driver")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Yeah, it's far from the only issue regarding structure lifetimes in the
driver.
We should convert as much as possible to the DRM-managed functions to
fix those.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-16 7:51 ` Maxime Ripard
0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2022-06-16 7:51 UTC (permalink / raw)
To: Samuel Holland
Cc: Ondrej Jirman, David Airlie, linux-kernel, dri-devel,
Chen-Yu Tsai, Jernej Skrabec, linux-sunxi, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 780 bytes --]
Hi,
On Wed, Jun 15, 2022 at 12:42:53AM -0500, Samuel Holland wrote:
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display driver")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Yeah, it's far from the only issue regarding structure lifetimes in the
driver.
We should convert as much as possible to the DRM-managed functions to
fix those.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-16 7:51 ` Maxime Ripard
0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2022-06-16 7:51 UTC (permalink / raw)
To: Samuel Holland
Cc: Chen-Yu Tsai, Jernej Skrabec, Daniel Vetter, David Airlie,
Ondrej Jirman, dri-devel, linux-arm-kernel, linux-kernel,
linux-sunxi
[-- Attachment #1.1: Type: text/plain, Size: 780 bytes --]
Hi,
On Wed, Jun 15, 2022 at 12:42:53AM -0500, Samuel Holland wrote:
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> Fixes: 624b4b48d9d8 ("drm: sun4i: Add support for suspending the display driver")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Yeah, it's far from the only issue regarding structure lifetimes in the
driver.
We should convert as much as possible to the DRM-managed functions to
fix those.
Maxime
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
2022-06-15 5:42 ` Samuel Holland
(?)
@ 2022-06-16 7:53 ` Maxime Ripard
-1 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2022-06-16 7:53 UTC (permalink / raw)
To: Chen-Yu Tsai, Samuel Holland, Maxime Ripard, Jernej Skrabec
Cc: Maxime Ripard, linux-sunxi, Ondrej Jirman, dri-devel,
linux-arm-kernel, David Airlie, linux-kernel, Daniel Vetter
On Wed, 15 Jun 2022 00:42:53 -0500, Samuel Holland wrote:
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> [...]
Applied to drm/drm-misc (drm-misc-fixes).
Thanks!
Maxime
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-16 7:53 ` Maxime Ripard
0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2022-06-16 7:53 UTC (permalink / raw)
To: Chen-Yu Tsai, Samuel Holland, Maxime Ripard, Jernej Skrabec
Cc: Ondrej Jirman, David Airlie, linux-kernel, dri-devel,
Maxime Ripard, linux-sunxi, linux-arm-kernel
On Wed, 15 Jun 2022 00:42:53 -0500, Samuel Holland wrote:
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> [...]
Applied to drm/drm-misc (drm-misc-fixes).
Thanks!
Maxime
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/sun4i: Fix crash during suspend after component bind failure
@ 2022-06-16 7:53 ` Maxime Ripard
0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2022-06-16 7:53 UTC (permalink / raw)
To: Chen-Yu Tsai, Samuel Holland, Maxime Ripard, Jernej Skrabec
Cc: Maxime Ripard, linux-sunxi, Ondrej Jirman, dri-devel,
linux-arm-kernel, David Airlie, linux-kernel, Daniel Vetter
On Wed, 15 Jun 2022 00:42:53 -0500, Samuel Holland wrote:
> If the component driver fails to bind, or is unbound, the driver data
> for the top-level platform device points to a freed drm_device. If the
> system is then suspended, the driver passes this dangling pointer to
> drm_mode_config_helper_suspend(), which crashes.
>
> Fix this by only setting the driver data while the platform driver holds
> a reference to the drm_device.
>
> [...]
Applied to drm/drm-misc (drm-misc-fixes).
Thanks!
Maxime
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-06-16 8:02 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 5:42 [PATCH] drm/sun4i: Fix crash during suspend after component bind failure Samuel Holland
2022-06-15 5:42 ` Samuel Holland
2022-06-15 5:42 ` Samuel Holland
2022-06-15 15:53 ` Jernej Škrabec
2022-06-15 15:53 ` Jernej Škrabec
2022-06-15 15:53 ` Jernej Škrabec
2022-06-16 7:51 ` Maxime Ripard
2022-06-16 7:51 ` Maxime Ripard
2022-06-16 7:51 ` Maxime Ripard
2022-06-16 7:53 ` Maxime Ripard
2022-06-16 7:53 ` Maxime Ripard
2022-06-16 7:53 ` Maxime Ripard
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.