[PATCH] drm/panel: Fix node reference leak in rpi_touchscreen_probe()

Wentao Liang posted 1 patch 1 week, 1 day ago
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] drm/panel: Fix node reference leak in rpi_touchscreen_probe()
Posted by Wentao Liang 1 week, 1 day ago
of_graph_get_remote_port() returns a reference to the remote port
node.  On the success path that reference is passed to the registered
DSI device and released with it, but if mipi_dsi_device_register_full()
fails the reference is never dropped.  Release it on the error path.

Fixes: 2f733d6194bd ("drm/panel: Add support for the Raspberry Pi 7" Touchscreen.")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index dc4bb8ad9131..c14776561623 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -428,6 +428,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c)
 	if (IS_ERR(ts->dsi)) {
 		dev_err(dev, "DSI device registration failed: %ld\n",
 			PTR_ERR(ts->dsi));
+		of_node_put(info.node);
 		return PTR_ERR(ts->dsi);
 	}
 
-- 
2.34.1
Re: [PATCH] drm/panel: Fix node reference leak in rpi_touchscreen_probe()
Posted by neil.armstrong@linaro.org 13 hours ago
On 9/16/26 20:05, Wentao Liang wrote:
> of_graph_get_remote_port() returns a reference to the remote port
> node.  On the success path that reference is passed to the registered
> DSI device and released with it, but if mipi_dsi_device_register_full()
> fails the reference is never dropped.  Release it on the error path.
> 
> Fixes: 2f733d6194bd ("drm/panel: Add support for the Raspberry Pi 7" Touchscreen.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>   drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> index dc4bb8ad9131..c14776561623 100644
> --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> @@ -428,6 +428,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c)
>   	if (IS_ERR(ts->dsi)) {
>   		dev_err(dev, "DSI device registration failed: %ld\n",
>   			PTR_ERR(ts->dsi));
> +		of_node_put(info.node);
>   		return PTR_ERR(ts->dsi);
>   	}
>   

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks,
Neil