mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
usbip: usbip_detach: Fix memory, udev context and udev leak
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: Shuah Khan (Samsung OSG) <shuah@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
edf380046b
commit
d179f99a65
1 changed files with 6 additions and 3 deletions
|
@ -43,7 +43,7 @@ void usbip_detach_usage(void)
|
||||||
|
|
||||||
static int detach_port(char *port)
|
static int detach_port(char *port)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 0;
|
||||||
uint8_t portnum;
|
uint8_t portnum;
|
||||||
char path[PATH_MAX+1];
|
char path[PATH_MAX+1];
|
||||||
|
|
||||||
|
@ -73,9 +73,12 @@ static int detach_port(char *port)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = usbip_vhci_detach_device(portnum);
|
ret = usbip_vhci_detach_device(portnum);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto call_driver_close;
|
||||||
|
}
|
||||||
|
|
||||||
|
call_driver_close:
|
||||||
usbip_vhci_driver_close();
|
usbip_vhci_driver_close();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue