]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
usb: gadget: f_tcm: Fix some resource leaks in some error paths
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 14 Aug 2020 05:55:01 +0000 (07:55 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 16 Sep 2020 09:15:01 +0000 (05:15 -0400)
commite814a7ec99556ebe08fa81a3accf0d49e682733b
treecef239224b557df168b4e2da31bfd932825ee81d
parent1271449d5718b37480382d9d2e9c86026b44d4d3
usb: gadget: f_tcm: Fix some resource leaks in some error paths

BugLink: https://bugs.launchpad.net/bugs/1895174
[ Upstream commit 07c8434150f4eb0b65cae288721c8af1080fde17 ]

If a memory allocation fails within a 'usb_ep_alloc_request()' call, the
already allocated memory must be released.

Fix a mix-up in the code and free the correct requests.

Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/gadget/function/f_tcm.c