Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor/common_lunux.h/usbip_server_init: Close fd if can't find usb port #4938

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions executor/common_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,9 @@ 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;
}

Expand All @@ -2067,6 +2070,8 @@ static long syz_usbip_server_init(volatile long a0)
sprintf(buffer, "%d %d %s %d", port_num, client_fd, "0", speed);

write_file("/sys/devices/platform/vhci_hcd.0/attach", buffer);

close(client_fd);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have some comment re. why we can close the client_fd here. Won't it break something?

return server_fd;
}

Expand Down
Loading