19 Aug, 2020

1 commit

  • Converting the Makefile to use the new tools buildsystem.

    Signed-off-by: Heikki Krogerus
    [fixes builds with O=...]
    Reviewed-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20200819071733.60028-1-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     

15 Jul, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Acked-by: Shuah Khan
    Link: https://lore.kernel.org/r/20200711123906.16325-1-grandmaster@al2klimov.de
    Signed-off-by: Greg Kroah-Hartman

    Alexander A. Klimov
     

27 Jun, 2020

1 commit

  • While the man page usbipd.8 already informs the user on which
    kernel module has to be used on server side, the man page usbip.8
    does not provide any equivalent information on client side.
    Also, it could be hard for a newbie to identify the proper usbip
    client kernel module, due to the name "vhci-hcd" that has no
    immediate assonance with usbip.

    Add in usbip.8 the command to add the module vhci-hcd, similarly
    as it's already present in usbipd.8 for usbip-host.
    While there, rephrase the description of the command "usbip list
    --remote=server".

    Signed-off-by: Antonio Borneo
    Acked-by: Shuah Khan
    --

    v1->v2: rephrase the description of command "usbip list ..."
    fix a typo in commit message
    Link: https://lore.kernel.org/r/2da8fc9e34440c1fa5f9007baaa3921767cdec50.1593090874.git.borneo.antonio@gmail.com

    Signed-off-by: Greg Kroah-Hartman

    Antonio Borneo
     

24 Jun, 2020

2 commits

  • Commit 64e62426f40d ("staging: usbip: edit Kconfig and rename
    CONFIG options") renamed the module usbip as usbip-host, but the
    example in the man page still reports the old module name.

    Fix the module name in usbipd.8

    Fixes: 64e62426f40d ("staging: usbip: edit Kconfig and rename CONFIG options")
    Acked-by: Shuah Khan
    Signed-off-by: Antonio Borneo
    Acked-by: matt mooney
    Link: https://lore.kernel.org/r/20200618000818.1048203-1-borneo.antonio@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Antonio Borneo
     
  • With GCC 10, building usbip triggers error for multiple definition
    of 'udev_context', in:
    - libsrc/vhci_driver.c:18 and
    - libsrc/usbip_host_common.c:27.

    Declare as extern the definition in libsrc/usbip_host_common.c.

    Signed-off-by: Antonio Borneo
    Acked-by: Shuah Khan
    Link: https://lore.kernel.org/r/20200618000844.1048309-1-borneo.antonio@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Antonio Borneo
     

25 Mar, 2020

1 commit


09 Jan, 2020

1 commit

  • Fix unsafe unaligned pointer usage in usbip network interfaces. usbip tool
    build fails with new gcc -Werror=address-of-packed-member checks.

    usbip_network.c: In function ‘usbip_net_pack_usb_device’:
    usbip_network.c:79:32: error: taking address of packed member of ‘struct usbip_usb_device’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
    79 | usbip_net_pack_uint32_t(pack, &udev->busnum);

    Fix with minor changes to pass by value instead of by address.

    Signed-off-by: Shuah Khan
    Link: https://lore.kernel.org/r/20200109012416.2875-1-skhan@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     

07 Jan, 2020

1 commit


07 Nov, 2019

1 commit


29 Oct, 2019

1 commit


26 Jul, 2019

1 commit

  • GCC8 started emitting warning about using strncpy with number of bytes
    exactly equal destination size which could lead to non-zero terminated
    string being copied. Use "SYSFS_PATH_MAX - 1" & "SYSFS_BUS_ID_SIZE - 1"
    as number of bytes to ensure name is always zero-terminated.

    Signed-off-by: Changcheng Liu
    Acked-by: Shuah Khan
    Link: https://lore.kernel.org/r/20190725132209.GA27590@jerryopenix
    Signed-off-by: Greg Kroah-Hartman

    Liu, Changcheng
     

31 May, 2019

2 commits

  • Based on 3 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version [author] [kishon] [vijay] [abraham]
    [i] [kishon]@[ti] [com] this program is distributed in the hope that
    it will be useful but without any warranty without even the implied
    warranty of merchantability or fitness for a particular purpose see
    the gnu general public license for more details

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version [author] [graeme] [gregory]
    [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
    [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
    [hk] [hemahk]@[ti] [com] this program is distributed in the hope
    that it will be useful but without any warranty without even the
    implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1105 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

24 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    675 mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 441 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Michael Ellerman (powerpc)
    Reviewed-by: Richard Fontana
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

2 commits

  • Based on 2 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not see http www gnu org licenses

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details [based]
    [from] [clk] [highbank] [c] you should have received a copy of the
    gnu general public license along with this program if not see http
    www gnu org licenses

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 355 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Kate Stewart
    Reviewed-by: Jilayne Lovejoy
    Reviewed-by: Steve Winslow
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190519154041.837383322@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Add SPDX license identifiers to all Make/Kconfig files which:

    - Have no license information of any form

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

19 Oct, 2018

1 commit

  • Currently the call to atoi is being passed a single char string
    that is not null terminated, so there is a potential read overrun
    along the stack when parsing for an integer value. Fix this by
    instead using a 2 char string that is initialized to all zeros
    to ensure that a 1 char read into the string is always terminated
    with a \0.

    Detected by cppcheck:
    "Invalid atoi() argument nr 1. A nul-terminated string is required."

    Fixes: 3391ba0e2792 ("usbip: tools: Extract generic code to be shared with vudc backend")
    Signed-off-by: Colin Ian King
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

03 Oct, 2018

1 commit

  • Without this usbip fails on a machine with devices
    that lexicographically come after vhci_hcd.

    ie.
    $ ls -l /sys/devices/platform
    ...
    drwxr-xr-x. 4 root root 0 Sep 19 16:21 serial8250
    -rw-r--r--. 1 root root 4096 Sep 19 23:50 uevent
    drwxr-xr-x. 6 root root 0 Sep 20 13:15 vhci_hcd.0
    drwxr-xr-x. 4 root root 0 Sep 19 16:22 w83627hf.656

    Because it detects 'w83627hf.656' as another vhci_hcd controller,
    and then fails to be able to talk to it.

    Note: this doesn't actually fix usbip's support for multiple
    controllers... that's still broken for other reasons
    ("vhci_hcd.0" is hardcoded in a string macro), but is enough to
    actually make it work on the above machine.

    See also:
    https://bugzilla.redhat.com/show_bug.cgi?id=1631148

    Cc: Jonathan Dieter
    Cc: Valentina Manea
    Cc: Shuah Khan
    Cc: linux-usb@vger.kernel.org
    Signed-off-by: Maciej Żenczykowski
    Acked-by: Shuah Khan (Samsung OSG)
    Tested-by: Jonathan Dieter
    Signed-off-by: Greg Kroah-Hartman

    Maciej Żenczykowski
     

17 Jul, 2018

1 commit

  • The tools/usb/ffs-test.c file defines cpu_to_le16/32 by using the C
    library htole16/32 function calls. However, cpu_to_le16/32 are used when
    initializing structures, i.e in a context where a function call is not
    allowed.

    It works fine on little endian systems because htole16/32 are defined by
    the C library as no-ops. But on big-endian systems, they are actually
    doing something, which might involve calling a function, causing build
    failures, such as:

    ffs-test.c:48:25: error: initializer element is not constant
    #define cpu_to_le32(x) htole32(x)
    ^~~~~~~
    ffs-test.c:128:12: note: in expansion of macro ‘cpu_to_le32’
    .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
    ^~~~~~~~~~~

    To solve this, we code cpu_to_le16/32 in a way that allows them to be
    used when initializing structures. This fix was imported from
    meta-openembedded/android-tools/fix-big-endian-build.patch written by
    Thomas Petazzoni .

    CC: Thomas Petazzoni
    Signed-off-by: Peter Senna Tschudin
    Signed-off-by: Felipe Balbi

    Peter Senna Tschudin
     

31 May, 2018

3 commits

  • usbip detach doesn't check for invalid ports and ports that are already
    detached. It attempts to remove state file(s) without validating the port
    and sends detach request to the driver for ports that are already detached.

    Add check for invalid ports (port > maxports) and ports that are already
    detached (status == VDEV_ST_NULL). Don't remove state files and don't send
    detach request for invalid ports and ports that are already detached.

    Add error and information messages that make sense.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • detach_port() fails to call usbip_vhci_driver_close() from its error
    path after usbip_vhci_detach_device() returns failure, leaking memory
    allocated in usbip_vhci_driver_open() and holding udev_context and udev
    references. Fix it to call usbip_vhci_driver_close().

    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • As the amount of available ports varies by the kernels build
    configuration. To remove the limitation of the fixed 128 ports
    we allocate the amount of idevs by using the number we get
    from the kernel.

    Signed-off-by: Michael Grzeschik
    Acked-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Greg Kroah-Hartman

    Michael Grzeschik
     

22 Mar, 2018

1 commit


10 Mar, 2018

5 commits

  • Changed usbip_network, usbip_attach, usbip_list, and usbipd to use
    and propagate the new error codes in server reply messages.

    usbip_net_recv_op_common() is changed to take a pointer to status
    return the status returned in the op_common.status to callers.

    usbip_attach and usbip_list use the common interface to print error
    messages to indicate why the request failed.

    With this change the messages say why a request failed:

    - when a client requests a device that is already exported:

    usbip attach -r server_name -b 3-10.2
    usbip: error: Attach Request for 3-10.2 failed - Device busy (exported)

    - when a client requests a device that isn't exportable,

    usbip attach -r server_name -b 3-10.4
    usbip: error: Attach Request for 3-10.4 failed - Device not found

    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     
  • Currently ST_OK and ST_NA are the only values used to communicate
    status of a request from a client. Use new error codes to clearly
    indicate what failed. For example, when client sends request to
    import a device that isn't export-able, send ST_DEV_BUSY to the client.

    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     
  • Currently ST_OK and ST_NA are the only values defined to communicate
    status of a request from a client. Add more error codes to clearly
    indicate what failed. For example, when client sends request to import
    a device that isn't export-able, server can send a specific error code
    to the client.

    Existing defines are moved to a common header in libsrc to be included
    in the libusbip_la-usbip_common.o to be used by all the usbip tools.
    Supporting interface to print error strings is added to the common lib.

    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     
  • Kernel and tool version mismatch message is cryptic. Fix it to be
    informative.

    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     
  • Attach device error message is cryptic and useless. Fix it to be
    informative.

    Signed-off-by: Shuah Khan
    Reviewed-by: Krzysztof Opasiak
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     

22 Feb, 2018

1 commit

  • Currently a number of Makefiles break when used with toolchains that
    pass extra flags in CC and other cross-compile related variables (such
    as --sysroot).

    Thus we get this error when we use a toolchain that puts --sysroot in
    the CC var:

    ~/src/linux/tools$ make iio
    [snip]
    iio_event_monitor.c:18:10: fatal error: unistd.h: No such file or directory
    #include
    ^~~~~~~~~~

    This occurs because we clobber several env vars related to
    cross-compiling with lines like this:

    CC = $(CROSS_COMPILE)gcc

    Although this will point to a valid cross-compiler, we lose any extra
    flags that might exist in the CC variable, which can break toolchains
    that rely on them (for example, those that use --sysroot).

    This easily shows up using a Yocto SDK:

    $ . [snip]/sdk/environment-setup-cortexa8hf-neon-poky-linux-gnueabi

    $ echo $CC
    arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard
    -mcpu=cortex-a8
    --sysroot=[snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi

    $ echo $CROSS_COMPILE
    arm-poky-linux-gnueabi-

    $ echo ${CROSS_COMPILE}gcc
    krm-poky-linux-gnueabi-gcc

    Although arm-poky-linux-gnueabi-gcc is a cross-compiler, we've lost the
    --sysroot and other flags that enable us to find the right libraries to
    link against, so we can't find unistd.h and other libraries and headers.
    Normally with the --sysroot flag we would find unistd.h in the sdk
    directory in the sysroot:

    $ find [snip]/sdk/sysroots -path '*/usr/include/unistd.h'
    [snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi/usr/include/unistd.h

    The perf Makefile adds CC = $(CROSS_COMPILE)gcc if and only if CC is not
    already set, and it compiles correctly with the above toolchain.

    So, generalize the logic that perf uses in the common Makefile and
    remove the manual CC = $(CROSS_COMPILE)gcc lines from each Makefile.

    Note that this patch does not fix cross-compile for all the tools (some
    have other bugs), but it does fix it for all except usb and acpi, which
    still have other unrelated issues.

    I tested both with and without the patch on native and cross-build and
    there appear to be no regressions.

    Link: http://lkml.kernel.org/r/20180107214028.23771-1-martin@martingkelly.com
    Signed-off-by: Martin Kelly
    Acked-by: Mark Brown
    Cc: Tejun Heo
    Cc: Li Zefan
    Cc: Johannes Weiner
    Cc: Linus Walleij
    Cc: "K. Y. Srinivasan"
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc: Jonathan Cameron
    Cc: Pali Rohar
    Cc: Richard Purdie
    Cc: Jacek Anaszewski
    Cc: Pavel Machek
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Arnaldo Carvalho de Melo
    Cc: Robert Moore
    Cc: Lv Zheng
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Cc: Valentina Manea
    Cc: Shuah Khan
    Cc: Mario Limonciello
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Martin Kelly
     

22 Jan, 2018

2 commits

  • usbip host lists devices attached to vhci_hcd on the same server
    when user does attach over localhost or specifies the server as the
    remote.

    usbip attach -r localhost -b busid
    or
    usbip attach -r servername (or server IP)

    Fix it to check and not list devices that are attached to vhci_hcd.

    Cc: stable@vger.kernel.org
    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     
  • usbip host binds to devices attached to vhci_hcd on the same server
    when user does attach over localhost or specifies the server as the
    remote.

    usbip attach -r localhost -b busid
    or
    usbip attach -r servername (or server IP)

    Unbind followed by bind works, however device is left in a bad state with
    accesses via the attached busid result in errors and system hangs during
    shutdown.

    Fix it to check and bail out if the device is already attached to vhci_hcd.

    Cc: stable@vger.kernel.org
    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     

05 Jan, 2018

2 commits


02 Jan, 2018

1 commit


19 Dec, 2017

1 commit


18 Dec, 2017

1 commit


09 Dec, 2017

2 commits

  • When a client has a USB device attached over IP, the vhci_hcd driver is
    locally leaking a socket pointer address via the

    /sys/devices/platform/vhci_hcd/status file (world-readable) and in debug
    output when "usbip --debug port" is run.

    Fix it to not leak. The socket pointer address is not used at the moment
    and it was made visible as a convenient way to find IP address from socket
    pointer address by looking up /proc/net/{tcp,tcp6}.

    As this opens a security hole, the fix replaces socket pointer address with
    sockfd.

    Reported-by: Secunia Research
    Cc: stable
    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan
     
  • Fixes following build error:
    vhci_driver.c: In function 'refresh_imported_device_list':
    vhci_driver.c:118:37: error: 'snprintf' output may be truncated before
    the last format character [-Werror=format-truncation=]
    snprintf(status, sizeof(status), "status.%d", i);
    ^~~~~~~~~~~
    vhci_driver.c:118:4: note: 'snprintf' output between 9 and 18 bytes into
    a destination of size 17
    snprintf(status, sizeof(status), "status.%d", i);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

    Signed-off-by: Julien BOIBESSOT
    Acked-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Julien BOIBESSOT
     

07 Dec, 2017

1 commit

  • Indeed musl doesn't define old SIGCLD signal name but only new one SIGCHLD.
    SIGCHLD is the new POSIX name for that signal so it doesn't change
    anything on other libcs.

    This fixes this kind of build error:

    usbipd.c: In function ‘set_signal’:
    usbipd.c:459:12: error: 'SIGCLD' undeclared (first use in this function)
    sigaction(SIGCLD, &act, NULL);
    ^~~~~~
    usbipd.c:459:12: note: each undeclared identifier is reported only once
    for each function it appears in
    Makefile:407: recipe for target 'usbipd.o' failed
    make[3]: *** [usbipd.o] Error 1

    Signed-off-by: Julien BOIBESSOT
    Acked-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Julien BOIBESSOT
     

01 Dec, 2017

1 commit

  • usbip attach fails to find a free port when the device on the first port
    is a USB_SPEED_SUPER device and non-super speed device is being attached.
    It keeps checking the first port and returns without a match getting stuck
    in a loop.

    Fix it check to find the first port with matching speed.

    Reported-by: Juan Zea
    Signed-off-by: Shuah Khan
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan