[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0f085940-2214-4d0f-b08b-e4d40b07051b@mleia.com>
Date: Mon, 17 Nov 2025 21:37:31 +0200
From: Vladimir Zapolskiy <vz@...ia.com>
To: Ma Ke <make24@...as.ac.cn>, stern@...land.harvard.edu,
piotr.wojtaszczyk@...esys.com, gregkh@...uxfoundation.org, stigge@...com.de,
arnd@...db.de
Cc: linux-usb@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
stable@...r.kernel.org
Subject: Re: [PATCH] USB: ohci-nxp: Fix error handling in ohci-hcd-nxp driver
On 11/16/25 03:06, Ma Ke wrote:
> When obtaining the ISP1301 I2C client through the device tree, the
> driver does not release the device reference in the probe failure path
> or in the remove function. This could cause a reference count leak,
> which may prevent the device from being properly unbound or freed,
> leading to resource leakage. Add put_device() to release the reference
> in the probe failure path and in the remove function.
>
> Found by code review.
>
> Cc: stable@...r.kernel.org
> Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver")
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
> drivers/usb/host/ohci-nxp.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index 24d5a1dc5056..f79558ef0b45 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -223,6 +223,8 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
> fail_resource:
> usb_put_hcd(hcd);
> fail_disable:
> + if (isp1301_i2c_client)
> + put_device(&isp1301_i2c_client->dev);
> isp1301_i2c_client = NULL;
> return ret;
> }
> @@ -234,6 +236,8 @@ static void ohci_hcd_nxp_remove(struct platform_device *pdev)
> usb_remove_hcd(hcd);
> ohci_nxp_stop_hc();
> usb_put_hcd(hcd);
> + if (isp1301_i2c_client)
> + put_device(&isp1301_i2c_client->dev);
> isp1301_i2c_client = NULL;
> }
>
For v2 please remove checks for !isp1301_i2c_client as pointed out by Alan Stern,
and then feel free to add
Reviewed-by: Vladimir Zapolskiy <vz@...ia.com>
--
Best wishes,
Vladimir
Powered by blists - more mailing lists