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:21:19 +0000 (11:21 +0200)
commit7d0806c7e3561a5a9d9dd4f31b83cec6a7688db3
tree79ba1f062faeefecabfff39c359a2fe3c9cba94b
parentb32abe570ea99fa4c7538b88a1c95bc28a7872f4
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