usb: gadget: f_tcm: Fix some resource leaks in some error paths
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: c52661d60f
("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>
This commit is contained in:
parent
9123e3a74e
commit
07c8434150
@ -753,12 +753,13 @@ static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream)
|
||||
goto err_sts;
|
||||
|
||||
return 0;
|
||||
|
||||
err_sts:
|
||||
usb_ep_free_request(fu->ep_status, stream->req_status);
|
||||
stream->req_status = NULL;
|
||||
err_out:
|
||||
usb_ep_free_request(fu->ep_out, stream->req_out);
|
||||
stream->req_out = NULL;
|
||||
err_out:
|
||||
usb_ep_free_request(fu->ep_in, stream->req_in);
|
||||
stream->req_in = NULL;
|
||||
out:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user