alistair23-linux/tools/usb
Nobuo Iwata 220c61b6f7 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 <nobuo.iwata@fujixerox.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07 10:19:49 +01:00
..
ffs-aio-example tools: ffs-aio-example: use endpoint addresses from descriptors 2015-01-15 09:41:49 -06:00
usbip usbip: deletion of incorrect socket descriptor checking 2016-11-07 10:19:49 +01:00
ffs-test.c tools: ffs-test: add compatibility code for old kernels 2014-09-02 09:16:46 -05:00
hcd-tests.sh USB: usbtest - add alignment tests to test script 2011-01-22 19:42:14 -08:00
Makefile Revert "tools: ffs-test: convert to new descriptor format fixing compilation error" 2014-06-27 10:41:00 -05:00
testusb.c tools: usb: testusb: change the default value for length from 512 to 1024 2015-09-27 10:54:31 -05:00