Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/bridge: dw-mipi-dsi: Fix bridge leak when host attach fails

dw_mipi_dsi_host_attach() and dw_mipi_dsi2_host_attach() call
drm_bridge_add() before pdata->host_ops->attach(). If attach fails,
the bridge stayed registered without drm_bridge_remove(), leaking the
bridge reference and leaving the device on the global bridge list.

Fixes: 90910a651123 ("drm/bridge/synopsys: dsi: add ability to have glue-specific attach and detach")
Fixes: 0d6d86253fef ("drm/bridge/synopsys: Add MIPI DSI2 host controller bridge")
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://patch.msgid.link/20260403145208.15890-1-osama.abdelkader@gmail.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

authored by

Osama Abdelkader and committed by
Luca Ceresoli
be19b43f ad3ac32a

+10 -2
+5 -1
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
··· 345 345 if (pdata->host_ops && pdata->host_ops->attach) { 346 346 ret = pdata->host_ops->attach(pdata->priv_data, device); 347 347 if (ret < 0) 348 - return ret; 348 + goto err_remove_bridge; 349 349 } 350 350 351 351 return 0; 352 + 353 + err_remove_bridge: 354 + drm_bridge_remove(&dsi->bridge); 355 + return ret; 352 356 } 353 357 354 358 static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
+5 -1
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
··· 540 540 if (pdata->host_ops && pdata->host_ops->attach) { 541 541 ret = pdata->host_ops->attach(pdata->priv_data, device); 542 542 if (ret < 0) 543 - return ret; 543 + goto err_remove_bridge; 544 544 } 545 545 546 546 return 0; 547 + 548 + err_remove_bridge: 549 + drm_bridge_remove(&dsi2->bridge); 550 + return ret; 547 551 } 548 552 549 553 static int dw_mipi_dsi2_host_detach(struct mipi_dsi_host *host,