From 220c61b6f73a1d6f28591aeedff51a668068361b Mon Sep 17 00:00:00 2001 From: Nobuo Iwata Date: Fri, 30 Sep 2016 14:44:04 +0900 Subject: usbip: deletion of incorrect socket descriptor checking This patch removes checking of socket descriptor value in daemons. It was checked to be less than FD_SETSIZE(1024 usually) but it's not correct. To be exact, the maximum value of descriptor comes from rlimit(RLIMIT_NOFILE). Following kernel code determines the value : get_unused_fd_flags() : fs/files.c __alloc_fd() : fs/files.c expand_files() : fs/files.c The defalut (soft limit) is defines as INR_OPEN_CUR(1024) in include/linux/fs.h which is referenced form INIT_RLIMS in include/asm-generic/resource.h. The value may be modified with ulimt, sysctl, security configuration and etc. With the kernel code above, when socket() system call returns positive value, the value must be within rlimit(RLIMIT_NOFILE). No extra checking is needed when socket() returns positive. Without 'usbip: vhci number of ports extension' patch set, there's no practical problem because of number of USB port restriction. With the patch set, the value of socket descriptor can exceed FD_SETSIZE(1024 usually) if the rlimit is changed. Signed-off-by: Nobuo Iwata Signed-off-by: Greg Kroah-Hartman --- tools/usb/usbip/src/usbipd.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'tools') diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c index a0972dea9e6c..009afb4a3aae 100644 --- a/tools/usb/usbip/src/usbipd.c +++ b/tools/usb/usbip/src/usbipd.c @@ -398,13 +398,6 @@ static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[], * (see do_standalone_mode()) */ usbip_net_set_v6only(sock); - if (sock >= FD_SETSIZE) { - err("FD_SETSIZE: %s: sock=%d, max=%d", - ai_buf, sock, FD_SETSIZE); - close(sock); - continue; - } - ret = bind(sock, ai->ai_addr, ai->ai_addrlen); if (ret < 0) { err("bind: %s: %d (%s)", -- cgit v1.2.3 From 71158c28eb434f3fe740b1560bbd698d56f506ee Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Mon, 5 Dec 2016 17:51:24 -0700 Subject: usbip: add missing compile time generated files to .gitignore Add the following files to .gitignore compile libsrc/libusbip_la-sysfs_utils.lo libsrc/libusbip_la-usbip_device_driver.lo libsrc/libusbip_la-usbip_host_common.lo Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/usb/usbip/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/usb/usbip/.gitignore b/tools/usb/usbip/.gitignore index 9aad9e30a8ba..03b892c8bd8c 100644 --- a/tools/usb/usbip/.gitignore +++ b/tools/usb/usbip/.gitignore @@ -2,6 +2,7 @@ Makefile Makefile.in aclocal.m4 autom4te.cache/ +compile config.guess config.h config.h.in @@ -21,7 +22,10 @@ src/Makefile.in stamp-h1 libsrc/libusbip.la libsrc/libusbip_la-names.lo +libsrc/libusbip_la-sysfs_utils.lo libsrc/libusbip_la-usbip_common.lo +libsrc/libusbip_la-usbip_device_driver.lo +libsrc/libusbip_la-usbip_host_common.lo libsrc/libusbip_la-usbip_host_driver.lo libsrc/libusbip_la-vhci_driver.lo src/usbip -- cgit v1.2.3