Skip to contentSkip to conversation

drm/tilcdc: fix wrong error handling

PATCH In review Daniel Schultz 3 participants 4 messages Sep 23, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/tilcdc: fix wrong error handling

When 'component_bind_all' fails it should not try to unbind components in the error handling. This will produce a null pointer kernel panic when no component exist.

This patch changes the order of the error handling. Now, it will only unbind components if the are bound. Otherwise, the module will jump to an error label below.

---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3 -3
index d278093..d491610 100644
@@ -315,13 +315,13 @@ fail_irq_uninstall:
 fail_vblank_cleanup:
 	drm_vblank_cleanup(dev);
 
-fail_mode_config_cleanup:
-	drm_mode_config_cleanup(dev);
-
 fail_component_cleanup:
 	if (priv->is_componentized)
 		component_unbind_all(dev->dev, dev);
 
+fail_mode_config_cleanup:
+	drm_mode_config_cleanup(dev);
+
 fail_external_cleanup:
 	tilcdc_remove_external_encoders(dev);
 
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Daniel Schultz

When 'component_bind_all' fails it should not try to unbind components in the error handling. This will produce a null pointer kernel panic when no component exist.

This patch changes the order of the error handling. Now, it will only unbind components if the are bound. Otherwise, the module will jump to an error label below.

Quoted 28 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3 -4
index d278093..d491610 100644
@@ -315,13 +315,13 @@ fail_irq_uninstall:
 fail_vblank_cleanup:
        drm_vblank_cleanup(dev);
 
-fail_mode_config_cleanup:
-       drm_mode_config_cleanup(dev);
-
 fail_component_cleanup:
        if (priv->is_componentized)
                component_unbind_all(dev->dev, dev);
 
+fail_mode_config_cleanup:
+       drm_mode_config_cleanup(dev);
+
 fail_external_cleanup:
        tilcdc_remove_external_encoders(dev);
 
--

1.9.1

#2 lore raw
Quoted 5 lines · Sean Paul
Quoted 4 lines · Daniel Schultz

When 'component_bind_all' fails it should not try to unbind components in the error handling. This will produce a null pointer kernel panic when no component exist.

Quoted 8 lines
Quoted 5 lines

This patch changes the order of the error handling. Now, it will only unbind components if the are bound. Otherwise, the module will jump to an error label below.

Thanks, for both. Should I pick this one :)?

BR,
Jyri

Quoted 28 lines
Quoted 28 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3 -4
index d278093..d491610 100644
@@ -315,13 +315,13 @@ fail_irq_uninstall:
 fail_vblank_cleanup:
        drm_vblank_cleanup(dev);
 
-fail_mode_config_cleanup:
-       drm_mode_config_cleanup(dev);
-
 fail_component_cleanup:
        if (priv->is_componentized)
                component_unbind_all(dev->dev, dev);
 
+fail_mode_config_cleanup:
+       drm_mode_config_cleanup(dev);
+
 fail_external_cleanup:
        tilcdc_remove_external_encoders(dev);
 
--

1.9.1

#3 lore raw
Quoted 10 lines · Jyri Sarha
Quoted 9 lines · Sean Paul
Quoted 8 lines · Daniel Schultz

When 'component_bind_all' fails it should not try to unbind components in the error handling. This will produce a null pointer kernel panic when no component exist.

This patch changes the order of the error handling. Now, it will only unbind components if the are bound. Otherwise, the module will jump to an error label below.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks, for both. Should I pick this one :)?

Yes, it's all yours! :)

Sean

Quoted 32 lines

BR,
Jyri

Quoted 28 lines
Quoted 28 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3 -4
index d278093..d491610 100644
@@ -315,13 +315,13 @@ fail_irq_uninstall:
 fail_vblank_cleanup:
        drm_vblank_cleanup(dev);
 
-fail_mode_config_cleanup:
-       drm_mode_config_cleanup(dev);
-
 fail_component_cleanup:
        if (priv->is_componentized)
                component_unbind_all(dev->dev, dev);
 
+fail_mode_config_cleanup:
+       drm_mode_config_cleanup(dev);
+
 fail_external_cleanup:
        tilcdc_remove_external_encoders(dev);
 
--

1.9.1