<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/usbip, branch v4.19.39</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.39</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.39'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-11-13T19:08:41+00:00</updated>
<entry>
<title>usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten</title>
<updated>2018-11-13T19:08:41+00:00</updated>
<author>
<name>Shuah Khan (Samsung OSG)</name>
<email>shuah@kernel.org</email>
</author>
<published>2018-10-18T16:19:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=08c7103daa0d2da9b693a9fddf139ba33d0de886'/>
<id>urn:sha1:08c7103daa0d2da9b693a9fddf139ba33d0de886</id>
<content type='text'>
commit e28fd56ad5273be67d0fae5bedc7e1680e729952 upstream.

In rmmod path, usbip_vudc does platform_device_put() twice once from
platform_device_unregister() and then from put_vudc_device().

The second put results in:

BUG kmalloc-2048 (Not tainted): Poison overwritten error or
BUG: KASAN: use-after-free in kobject_put+0x1e/0x230 if KASAN is
enabled.

[  169.042156] calling  init+0x0/0x1000 [usbip_vudc] @ 1697
[  169.042396] =============================================================================
[  169.043678] probe of usbip-vudc.0 returned 1 after 350 usecs
[  169.044508] BUG kmalloc-2048 (Not tainted): Poison overwritten
[  169.044509] -----------------------------------------------------------------------------
...
[  169.057849] INFO: Freed in device_release+0x2b/0x80 age=4223 cpu=3 pid=1693
[  169.057852] 	kobject_put+0x86/0x1b0
[  169.057853] 	0xffffffffc0c30a96
[  169.057855] 	__x64_sys_delete_module+0x157/0x240

Fix it to call platform_device_del() instead and let put_vudc_device() do
the platform_device_put().

Reported-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control()</title>
<updated>2018-10-09T14:13:42+00:00</updated>
<author>
<name>Shuah Khan (Samsung OSG)</name>
<email>shuah@kernel.org</email>
</author>
<published>2018-10-05T22:17:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=81f7567c51ad97668d1c3a48e8ecc482e64d4161'/>
<id>urn:sha1:81f7567c51ad97668d1c3a48e8ecc482e64d4161</id>
<content type='text'>
vhci_hub_control() accesses port_status array with out of bounds port
value. Fix it to reference port_status[] only with a valid rhport value
when invalid_rhport flag is true.

The invalid_rhport flag is set early on after detecting in port value
is within the bounds or not.

The following is used reproduce the problem and verify the fix:
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14ed8ab6400000

Reported-by: syzbot+bccc1fe10b70fadc78d0@syzkaller.appspotmail.com
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: usbip: remove redundant pointer ep</title>
<updated>2018-07-13T13:41:55+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2018-07-13T10:45:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a7d8205eaee70b55b0fe45fbd77c11e1ad3d7a7e'/>
<id>urn:sha1:a7d8205eaee70b55b0fe45fbd77c11e1ad3d7a7e</id>
<content type='text'>
Pointer ep is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'ep' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbip: vhci_sysfs: fix potential Spectre v1</title>
<updated>2018-05-24T16:14:28+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavo@embeddedor.com</email>
</author>
<published>2018-05-19T01:13:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a0d6ec88090d7b1b008429c44532a388e29bb1bd'/>
<id>urn:sha1:a0d6ec88090d7b1b008429c44532a388e29bb1bd</id>
<content type='text'>
pdev_nr and rhport can be controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:
drivers/usb/usbip/vhci_sysfs.c:238 detach_store() warn: potential spectre issue 'vhcis'
drivers/usb/usbip/vhci_sysfs.c:328 attach_store() warn: potential spectre issue 'vhcis'
drivers/usb/usbip/vhci_sysfs.c:338 attach_store() warn: potential spectre issue 'vhci-&gt;vhci_hcd_ss-&gt;vdev'
drivers/usb/usbip/vhci_sysfs.c:340 attach_store() warn: potential spectre issue 'vhci-&gt;vhci_hcd_hs-&gt;vdev'

Fix this by sanitizing pdev_nr and rhport before using them to index
vhcis and vhci-&gt;vhci_hcd_ss-&gt;vdev respectively.

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&amp;m=152449131114778&amp;w=2

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
Acked-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbip: usbip_host: fix bad unlock balance during stub_probe()</title>
<updated>2018-05-16T16:52:13+00:00</updated>
<author>
<name>Shuah Khan (Samsung OSG)</name>
<email>shuah@kernel.org</email>
</author>
<published>2018-05-15T23:57:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c171654caa875919be3c533d3518da8be5be966e'/>
<id>urn:sha1:c171654caa875919be3c533d3518da8be5be966e</id>
<content type='text'>
stub_probe() calls put_busid_priv() in an error path when device isn't
found in the busid_table. Fix it by making put_busid_priv() safe to be
called with null struct bus_id_priv pointer.

This problem happens when "usbip bind" is run without loading usbip_host
driver and then running modprobe. The first failed bind attempt unbinds
the device from the original driver and when usbip_host is modprobed,
stub_probe() runs and doesn't find the device in its busid table and calls
put_busid_priv(0 with null bus_id_priv pointer.

usbip-host 3-10.2: 3-10.2 is not in match_busid table...  skip!

[  367.359679] =====================================
[  367.359681] WARNING: bad unlock balance detected!
[  367.359683] 4.17.0-rc4+ #5 Not tainted
[  367.359685] -------------------------------------
[  367.359688] modprobe/2768 is trying to release lock (
[  367.359689]
==================================================================
[  367.359696] BUG: KASAN: null-ptr-deref in print_unlock_imbalance_bug+0x99/0x110
[  367.359699] Read of size 8 at addr 0000000000000058 by task modprobe/2768

[  367.359705] CPU: 4 PID: 2768 Comm: modprobe Not tainted 4.17.0-rc4+ #5

Fixes: 22076557b07c ("usbip: usbip_host: fix NULL-ptr deref and use-after-free errors") in usb-linus
Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbip: usbip_host: fix NULL-ptr deref and use-after-free errors</title>
<updated>2018-05-15T07:52:02+00:00</updated>
<author>
<name>Shuah Khan (Samsung OSG)</name>
<email>shuah@kernel.org</email>
</author>
<published>2018-05-15T02:49:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=22076557b07c12086eeb16b8ce2b0b735f7a27e7'/>
<id>urn:sha1:22076557b07c12086eeb16b8ce2b0b735f7a27e7</id>
<content type='text'>
usbip_host updates device status without holding lock from stub probe,
disconnect and rebind code paths. When multiple requests to import a
device are received, these unprotected code paths step all over each
other and drive fails with NULL-ptr deref and use-after-free errors.

The driver uses a table lock to protect the busid array for adding and
deleting busids to the table. However, the probe, disconnect and rebind
paths get the busid table entry and update the status without holding
the busid table lock. Add a new finer grain lock to protect the busid
entry. This new lock will be held to search and update the busid entry
fields from get_busid_idx(), add_match_busid() and del_match_busid().

match_busid_show() does the same to access the busid entry fields.

get_busid_priv() changed to return the pointer to the busid entry holding
the busid lock. stub_probe(), stub_disconnect() and stub_device_rebind()
call put_busid_priv() to release the busid lock before returning. This
changes fixes the unprotected code paths eliminating the race conditions
in updating the busid entries.

Reported-by: Jakub Jirasek
Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbip: usbip_host: run rebind from exit when module is removed</title>
<updated>2018-05-15T07:47:52+00:00</updated>
<author>
<name>Shuah Khan (Samsung OSG)</name>
<email>shuah@kernel.org</email>
</author>
<published>2018-04-30T22:17:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7510df3f29d44685bab7b1918b61a8ccd57126a9'/>
<id>urn:sha1:7510df3f29d44685bab7b1918b61a8ccd57126a9</id>
<content type='text'>
After removing usbip_host module, devices it releases are left without
a driver. For example, when a keyboard or a mass storage device are
bound to usbip_host when it is removed, these devices are no longer
bound to any driver.

Fix it to run device_attach() from the module exit routine to restore
the devices to their original drivers. This includes cleanup changes
and moving device_attach() code to a common routine to be called from
rebind_store() and usbip_host_exit().

Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbip: usbip_host: delete device from busid_table after rebind</title>
<updated>2018-05-15T07:47:47+00:00</updated>
<author>
<name>Shuah Khan (Samsung OSG)</name>
<email>shuah@kernel.org</email>
</author>
<published>2018-04-30T22:17:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1e180f167d4e413afccbbb4a421b48b2de832549'/>
<id>urn:sha1:1e180f167d4e413afccbbb4a421b48b2de832549</id>
<content type='text'>
Device is left in the busid_table after unbind and rebind. Rebind
initiates usb bus scan and the original driver claims the device.
After rescan the device should be deleted from the busid_table as
it no longer belongs to usbip_host.

Fix it to delete the device after device_attach() succeeds.

Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbip: usbip_host: refine probe and disconnect debug msgs to be useful</title>
<updated>2018-05-15T07:47:41+00:00</updated>
<author>
<name>Shuah Khan</name>
<email>shuahkh@osg.samsung.com</email>
</author>
<published>2018-04-12T00:13:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=28b68acc4a88dcf91fd1dcf2577371dc9bf574cc'/>
<id>urn:sha1:28b68acc4a88dcf91fd1dcf2577371dc9bf574cc</id>
<content type='text'>
Refine probe and disconnect debug msgs to be useful and say what is
in progress.

Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbip: usbip_event: fix to not print kernel pointer address</title>
<updated>2018-04-22T12:45:12+00:00</updated>
<author>
<name>Shuah Khan</name>
<email>shuahkh@osg.samsung.com</email>
</author>
<published>2018-04-05T22:29:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4c982482341c64f55daf69b6caa5a2bcd9b43824'/>
<id>urn:sha1:4c982482341c64f55daf69b6caa5a2bcd9b43824</id>
<content type='text'>
Fix it to not print kernel pointer address. Remove the conditional
and debug message as it isn't very useful.

Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
