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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:22:29 +0000 (11:22 +0200)
commit14ab480de0baba171df23198ce1f3c17e54b945f
tree1c78580b842ba621b4641dc14595085dab2b6adb
parent6fd5a1673f6b5ed5546dcd8dfe895723681ec0d1
usb: gadget: f_tcm: Fix some resource leaks in some error paths

[ 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>
drivers/usb/gadget/function/f_tcm.c