diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2017-12-07 16:16:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-08 11:32:23 -0500 |
commit | 2f2d0088eb93db5c649d2a5e34a3800a8a935fc5 (patch) | |
tree | eb94be1cc6a34b0230112e8c1154d8d646e04fb8 /tools/usb/usbip/libsrc | |
parent | c6688ef9f29762e65bce325ef4acd6c675806366 (diff) |
usbip: prevent vhci_hcd driver from leaking a socket pointer address
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 <vuln@secunia.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/usb/usbip/libsrc')
-rw-r--r-- | tools/usb/usbip/libsrc/vhci_driver.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index 627d1dfc332b..c9c81614a66a 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c | |||
@@ -50,14 +50,14 @@ static int parse_status(const char *value) | |||
50 | 50 | ||
51 | while (*c != '\0') { | 51 | while (*c != '\0') { |
52 | int port, status, speed, devid; | 52 | int port, status, speed, devid; |
53 | unsigned long socket; | 53 | int sockfd; |
54 | char lbusid[SYSFS_BUS_ID_SIZE]; | 54 | char lbusid[SYSFS_BUS_ID_SIZE]; |
55 | struct usbip_imported_device *idev; | 55 | struct usbip_imported_device *idev; |
56 | char hub[3]; | 56 | char hub[3]; |
57 | 57 | ||
58 | ret = sscanf(c, "%2s %d %d %d %x %lx %31s\n", | 58 | ret = sscanf(c, "%2s %d %d %d %x %u %31s\n", |
59 | hub, &port, &status, &speed, | 59 | hub, &port, &status, &speed, |
60 | &devid, &socket, lbusid); | 60 | &devid, &sockfd, lbusid); |
61 | 61 | ||
62 | if (ret < 5) { | 62 | if (ret < 5) { |
63 | dbg("sscanf failed: %d", ret); | 63 | dbg("sscanf failed: %d", ret); |
@@ -66,7 +66,7 @@ static int parse_status(const char *value) | |||
66 | 66 | ||
67 | dbg("hub %s port %d status %d speed %d devid %x", | 67 | dbg("hub %s port %d status %d speed %d devid %x", |
68 | hub, port, status, speed, devid); | 68 | hub, port, status, speed, devid); |
69 | dbg("socket %lx lbusid %s", socket, lbusid); | 69 | dbg("sockfd %u lbusid %s", sockfd, lbusid); |
70 | 70 | ||
71 | /* if a device is connected, look at it */ | 71 | /* if a device is connected, look at it */ |
72 | idev = &vhci_driver->idev[port]; | 72 | idev = &vhci_driver->idev[port]; |