[lvc-project] [PATCH] executor/common_lunux.h/usbip_server_init: Close fd if can't find usb port
Pavel Nikulshin
p.nikulshin at ispras.ru
Fri Dec 8 13:56:04 MSK 2023
If usb port for usbip server can't be found, fd of the server and client should be closed.
If they don't closed, the number of open files will increase and may overflow the number of available open files for the process.
Found by Linux Verification Center (linuxtesting.org) with syzkaller.
Signed-off-by: Pavel Nikulshin <p.nikulshin at ispras.ru>
---
executor/common_linux.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/executor/common_linux.h b/executor/common_linux.h
index f81174656..5de820c96 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -2045,6 +2045,8 @@ static long syz_usbip_server_init(volatile long a0)
int available_port_num = __atomic_fetch_add(&port_alloc[usb3], 1, __ATOMIC_RELAXED);
if (available_port_num > VHCI_HC_PORTS) {
debug("syz_usbip_server_init : no more available port for : %d\n", available_port_num);
+ close(client_fd);
+ close(server_fd);
return -1;
}
--
2.39.2
More information about the lvc-project
mailing list