Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/gma500/oaktrail_hdmi: fix i2c adapter leak on setup
       [not found] <20260508144446.59722-1-johan@kernel.org>
@ 2026-05-08 14:44 ` Johan Hovold
  2026-05-08 14:44 ` [PATCH 2/3] drm/gma500/oaktrail_lvds: fix hang on init failure Johan Hovold
  2026-05-08 14:44 ` [PATCH 3/3] drm/gma500/oaktrail_lvds: fix i2c adapter leaks on init Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-05-08 14:44 UTC (permalink / raw)
  To: Patrik Jakobsson
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, Johan Hovold, stable

Make sure to drop the reference taken to the I2C adapter (and its
module) when setting up HDMI to allow the adapter to be deregistered.

Fixes: 1b082ccf5901 ("gma500: Add Oaktrail support")
Cc: stable@vger.kernel.org	# 3.3
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 58d7e191fd56..403d21cbb3a2 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -580,6 +580,7 @@ static int oaktrail_hdmi_get_modes(struct drm_connector *connector)
 	} else {
 		edid = (struct edid *)raw_edid;
 		/* FIXME ? edid = drm_get_edid(connector, i2c_adap); */
+		i2c_put_adapter(i2c_adap);
 	}
 
 	if (edid) {
-- 
2.53.0


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

* [PATCH 2/3] drm/gma500/oaktrail_lvds: fix hang on init failure
       [not found] <20260508144446.59722-1-johan@kernel.org>
  2026-05-08 14:44 ` [PATCH 1/3] drm/gma500/oaktrail_hdmi: fix i2c adapter leak on setup Johan Hovold
@ 2026-05-08 14:44 ` Johan Hovold
  2026-05-08 14:44 ` [PATCH 3/3] drm/gma500/oaktrail_lvds: fix i2c adapter leaks on init Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-05-08 14:44 UTC (permalink / raw)
  To: Patrik Jakobsson
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, Johan Hovold, stable

The LVDS init code looks up an I2C adapter using i2c_get_adapter() and
tries to read the EDID before falling back to allocating and registering
its own adapter.

The error handling does not separate these cases so on a late init
failure it will try to deregister and free also an adapter that had
previously been registered. Since i2c_get_adapter() takes another
reference to the adapter, deregistration hangs indefinitely while
waiting for the reference to be released.

Fix this by only destroying adapters allocated during LVDS init on
errors.

Fixes: a57ebfc0b4da ("drm/gma500: Make oaktrail lvds use ddc adapter from drm_connector")
Cc: stable@vger.kernel.org	# 6.0
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpu/drm/gma500/oaktrail_lvds.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 884d324f0044..983cc60a1e69 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -293,7 +293,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
 {
 	struct gma_encoder *gma_encoder;
 	struct gma_connector *gma_connector;
-	struct gma_i2c_chan *ddc_bus;
+	struct gma_i2c_chan *ddc_bus = NULL;
 	struct drm_connector *connector;
 	struct drm_encoder *encoder;
 	struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
@@ -421,7 +421,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
 
 err_unlock:
 	mutex_unlock(&dev->mode_config.mutex);
-	gma_i2c_destroy(to_gma_i2c_chan(connector->ddc));
+	if (!IS_ERR_OR_NULL(ddc_bus))
+		gma_i2c_destroy(ddc_bus);
 	drm_encoder_cleanup(encoder);
 err_connector_cleanup:
 	drm_connector_cleanup(connector);
-- 
2.53.0


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

* [PATCH 3/3] drm/gma500/oaktrail_lvds: fix i2c adapter leaks on init
       [not found] <20260508144446.59722-1-johan@kernel.org>
  2026-05-08 14:44 ` [PATCH 1/3] drm/gma500/oaktrail_hdmi: fix i2c adapter leak on setup Johan Hovold
  2026-05-08 14:44 ` [PATCH 2/3] drm/gma500/oaktrail_lvds: fix hang on init failure Johan Hovold
@ 2026-05-08 14:44 ` Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-05-08 14:44 UTC (permalink / raw)
  To: Patrik Jakobsson
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, Johan Hovold, stable

The LVDS init code looks up an I2C adapter using i2c_get_adapter() and
tries to read the EDID before falling back to allocating and registering
its own adapter.

Make sure to drop the references taken by i2c_get_adapter() when falling
back to allocating an adapter as well as on late errors to allow the
looked up adapter to be deregistered.

Fixes: 1b082ccf5901 ("gma500: Add Oaktrail support")
Cc: stable@vger.kernel.org	# 3.3
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpu/drm/gma500/oaktrail_lvds.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 983cc60a1e69..e194d0cce067 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -367,6 +367,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
 	if (edid == NULL && dev_priv->lpc_gpio_base) {
 		ddc_bus = oaktrail_lvds_i2c_init(dev);
 		if (!IS_ERR(ddc_bus)) {
+			if (i2c_adap)
+				i2c_put_adapter(i2c_adap);
 			i2c_adap = &ddc_bus->base;
 			edid = drm_get_edid(connector, i2c_adap);
 		}
@@ -423,6 +425,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
 	mutex_unlock(&dev->mode_config.mutex);
 	if (!IS_ERR_OR_NULL(ddc_bus))
 		gma_i2c_destroy(ddc_bus);
+	else if (i2c_adap)
+		i2c_put_adapter(i2c_adap);
 	drm_encoder_cleanup(encoder);
 err_connector_cleanup:
 	drm_connector_cleanup(connector);
-- 
2.53.0


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

end of thread, other threads:[~2026-05-08 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260508144446.59722-1-johan@kernel.org>
2026-05-08 14:44 ` [PATCH 1/3] drm/gma500/oaktrail_hdmi: fix i2c adapter leak on setup Johan Hovold
2026-05-08 14:44 ` [PATCH 2/3] drm/gma500/oaktrail_lvds: fix hang on init failure Johan Hovold
2026-05-08 14:44 ` [PATCH 3/3] drm/gma500/oaktrail_lvds: fix i2c adapter leaks on init Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox