]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: gadget: f_ecm: Refactor bind path to use __free()
authorKuen-Han Tsai <khtsai@google.com>
Sat, 18 Oct 2025 01:49:37 +0000 (21:49 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:04:31 +0000 (14:04 +0100)
commitd3745aaef19198d0c81637a7dd50ef53c4f879b7
treef3e9a3a10c9cc11f723bd73a7665cd27ad57cbf4
parentef81226bb1f8b6e761cd0b53d2696e9c1bc955d1
usb: gadget: f_ecm: Refactor bind path to use __free()

[ Upstream commit 42988380ac67c76bb9dff8f77d7ef3eefd50b7b5 ]

After an bind/unbind cycle, the ecm->notify_req is left stale. If a
subsequent bind fails, the unified error label attempts to free this
stale request, leading to a NULL pointer dereference when accessing
ep->ops->free_request.

Refactor the error handling in the bind path to use the __free()
automatic cleanup mechanism.

Fixes: da741b8c56d6 ("usb ethernet gadget: split CDC Ethernet function")
Cc: stable@kernel.org
Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Link: https://lore.kernel.org/r/20250916-ready-v1-5-4997bf277548@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250916-ready-v1-5-4997bf277548@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_ecm.c