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

Conversation

AKSUMRUS
Copy link
Contributor

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.

dvyukov
dvyukov previously approved these changes Jun 26, 2024
@dvyukov dvyukov enabled auto-merge June 26, 2024 16:21
auto-merge was automatically disabled June 26, 2024 16:26

Head branch was pushed to by a user without write access

@AKSUMRUS AKSUMRUS force-pushed the patch-7 branch 3 times, most recently from 529a67e to ccb92a0 Compare June 26, 2024 16:39
@a-nogikh
Copy link
Collaborator

The CI checks fail:

executor/common_linux.h:1:1: The file is not formatted/regenerated. Run 'make generate' and include it into the commit.

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.

Signed-off-by: Pavel Nikulshin <[email protected]>
@@ -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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants