Skip to contentSkip to conversation

fbdev: uvesafb: unregister connector callback on init failure

PATCH Applied Myeonghun Pak 2 participants 2 messages Jul 1 – Jul 18

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

PATCH 1/1 fbdev: uvesafb: unregister connector callback on init failure

uvesafb_init() registers the v86d connector callback before registering the platform driver. If platform_driver_register() fails, the function returns the error directly and leaves the connector callback registered.

The later platform-device failure path already unregisters the callback. Add the same cleanup before the final return when platform-driver registration fails.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes 8bdb3a2d7df4 ("uvesafb: the driver core")
---
 drivers/video/fbdev/uvesafb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/fbdev/uvesafb.c +2 -0
index 9d82326c744f..ccc9dbc25813 100644
@@ -1907,6 +1907,8 @@ static int uvesafb_init(void)
 			err = 0;
 		}
 	}
+	if (err)
+		cn_del_callback(&uvesafb_cn_id);
 	return err;
 }
 
Signature · 1 line
2.47.1
maintainer Applied
#1 lore raw
Quoted 11 lines · Myeonghun Pak

uvesafb_init() registers the v86d connector callback before registering the platform driver. If platform_driver_register() fails, the function returns the error directly and leaves the connector callback registered.

The later platform-device failure path already unregisters the callback. Add the same cleanup before the final return when platform-driver registration fails.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Quoted 8 lines
Fixes 8bdb3a2d7df4 ("uvesafb: the driver core")
---
  drivers/video/fbdev/uvesafb.c | 2 ++
  1 file changed, 2 insertions(+)

applied.

Thanks!
Helge