Commit c3cdf3a8 authored by Shuah Khan (Samsung OSG)'s avatar Shuah Khan (Samsung OSG) Committed by Kleber Sacilotto de Souza

usbip: usbip_detach: Fix memory, udev context and udev leak

BugLink: https://bugs.launchpad.net/bugs/1791953

[ Upstream commit d179f99a ]

detach_port() fails to call usbip_vhci_driver_close() from its error
path after usbip_vhci_detach_device() returns failure, leaking memory
allocated in usbip_vhci_driver_open() and holding udev_context and udev
references. Fix it to call usbip_vhci_driver_close().
Signed-off-by: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent a4e87e19
......@@ -43,7 +43,7 @@ void usbip_detach_usage(void)
static int detach_port(char *port)
{
int ret;
int ret = 0;
uint8_t portnum;
char path[PATH_MAX+1];
......@@ -73,9 +73,12 @@ static int detach_port(char *port)
}
ret = usbip_vhci_detach_device(portnum);
if (ret < 0)
return -1;
if (ret < 0) {
ret = -1;
goto call_driver_close;
}
call_driver_close:
usbip_vhci_driver_close();
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment