]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: lpc32xx_udc: Fix error handling in probe
authorMa Ke <make24@iscas.ac.cn>
Mon, 15 Dec 2025 02:09:31 +0000 (10:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:13 +0000 (12:57 +0100)
commitcefaad839a384a72331aedad927b1944fb6943dc
tree885da9a36a8985212014a7062469d71d4cb2705d
parentd377fe40ff5a4d7ccb0e3efa9381adfd4238f3b2
USB: lpc32xx_udc: Fix error handling in probe

commit c84117912bddd9e5d87e68daf182410c98181407 upstream.

lpc32xx_udc_probe() acquires an i2c_client reference through
isp1301_get_client() but fails to release it in both error handling
paths and the normal removal path. This could result in a reference
count leak for the I2C device, preventing proper cleanup and potentially
leading to resource exhaustion. Add put_device() to release the
reference in the probe failure path and in the remove function.

Calling path: isp1301_get_client() -> of_find_i2c_device_by_node() ->
i2c_find_device_by_fwnode(). As comments of i2c_find_device_by_fwnode()
says, 'The user must call put_device(&client->dev) once done with the
i2c client.'

Found by code review.

Cc: stable <stable@kernel.org>
Fixes: 24a28e428351 ("USB: gadget driver for LPC32xx")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Link: https://patch.msgid.link/20251215020931.15324-1-make24@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/lpc32xx_udc.c