Commit c841179
USB: lpc32xx_udc: Fix error handling in probe
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: 24a28e4 ("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>1 parent 128bb7f commit c841179
1 file changed
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3020 | 3020 | | |
3021 | 3021 | | |
3022 | 3022 | | |
3023 | | - | |
| 3023 | + | |
3024 | 3024 | | |
3025 | 3025 | | |
3026 | 3026 | | |
| |||
3038 | 3038 | | |
3039 | 3039 | | |
3040 | 3040 | | |
3041 | | - | |
3042 | | - | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
3043 | 3045 | | |
3044 | 3046 | | |
3045 | 3047 | | |
3046 | 3048 | | |
3047 | 3049 | | |
3048 | | - | |
| 3050 | + | |
| 3051 | + | |
3049 | 3052 | | |
3050 | 3053 | | |
3051 | 3054 | | |
3052 | 3055 | | |
3053 | 3056 | | |
3054 | 3057 | | |
3055 | | - | |
| 3058 | + | |
| 3059 | + | |
3056 | 3060 | | |
3057 | 3061 | | |
3058 | 3062 | | |
3059 | 3063 | | |
3060 | 3064 | | |
3061 | 3065 | | |
3062 | | - | |
| 3066 | + | |
3063 | 3067 | | |
3064 | 3068 | | |
3065 | 3069 | | |
| |||
3161 | 3165 | | |
3162 | 3166 | | |
3163 | 3167 | | |
| 3168 | + | |
| 3169 | + | |
3164 | 3170 | | |
3165 | 3171 | | |
3166 | 3172 | | |
| |||
3189 | 3195 | | |
3190 | 3196 | | |
3191 | 3197 | | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
3192 | 3201 | | |
3193 | 3202 | | |
3194 | 3203 | | |
| |||
0 commit comments