]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: gadget: f_rndis: Refactor bind path to use __free()
authorKuen-Han Tsai <khtsai@google.com>
Sat, 18 Oct 2025 02:44:44 +0000 (22:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:04:31 +0000 (14:04 +0100)
commitef81226bb1f8b6e761cd0b53d2696e9c1bc955d1
tree018365d2f06e1568af1bc919ebad3ebf7b25c190
parent4f370f38ccdc4bb497f65b376e7b05c5102f17da
usb: gadget: f_rndis: Refactor bind path to use __free()

[ Upstream commit 08228941436047bdcd35a612c1aec0912a29d8cd ]

After an bind/unbind cycle, the rndis->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: 45fe3b8e5342 ("usb ethernet gadget: split RNDIS function")
Cc: stable@kernel.org
Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Link: https://lore.kernel.org/r/20250916-ready-v1-6-4997bf277548@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250916-ready-v1-6-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_rndis.c