* [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-22 19:48 ` [Freedreno] " Kuogee Hsieh
2022-09-22 20:01 ` Kuogee Hsieh
2022-09-13 8:53 ` [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges Johan Hovold
` (6 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
The bridge counter was never reset when tearing down the DRM device so
that stale pointers to deallocated structures would be accessed on the
next tear down (e.g. after a second late bind deferral).
Given enough bridges and a few probe deferrals this could currently also
lead to data beyond the bridge array being corrupted.
Fixes: d28ea556267c ("drm/msm: properly add and remove internal bridges")
Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
Cc: stable@vger.kernel.org # 3.12
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/msm_drv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 391d86b54ded..d254fe2507ec 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -241,6 +241,7 @@ static int msm_drm_uninit(struct device *dev)
for (i = 0; i < priv->num_bridges; i++)
drm_bridge_remove(priv->bridges[i]);
+ priv->num_bridges = 0;
pm_runtime_get_sync(dev);
msm_irq_uninstall(ddev);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [Freedreno] [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral
2022-09-13 8:53 ` [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral Johan Hovold
@ 2022-09-22 19:48 ` Kuogee Hsieh
2022-09-22 20:01 ` Kuogee Hsieh
1 sibling, 0 replies; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 19:48 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: dri-devel, Neil Armstrong, Daniel Vetter, Jonas Karlman,
linux-arm-msm, Bjorn Andersson, freedreno, linux-kernel,
Jernej Skrabec, Stephen Boyd, Robert Foss, Andrzej Hajda,
Manivannan Sadhasivam, stable, Sean Paul, Steev Klimaszewski,
Laurent Pinchart
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> The bridge counter was never reset when tearing down the DRM device so
> that stale pointers to deallocated structures would be accessed on the
> next tear down (e.g. after a second late bind deferral).
>
> Given enough bridges and a few probe deferrals this could currently also
> lead to data beyond the bridge array being corrupted.
>
> Fixes: d28ea556267c ("drm/msm: properly add and remove internal bridges")
> Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
> Cc: stable@vger.kernel.org # 3.12
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/msm_drv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 391d86b54ded..d254fe2507ec 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -241,6 +241,7 @@ static int msm_drm_uninit(struct device *dev)
>
> for (i = 0; i < priv->num_bridges; i++)
> drm_bridge_remove(priv->bridges[i]);
> + priv->num_bridges = 0;
>
> pm_runtime_get_sync(dev);
> msm_irq_uninstall(ddev);
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Freedreno] [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral
2022-09-13 8:53 ` [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral Johan Hovold
2022-09-22 19:48 ` [Freedreno] " Kuogee Hsieh
@ 2022-09-22 20:01 ` Kuogee Hsieh
1 sibling, 0 replies; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 20:01 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: dri-devel, Neil Armstrong, Daniel Vetter, Jonas Karlman,
linux-arm-msm, Bjorn Andersson, freedreno, linux-kernel,
Jernej Skrabec, Stephen Boyd, Robert Foss, Andrzej Hajda,
Manivannan Sadhasivam, stable, Sean Paul, Steev Klimaszewski,
Laurent Pinchart
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> The bridge counter was never reset when tearing down the DRM device so
> that stale pointers to deallocated structures would be accessed on the
> next tear down (e.g. after a second late bind deferral).
>
> Given enough bridges and a few probe deferrals this could currently also
> lead to data beyond the bridge array being corrupted.
>
> Fixes: d28ea556267c ("drm/msm: properly add and remove internal bridges")
> Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
> Cc: stable@vger.kernel.org # 3.12
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/msm_drv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 391d86b54ded..d254fe2507ec 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -241,6 +241,7 @@ static int msm_drm_uninit(struct device *dev)
>
> for (i = 0; i < priv->num_bridges; i++)
> drm_bridge_remove(priv->bridges[i]);
> + priv->num_bridges = 0;
>
> pm_runtime_get_sync(dev);
> msm_irq_uninstall(ddev);
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
2022-09-13 8:53 ` [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral Johan Hovold
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-22 19:51 ` [Freedreno] " Kuogee Hsieh
2022-09-22 19:54 ` Dmitry Baryshkov
2022-09-13 8:53 ` [PATCH v2 03/10] drm/msm/dsi: " Johan Hovold
` (5 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
Add the missing sanity check on the bridge counter to avoid corrupting
data beyond the fixed-sized bridge array in case there are ever more
than eight bridges.
Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable")
Cc: stable@vger.kernel.org # 5.17
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 3e284fed8d30..fbe950edaefe 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1604,6 +1604,12 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
return -EINVAL;
priv = dev->dev_private;
+
+ if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
+ DRM_DEV_ERROR(dev->dev, "too many bridges\n");
+ return -ENOSPC;
+ }
+
dp_display->drm_dev = dev;
dp_priv = container_of(dp_display, struct dp_display_private, dp_display);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [Freedreno] [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges
2022-09-13 8:53 ` [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges Johan Hovold
@ 2022-09-22 19:51 ` Kuogee Hsieh
2022-09-22 19:54 ` Dmitry Baryshkov
1 sibling, 0 replies; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 19:51 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: dri-devel, Neil Armstrong, Daniel Vetter, Jonas Karlman,
linux-arm-msm, Bjorn Andersson, freedreno, linux-kernel,
Jernej Skrabec, Stephen Boyd, Robert Foss, Andrzej Hajda,
Manivannan Sadhasivam, stable, Sean Paul, Steev Klimaszewski,
Laurent Pinchart
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> Add the missing sanity check on the bridge counter to avoid corrupting
> data beyond the fixed-sized bridge array in case there are ever more
> than eight bridges.
>
> Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable")
> Cc: stable@vger.kernel.org # 5.17
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 3e284fed8d30..fbe950edaefe 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1604,6 +1604,12 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
> return -EINVAL;
>
> priv = dev->dev_private;
> +
> + if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
> + DRM_DEV_ERROR(dev->dev, "too many bridges\n");
> + return -ENOSPC;
> + }
> +
> dp_display->drm_dev = dev;
>
> dp_priv = container_of(dp_display, struct dp_display_private, dp_display);
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges
2022-09-13 8:53 ` [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges Johan Hovold
2022-09-22 19:51 ` [Freedreno] " Kuogee Hsieh
@ 2022-09-22 19:54 ` Dmitry Baryshkov
1 sibling, 0 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2022-09-22 19:54 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, stable
On 13/09/2022 11:53, Johan Hovold wrote:
> Add the missing sanity check on the bridge counter to avoid corrupting
> data beyond the fixed-sized bridge array in case there are ever more
> than eight bridges.
>
> Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable")
> Cc: stable@vger.kernel.org # 5.17
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 03/10] drm/msm/dsi: fix memory corruption with too many bridges
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
2022-09-13 8:53 ` [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral Johan Hovold
2022-09-13 8:53 ` [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges Johan Hovold
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-22 19:51 ` Kuogee Hsieh
2022-09-22 19:54 ` Dmitry Baryshkov
2022-09-13 8:53 ` [PATCH v2 04/10] drm/msm/hdmi: " Johan Hovold
` (4 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
Add the missing sanity check on the bridge counter to avoid corrupting
data beyond the fixed-sized bridge array in case there are ever more
than eight bridges.
Fixes: a689554ba6ed ("drm/msm: Initial add DSI connector support")
Cc: stable@vger.kernel.org # 4.1
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/dsi/dsi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 39bbabb5daf6..8a95c744972a 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -218,6 +218,12 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
return -EINVAL;
priv = dev->dev_private;
+
+ if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
+ DRM_DEV_ERROR(dev->dev, "too many bridges\n");
+ return -ENOSPC;
+ }
+
msm_dsi->dev = dev;
ret = msm_dsi_host_modeset_init(msm_dsi->host, dev);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v2 03/10] drm/msm/dsi: fix memory corruption with too many bridges
2022-09-13 8:53 ` [PATCH v2 03/10] drm/msm/dsi: " Johan Hovold
@ 2022-09-22 19:51 ` Kuogee Hsieh
2022-09-22 19:54 ` Dmitry Baryshkov
1 sibling, 0 replies; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 19:51 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Steev Klimaszewski, dri-devel, linux-arm-msm, freedreno,
linux-kernel, stable
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> Add the missing sanity check on the bridge counter to avoid corrupting
> data beyond the fixed-sized bridge array in case there are ever more
> than eight bridges.
>
> Fixes: a689554ba6ed ("drm/msm: Initial add DSI connector support")
> Cc: stable@vger.kernel.org # 4.1
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/dsi/dsi.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
> index 39bbabb5daf6..8a95c744972a 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi.c
> @@ -218,6 +218,12 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
> return -EINVAL;
>
> priv = dev->dev_private;
> +
> + if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
> + DRM_DEV_ERROR(dev->dev, "too many bridges\n");
> + return -ENOSPC;
> + }
> +
> msm_dsi->dev = dev;
>
> ret = msm_dsi_host_modeset_init(msm_dsi->host, dev);
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v2 03/10] drm/msm/dsi: fix memory corruption with too many bridges
2022-09-13 8:53 ` [PATCH v2 03/10] drm/msm/dsi: " Johan Hovold
2022-09-22 19:51 ` Kuogee Hsieh
@ 2022-09-22 19:54 ` Dmitry Baryshkov
1 sibling, 0 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2022-09-22 19:54 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, stable
On 13/09/2022 11:53, Johan Hovold wrote:
> Add the missing sanity check on the bridge counter to avoid corrupting
> data beyond the fixed-sized bridge array in case there are ever more
> than eight bridges.
>
> Fixes: a689554ba6ed ("drm/msm: Initial add DSI connector support")
> Cc: stable@vger.kernel.org # 4.1
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/gpu/drm/msm/dsi/dsi.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 04/10] drm/msm/hdmi: fix memory corruption with too many bridges
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
` (2 preceding siblings ...)
2022-09-13 8:53 ` [PATCH v2 03/10] drm/msm/dsi: " Johan Hovold
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-22 19:52 ` [Freedreno] " Kuogee Hsieh
2022-09-22 19:54 ` Dmitry Baryshkov
2022-09-13 8:53 ` [PATCH v2 05/10] drm/msm/dp: fix IRQ lifetime Johan Hovold
` (3 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
Add the missing sanity check on the bridge counter to avoid corrupting
data beyond the fixed-sized bridge array in case there are ever more
than eight bridges.
Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
Cc: stable@vger.kernel.org # 3.12
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/hdmi/hdmi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 93fe61b86967..a0ed6aa8e4e1 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -300,6 +300,11 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
struct platform_device *pdev = hdmi->pdev;
int ret;
+ if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
+ DRM_DEV_ERROR(dev->dev, "too many bridges\n");
+ return -ENOSPC;
+ }
+
hdmi->dev = dev;
hdmi->encoder = encoder;
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [Freedreno] [PATCH v2 04/10] drm/msm/hdmi: fix memory corruption with too many bridges
2022-09-13 8:53 ` [PATCH v2 04/10] drm/msm/hdmi: " Johan Hovold
@ 2022-09-22 19:52 ` Kuogee Hsieh
2022-09-22 19:54 ` Dmitry Baryshkov
1 sibling, 0 replies; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 19:52 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: dri-devel, Neil Armstrong, Daniel Vetter, Jonas Karlman,
linux-arm-msm, Bjorn Andersson, freedreno, linux-kernel,
Jernej Skrabec, Stephen Boyd, Robert Foss, Andrzej Hajda,
Manivannan Sadhasivam, stable, Sean Paul, Steev Klimaszewski,
Laurent Pinchart
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> Add the missing sanity check on the bridge counter to avoid corrupting
> data beyond the fixed-sized bridge array in case there are ever more
> than eight bridges.
>
> Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
> Cc: stable@vger.kernel.org # 3.12
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/hdmi/hdmi.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index 93fe61b86967..a0ed6aa8e4e1 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -300,6 +300,11 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
> struct platform_device *pdev = hdmi->pdev;
> int ret;
>
> + if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
> + DRM_DEV_ERROR(dev->dev, "too many bridges\n");
> + return -ENOSPC;
> + }
> +
> hdmi->dev = dev;
> hdmi->encoder = encoder;
>
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v2 04/10] drm/msm/hdmi: fix memory corruption with too many bridges
2022-09-13 8:53 ` [PATCH v2 04/10] drm/msm/hdmi: " Johan Hovold
2022-09-22 19:52 ` [Freedreno] " Kuogee Hsieh
@ 2022-09-22 19:54 ` Dmitry Baryshkov
1 sibling, 0 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2022-09-22 19:54 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, stable
On 13/09/2022 11:53, Johan Hovold wrote:
> Add the missing sanity check on the bridge counter to avoid corrupting
> data beyond the fixed-sized bridge array in case there are ever more
> than eight bridges.
>
> Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
> Cc: stable@vger.kernel.org # 3.12
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/gpu/drm/msm/hdmi/hdmi.c | 5 +++++
> 1 file changed, 5 insertions(+)
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 05/10] drm/msm/dp: fix IRQ lifetime
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
` (3 preceding siblings ...)
2022-09-13 8:53 ` [PATCH v2 04/10] drm/msm/hdmi: " Johan Hovold
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-22 19:54 ` [Freedreno] " Kuogee Hsieh
2022-09-13 8:53 ` [PATCH v2 06/10] drm/msm/dp: fix aux-bus EP lifetime Johan Hovold
` (2 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
Device-managed resources allocated post component bind must be tied to
the lifetime of the aggregate DRM device or they will not necessarily be
released when binding of the aggregate device is deferred.
This is specifically true for the DP IRQ, which will otherwise remain
requested so that the next bind attempt fails when requesting the IRQ a
second time.
Since commit c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
this can happen when the aux-bus panel driver has not yet been loaded so
that probe is deferred.
Fix this by tying the device-managed lifetime of the DP IRQ to the DRM
device so that it is released when bind fails.
Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
Cc: stable@vger.kernel.org # 5.10
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index fbe950edaefe..ba557328710a 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1258,7 +1258,7 @@ int dp_display_request_irq(struct msm_dp *dp_display)
return -EINVAL;
}
- rc = devm_request_irq(&dp->pdev->dev, dp->irq,
+ rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq,
dp_display_irq_handler,
IRQF_TRIGGER_HIGH, "dp_display_isr", dp);
if (rc < 0) {
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [Freedreno] [PATCH v2 05/10] drm/msm/dp: fix IRQ lifetime
2022-09-13 8:53 ` [PATCH v2 05/10] drm/msm/dp: fix IRQ lifetime Johan Hovold
@ 2022-09-22 19:54 ` Kuogee Hsieh
0 siblings, 0 replies; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 19:54 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: dri-devel, Neil Armstrong, Daniel Vetter, Jonas Karlman,
linux-arm-msm, Bjorn Andersson, freedreno, linux-kernel,
Jernej Skrabec, Stephen Boyd, Robert Foss, Andrzej Hajda,
Manivannan Sadhasivam, stable, Sean Paul, Steev Klimaszewski,
Laurent Pinchart
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> Device-managed resources allocated post component bind must be tied to
> the lifetime of the aggregate DRM device or they will not necessarily be
> released when binding of the aggregate device is deferred.
>
> This is specifically true for the DP IRQ, which will otherwise remain
> requested so that the next bind attempt fails when requesting the IRQ a
> second time.
>
> Since commit c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
> this can happen when the aux-bus panel driver has not yet been loaded so
> that probe is deferred.
>
> Fix this by tying the device-managed lifetime of the DP IRQ to the DRM
> device so that it is released when bind fails.
>
> Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> Cc: stable@vger.kernel.org # 5.10
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index fbe950edaefe..ba557328710a 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1258,7 +1258,7 @@ int dp_display_request_irq(struct msm_dp *dp_display)
> return -EINVAL;
> }
>
> - rc = devm_request_irq(&dp->pdev->dev, dp->irq,
> + rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq,
> dp_display_irq_handler,
> IRQF_TRIGGER_HIGH, "dp_display_isr", dp);
> if (rc < 0) {
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 06/10] drm/msm/dp: fix aux-bus EP lifetime
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
` (4 preceding siblings ...)
2022-09-13 8:53 ` [PATCH v2 05/10] drm/msm/dp: fix IRQ lifetime Johan Hovold
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-13 12:36 ` Doug Anderson
2022-09-13 8:53 ` [PATCH v2 07/10] drm/msm/dp: fix bridge lifetime Johan Hovold
2022-09-13 8:53 ` [PATCH v2 08/10] drm/msm/hdmi: fix IRQ lifetime Johan Hovold
7 siblings, 1 reply; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
Device-managed resources allocated post component bind must be tied to
the lifetime of the aggregate DRM device or they will not necessarily be
released when binding of the aggregate device is deferred.
This can lead resource leaks or failure to bind the aggregate device
when binding is later retried and a second attempt to allocate the
resources is made.
For the DP aux-bus, an attempt to populate the bus a second time will
simply fail ("DP AUX EP device already populated").
Fix this by tying the lifetime of the EP device to the DRM device rather
than DP controller platform device.
Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
Cc: stable@vger.kernel.org # 5.19
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/dp/dp_display.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index ba557328710a..4b0a2d4bb61e 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1535,6 +1535,11 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor)
}
}
+static void of_dp_aux_depopulate_bus_void(void *data)
+{
+ of_dp_aux_depopulate_bus(data);
+}
+
static int dp_display_get_next_bridge(struct msm_dp *dp)
{
int rc;
@@ -1559,10 +1564,16 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
* panel driver is probed asynchronously but is the best we
* can do without a bigger driver reorganization.
*/
- rc = devm_of_dp_aux_populate_ep_devices(dp_priv->aux);
+ rc = of_dp_aux_populate_bus(dp_priv->aux, NULL);
of_node_put(aux_bus);
if (rc)
goto error;
+
+ rc = devm_add_action_or_reset(dp->drm_dev->dev,
+ of_dp_aux_depopulate_bus_void,
+ dp_priv->aux);
+ if (rc)
+ goto error;
} else if (dp->is_edp) {
DRM_ERROR("eDP aux_bus not found\n");
return -ENODEV;
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v2 06/10] drm/msm/dp: fix aux-bus EP lifetime
2022-09-13 8:53 ` [PATCH v2 06/10] drm/msm/dp: fix aux-bus EP lifetime Johan Hovold
@ 2022-09-13 12:36 ` Doug Anderson
0 siblings, 0 replies; 21+ messages in thread
From: Doug Anderson @ 2022-09-13 12:36 UTC (permalink / raw)
To: Johan Hovold
Cc: Dmitry Baryshkov, Rob Clark, Abhinav Kumar, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Daniel Vetter, Sean Paul, Stephen Boyd,
Bjorn Andersson, Manivannan Sadhasivam, Kuogee Hsieh,
Steev Klimaszewski, dri-devel, linux-arm-msm, freedreno, LKML,
# 4.0+
Hi,
On Tue, Sep 13, 2022 at 9:58 AM Johan Hovold <johan+linaro@kernel.org> wrote:
>
> Device-managed resources allocated post component bind must be tied to
> the lifetime of the aggregate DRM device or they will not necessarily be
> released when binding of the aggregate device is deferred.
>
> This can lead resource leaks or failure to bind the aggregate device
> when binding is later retried and a second attempt to allocate the
> resources is made.
>
> For the DP aux-bus, an attempt to populate the bus a second time will
> simply fail ("DP AUX EP device already populated").
>
> Fix this by tying the lifetime of the EP device to the DRM device rather
> than DP controller platform device.
>
> Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
> Cc: stable@vger.kernel.org # 5.19
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/gpu/drm/msm/dp/dp_display.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
This seems fine to me as a short term fix until we get the DP AUX
populating moved to probe.
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 07/10] drm/msm/dp: fix bridge lifetime
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
` (5 preceding siblings ...)
2022-09-13 8:53 ` [PATCH v2 06/10] drm/msm/dp: fix aux-bus EP lifetime Johan Hovold
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-22 19:56 ` [Freedreno] " Kuogee Hsieh
2022-09-13 8:53 ` [PATCH v2 08/10] drm/msm/hdmi: fix IRQ lifetime Johan Hovold
7 siblings, 1 reply; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
Device-managed resources allocated post component bind must be tied to
the lifetime of the aggregate DRM device or they will not necessarily be
released when binding of the aggregate device is deferred.
This can lead resource leaks or failure to bind the aggregate device
when binding is later retried and a second attempt to allocate the
resources is made.
For the DP bridges, previously allocated bridges will leak on probe
deferral.
Fix this by amending the DP parser interface and tying the lifetime of
the bridge device to the DRM device rather than DP platform device.
Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
Cc: stable@vger.kernel.org # 5.19
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
drivers/gpu/drm/msm/dp/dp_parser.c | 6 +++---
drivers/gpu/drm/msm/dp/dp_parser.h | 5 +++--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 4b0a2d4bb61e..808a516e84c5 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1586,7 +1586,7 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
* For DisplayPort interfaces external bridges are optional, so
* silently ignore an error if one is not present (-ENODEV).
*/
- rc = dp_parser_find_next_bridge(dp_priv->parser);
+ rc = devm_dp_parser_find_next_bridge(dp->drm_dev->dev, dp_priv->parser);
if (!dp->is_edp && rc == -ENODEV)
return 0;
diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c
index dd732215d55b..dcbe893d66d7 100644
--- a/drivers/gpu/drm/msm/dp/dp_parser.c
+++ b/drivers/gpu/drm/msm/dp/dp_parser.c
@@ -240,12 +240,12 @@ static int dp_parser_clock(struct dp_parser *parser)
return 0;
}
-int dp_parser_find_next_bridge(struct dp_parser *parser)
+int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser)
{
- struct device *dev = &parser->pdev->dev;
+ struct platform_device *pdev = parser->pdev;
struct drm_bridge *bridge;
- bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
+ bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0);
if (IS_ERR(bridge))
return PTR_ERR(bridge);
diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h
index 866c1a82bf1a..d30ab773db46 100644
--- a/drivers/gpu/drm/msm/dp/dp_parser.h
+++ b/drivers/gpu/drm/msm/dp/dp_parser.h
@@ -138,8 +138,9 @@ struct dp_parser {
struct dp_parser *dp_parser_get(struct platform_device *pdev);
/**
- * dp_parser_find_next_bridge() - find an additional bridge to DP
+ * devm_dp_parser_find_next_bridge() - find an additional bridge to DP
*
+ * @dev: device to tie bridge lifetime to
* @parser: dp_parser data from client
*
* This function is used to find any additional bridge attached to
@@ -147,6 +148,6 @@ struct dp_parser *dp_parser_get(struct platform_device *pdev);
*
* Return: 0 if able to get the bridge, otherwise negative errno for failure.
*/
-int dp_parser_find_next_bridge(struct dp_parser *parser);
+int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser);
#endif
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [Freedreno] [PATCH v2 07/10] drm/msm/dp: fix bridge lifetime
2022-09-13 8:53 ` [PATCH v2 07/10] drm/msm/dp: fix bridge lifetime Johan Hovold
@ 2022-09-22 19:56 ` Kuogee Hsieh
0 siblings, 0 replies; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 19:56 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: dri-devel, Neil Armstrong, Daniel Vetter, Jonas Karlman,
linux-arm-msm, Bjorn Andersson, freedreno, linux-kernel,
Jernej Skrabec, Stephen Boyd, Robert Foss, Andrzej Hajda,
Manivannan Sadhasivam, stable, Sean Paul, Steev Klimaszewski,
Laurent Pinchart
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> Device-managed resources allocated post component bind must be tied to
> the lifetime of the aggregate DRM device or they will not necessarily be
> released when binding of the aggregate device is deferred.
>
> This can lead resource leaks or failure to bind the aggregate device
> when binding is later retried and a second attempt to allocate the
> resources is made.
>
> For the DP bridges, previously allocated bridges will leak on probe
> deferral.
>
> Fix this by amending the DP parser interface and tying the lifetime of
> the bridge device to the DRM device rather than DP platform device.
>
> Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
> Cc: stable@vger.kernel.org # 5.19
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
> drivers/gpu/drm/msm/dp/dp_parser.c | 6 +++---
> drivers/gpu/drm/msm/dp/dp_parser.h | 5 +++--
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 4b0a2d4bb61e..808a516e84c5 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1586,7 +1586,7 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
> * For DisplayPort interfaces external bridges are optional, so
> * silently ignore an error if one is not present (-ENODEV).
> */
> - rc = dp_parser_find_next_bridge(dp_priv->parser);
> + rc = devm_dp_parser_find_next_bridge(dp->drm_dev->dev, dp_priv->parser);
> if (!dp->is_edp && rc == -ENODEV)
> return 0;
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c
> index dd732215d55b..dcbe893d66d7 100644
> --- a/drivers/gpu/drm/msm/dp/dp_parser.c
> +++ b/drivers/gpu/drm/msm/dp/dp_parser.c
> @@ -240,12 +240,12 @@ static int dp_parser_clock(struct dp_parser *parser)
> return 0;
> }
>
> -int dp_parser_find_next_bridge(struct dp_parser *parser)
> +int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser)
> {
> - struct device *dev = &parser->pdev->dev;
> + struct platform_device *pdev = parser->pdev;
> struct drm_bridge *bridge;
>
> - bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
> + bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0);
> if (IS_ERR(bridge))
> return PTR_ERR(bridge);
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h
> index 866c1a82bf1a..d30ab773db46 100644
> --- a/drivers/gpu/drm/msm/dp/dp_parser.h
> +++ b/drivers/gpu/drm/msm/dp/dp_parser.h
> @@ -138,8 +138,9 @@ struct dp_parser {
> struct dp_parser *dp_parser_get(struct platform_device *pdev);
>
> /**
> - * dp_parser_find_next_bridge() - find an additional bridge to DP
> + * devm_dp_parser_find_next_bridge() - find an additional bridge to DP
> *
> + * @dev: device to tie bridge lifetime to
> * @parser: dp_parser data from client
> *
> * This function is used to find any additional bridge attached to
> @@ -147,6 +148,6 @@ struct dp_parser *dp_parser_get(struct platform_device *pdev);
> *
> * Return: 0 if able to get the bridge, otherwise negative errno for failure.
> */
> -int dp_parser_find_next_bridge(struct dp_parser *parser);
> +int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser);
>
> #endif
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 08/10] drm/msm/hdmi: fix IRQ lifetime
[not found] <20220913085320.8577-1-johan+linaro@kernel.org>
` (6 preceding siblings ...)
2022-09-13 8:53 ` [PATCH v2 07/10] drm/msm/dp: fix bridge lifetime Johan Hovold
@ 2022-09-13 8:53 ` Johan Hovold
2022-09-22 19:55 ` Kuogee Hsieh
7 siblings, 1 reply; 21+ messages in thread
From: Johan Hovold @ 2022-09-13 8:53 UTC (permalink / raw)
To: Douglas Anderson, Dmitry Baryshkov, Rob Clark, Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Kuogee Hsieh, Steev Klimaszewski, dri-devel, linux-arm-msm,
freedreno, linux-kernel, Johan Hovold, stable
Device-managed resources allocated post component bind must be tied to
the lifetime of the aggregate DRM device or they will not necessarily be
released when binding of the aggregate device is deferred.
This is specifically true for the HDMI IRQ, which will otherwise remain
requested so that the next bind attempt fails when requesting the IRQ a
second time.
Fix this by tying the device-managed lifetime of the HDMI IRQ to the DRM
device so that it is released when bind fails.
Fixes: 067fef372c73 ("drm/msm/hdmi: refactor bind/init")
Cc: stable@vger.kernel.org # 3.19
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpu/drm/msm/hdmi/hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index a0ed6aa8e4e1..f28fb21e3891 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -344,7 +344,7 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
goto fail;
}
- ret = devm_request_irq(&pdev->dev, hdmi->irq,
+ ret = devm_request_irq(dev->dev, hdmi->irq,
msm_hdmi_irq, IRQF_TRIGGER_HIGH,
"hdmi_isr", hdmi);
if (ret < 0) {
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v2 08/10] drm/msm/hdmi: fix IRQ lifetime
2022-09-13 8:53 ` [PATCH v2 08/10] drm/msm/hdmi: fix IRQ lifetime Johan Hovold
@ 2022-09-22 19:55 ` Kuogee Hsieh
2022-09-23 6:17 ` Johan Hovold
0 siblings, 1 reply; 21+ messages in thread
From: Kuogee Hsieh @ 2022-09-22 19:55 UTC (permalink / raw)
To: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Daniel Vetter, Sean Paul,
Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Steev Klimaszewski, dri-devel, linux-arm-msm, freedreno,
linux-kernel, stable
On 9/13/2022 1:53 AM, Johan Hovold wrote:
> Device-managed resources allocated post component bind must be tied to
> the lifetime of the aggregate DRM device or they will not necessarily be
> released when binding of the aggregate device is deferred.
>
> This is specifically true for the HDMI IRQ, which will otherwise remain
> requested so that the next bind attempt fails when requesting the IRQ a
> second time.
>
> Fix this by tying the device-managed lifetime of the HDMI IRQ to the DRM
> device so that it is released when bind fails.
>
> Fixes: 067fef372c73 ("drm/msm/hdmi: refactor bind/init")
> Cc: stable@vger.kernel.org # 3.19
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
> drivers/gpu/drm/msm/hdmi/hdmi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index a0ed6aa8e4e1..f28fb21e3891 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -344,7 +344,7 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
> goto fail;
> }
>
> - ret = devm_request_irq(&pdev->dev, hdmi->irq,
> + ret = devm_request_irq(dev->dev, hdmi->irq,
> msm_hdmi_irq, IRQF_TRIGGER_HIGH,
> "hdmi_isr", hdmi);
> if (ret < 0) {
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v2 08/10] drm/msm/hdmi: fix IRQ lifetime
2022-09-22 19:55 ` Kuogee Hsieh
@ 2022-09-23 6:17 ` Johan Hovold
0 siblings, 0 replies; 21+ messages in thread
From: Johan Hovold @ 2022-09-23 6:17 UTC (permalink / raw)
To: Kuogee Hsieh
Cc: Johan Hovold, Douglas Anderson, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Daniel Vetter,
Sean Paul, Stephen Boyd, Bjorn Andersson, Manivannan Sadhasivam,
Steev Klimaszewski, dri-devel, linux-arm-msm, freedreno,
linux-kernel, stable
On Thu, Sep 22, 2022 at 12:55:03PM -0700, Kuogee Hsieh wrote:
>
> On 9/13/2022 1:53 AM, Johan Hovold wrote:
> > Device-managed resources allocated post component bind must be tied to
> > the lifetime of the aggregate DRM device or they will not necessarily be
> > released when binding of the aggregate device is deferred.
> >
> > This is specifically true for the HDMI IRQ, which will otherwise remain
> > requested so that the next bind attempt fails when requesting the IRQ a
> > second time.
> >
> > Fix this by tying the device-managed lifetime of the HDMI IRQ to the DRM
> > device so that it is released when bind fails.
> >
> > Fixes: 067fef372c73 ("drm/msm/hdmi: refactor bind/init")
> > Cc: stable@vger.kernel.org # 3.19
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
>
> > Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> > Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
I believe you meant:
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
here (i.e. without the '>' quotes). Otherwise the tooling may not pick
these up.
Thanks for reviewing and testing.
Johan
^ permalink raw reply [flat|nested] 21+ messages in thread