All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vz@mleia.com>
To: Alan Stern <stern@rowland.harvard.edu>, Arnd Bergmann <arnd@arndb.de>
Cc: Ma Ke <make24@iscas.ac.cn>,
	piotr.wojtaszczyk@timesys.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stigge@antcom.de, linux-usb@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] USB: ohci-nxp: Fix error handling in ohci-hcd-nxp driver
Date: Mon, 17 Nov 2025 21:44:44 +0200	[thread overview]
Message-ID: <1ebfc59e-dad5-40bf-8bdb-869fb5b06a1f@mleia.com> (raw)
In-Reply-To: <9834be77-29e0-4a65-93f6-b61bf724f922@rowland.harvard.edu>

On 11/17/25 16:56, Alan Stern wrote:
> On Mon, Nov 17, 2025 at 09:53:21AM +0100, Arnd Bergmann wrote:
>> On Mon, Nov 17, 2025, at 02:34, 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.
>>>
>>> Fix this by storing whether the client was obtained via device tree
>>> and only releasing the reference in that case.
>>>
>>> Found by code review.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver")
>>> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
>>
>> The patch looks fine in principle, however I don't see any way
>> this driver would be probed without devicetree, and I think
>> it would be better to remove all the traces of the pre-DT
>> logic in it.
>>
>> The lpc32xx platform was converted to DT back in 2012, so
>> any reference to the old variant is dead code. Something like
>> the patch below should work here.
>>
>> Other thoughts on this driver, though I I'm not sure anyone
>> is going to have the energy to implement these:
>>
>>   - the reference to isp1301_i2c_client should be kept in
>>     the hcd private data, after allocating a structure, by
>>     setting driver->hcd_priv_size.
>>   - instead of looking for the i2c device, I would suppose
>>     it should look for a usb_phy instead, as there is no
>>     guarantee on the initialization being ordered at the
>>     moment.
>>   - instead of a usb_phy, the driver should probably use
>>     a generic phy (a much larger rework).

Since I'm one of the remaining users and holders of the LPC32xx powered
boards, I should take this task.

> 
> Considering what the comments at the start of the file say:
> 
>   * Currently supported OHCI host devices:
>   * - NXP LPC32xx
> 
>   * NOTE: This driver does not have suspend/resume functionality
>   * This driver is intended for engineering development purposes only
> 
> I wonder whether any existing systems actually use this driver.
> 

The LPC32xx OHCI host device works fine with the driver, noteworthy
there were some issues with the LPC32xx UDC though.

Any pre-dt leftovers should be removed from the driver, as Arnd suggested.

-- 
Best wishes,
Vladimir


  reply	other threads:[~2025-11-17 19:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17  1:34 [PATCH v2] USB: ohci-nxp: Fix error handling in ohci-hcd-nxp driver Ma Ke
2025-11-17  2:12 ` Alan Stern
2025-11-17  8:53 ` Arnd Bergmann
2025-11-17 14:56   ` Alan Stern
2025-11-17 19:44     ` Vladimir Zapolskiy [this message]
2025-11-21 14:18 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ebfc59e-dad5-40bf-8bdb-869fb5b06a1f@mleia.com \
    --to=vz@mleia.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=make24@iscas.ac.cn \
    --cc=piotr.wojtaszczyk@timesys.com \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=stigge@antcom.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.