<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/misc/usbtest.c, branch v4.14.263</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2020-07-09T07:36:30+00:00</updated>
<entry>
<title>usb: usbtest: fix missing kfree(dev-&gt;buf) in usbtest_disconnect</title>
<updated>2020-07-09T07:36:30+00:00</updated>
<author>
<name>Zqiang</name>
<email>qiang.zhang@windriver.com</email>
</author>
<published>2020-06-12T03:52:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4336374bc2220bf3c439b70c31d9e8f6f9583ea8'/>
<id>urn:sha1:4336374bc2220bf3c439b70c31d9e8f6f9583ea8</id>
<content type='text'>
[ Upstream commit 28ebeb8db77035e058a510ce9bd17c2b9a009dba ]

BUG: memory leak
unreferenced object 0xffff888055046e00 (size 256):
  comm "kworker/2:9", pid 2570, jiffies 4294942129 (age 1095.500s)
  hex dump (first 32 bytes):
    00 70 04 55 80 88 ff ff 18 bb 5a 81 ff ff ff ff  .p.U......Z.....
    f5 96 78 81 ff ff ff ff 37 de 8e 81 ff ff ff ff  ..x.....7.......
  backtrace:
    [&lt;00000000d121dccf&gt;] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
    [&lt;00000000d121dccf&gt;] slab_post_alloc_hook mm/slab.h:586 [inline]
    [&lt;00000000d121dccf&gt;] slab_alloc_node mm/slub.c:2786 [inline]
    [&lt;00000000d121dccf&gt;] slab_alloc mm/slub.c:2794 [inline]
    [&lt;00000000d121dccf&gt;] kmem_cache_alloc_trace+0x15e/0x2d0 mm/slub.c:2811
    [&lt;000000005c3c3381&gt;] kmalloc include/linux/slab.h:555 [inline]
    [&lt;000000005c3c3381&gt;] usbtest_probe+0x286/0x19d0
drivers/usb/misc/usbtest.c:2790
    [&lt;000000001cec6910&gt;] usb_probe_interface+0x2bd/0x870
drivers/usb/core/driver.c:361
    [&lt;000000007806c118&gt;] really_probe+0x48d/0x8f0 drivers/base/dd.c:551
    [&lt;00000000a3308c3e&gt;] driver_probe_device+0xfc/0x2a0 drivers/base/dd.c:724
    [&lt;000000003ef66004&gt;] __device_attach_driver+0x1b6/0x240
drivers/base/dd.c:831
    [&lt;00000000eee53e97&gt;] bus_for_each_drv+0x14e/0x1e0 drivers/base/bus.c:431
    [&lt;00000000bb0648d0&gt;] __device_attach+0x1f9/0x350 drivers/base/dd.c:897
    [&lt;00000000838b324a&gt;] device_initial_probe+0x1a/0x20 drivers/base/dd.c:944
    [&lt;0000000030d501c1&gt;] bus_probe_device+0x1e1/0x280 drivers/base/bus.c:491
    [&lt;000000005bd7adef&gt;] device_add+0x131d/0x1c40 drivers/base/core.c:2504
    [&lt;00000000a0937814&gt;] usb_set_configuration+0xe84/0x1ab0
drivers/usb/core/message.c:2030
    [&lt;00000000e3934741&gt;] generic_probe+0x6a/0xe0 drivers/usb/core/generic.c:210
    [&lt;0000000098ade0f1&gt;] usb_probe_device+0x90/0xd0
drivers/usb/core/driver.c:266
    [&lt;000000007806c118&gt;] really_probe+0x48d/0x8f0 drivers/base/dd.c:551
    [&lt;00000000a3308c3e&gt;] driver_probe_device+0xfc/0x2a0 drivers/base/dd.c:724

Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Kyungtae Kim &lt;kt0755@gmail.com&gt;
Signed-off-by: Zqiang &lt;qiang.zhang@windriver.com&gt;
Link: https://lore.kernel.org/r/20200612035210.20494-1-qiang.zhang@windriver.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: usbtest: fix NULL pointer dereference</title>
<updated>2017-10-11T10:15:11+00:00</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2017-09-29T14:54:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7c80f9e4a588f1925b07134bb2e3689335f6c6d8'/>
<id>urn:sha1:7c80f9e4a588f1925b07134bb2e3689335f6c6d8</id>
<content type='text'>
If the usbtest driver encounters a device with an IN bulk endpoint but
no OUT bulk endpoint, it will try to dereference a NULL pointer
(out-&gt;desc.bEndpointAddress).  The problem can be solved by adding a
missing test.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Tested-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>usb: misc: usbtest: Fix overflow in usbtest_do_ioctl()</title>
<updated>2017-10-11T10:14:09+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2017-09-30T08:15:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cb84f56861eb333af0a5bab475d741b13067c05c'/>
<id>urn:sha1:cb84f56861eb333af0a5bab475d741b13067c05c</id>
<content type='text'>
There used to be a test against "if (param-&gt;sglen &gt; MAX_SGLEN)" but it
was removed during a refactor.  It leads to an integer overflow and a
stack overflow in test_queue() if we try to create a too large urbs[]
array on the stack.

There is a second integer overflow in test_queue() as well if
"param-&gt;iterations" is too high.  I don't immediately see that it's
harmful but I've added a check to prevent it and silence the static
checker warning.

Fixes: 18fc4ebdc705 ("usb: misc: usbtest: Remove timeval usage")
Acked-by: Deepa Dinamani &lt;deepa.kernel@gmail.com&gt;
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>usb: misc: refactor code</title>
<updated>2017-04-08T10:04:42+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>garsilva@embeddedor.com</email>
</author>
<published>2017-04-04T03:51:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=65c7843c942d0990e8b5f40aa4fdc755bbc15034'/>
<id>urn:sha1:65c7843c942d0990e8b5f40aa4fdc755bbc15034</id>
<content type='text'>
Code refactoring to make the flow easier to follow.

Signed-off-by: Gustavo A. R. Silva &lt;garsilva@embeddedor.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: misc: add missing continue in switch</title>
<updated>2017-04-08T10:04:42+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>garsilva@embeddedor.com</email>
</author>
<published>2017-04-04T03:48:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c930e3d0aed1505e86e0928d323df5027817740'/>
<id>urn:sha1:2c930e3d0aed1505e86e0928d323df5027817740</id>
<content type='text'>
Add missing continue in switch.

Addresses-Coverity-ID: 1248733
Signed-off-by: Gustavo A. R. Silva &lt;garsilva@embeddedor.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: misc: usbtest: remove redundant check on retval &lt; 0</title>
<updated>2017-02-14T17:32:25+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2017-02-12T18:35:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ef5ec7f08d6750b4786efe8dc76184fd86f85d4c'/>
<id>urn:sha1:ef5ec7f08d6750b4786efe8dc76184fd86f85d4c</id>
<content type='text'>
The check for retval being less than zero is always true since
retval equal to -EPIPE at that point.  Replace the existing
conditional with just return retval.

Detected with CoverityScan, CID#114349 ("Logically dead code")

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Reviewed-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: misc: usbtest: remove unnecessary &amp; operation</title>
<updated>2016-11-03T08:38:27+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>felipe.balbi@linux.intel.com</email>
</author>
<published>2016-09-28T11:17:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=efdd17e66718306c58cd8bab3a50cf8cfa645e8e'/>
<id>urn:sha1:efdd17e66718306c58cd8bab3a50cf8cfa645e8e</id>
<content type='text'>
Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &amp;
operation from this driver.

Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>usb: misc: usbtest: make use of new usb_endpoint_maxp_mult()</title>
<updated>2016-11-03T08:38:21+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>felipe.balbi@linux.intel.com</email>
</author>
<published>2016-09-28T10:40:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=131e19b9e3a5a463ab790db737c72040a918967c'/>
<id>urn:sha1:131e19b9e3a5a463ab790db737c72040a918967c</id>
<content type='text'>
We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>usb: misc: usbtest: add fix for driver hang</title>
<updated>2016-08-11T16:31:51+00:00</updated>
<author>
<name>Lu Baolu</name>
<email>baolu.lu@linux.intel.com</email>
</author>
<published>2016-08-11T02:31:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=539587511835ea12d8daa444cbed766cf2bc3612'/>
<id>urn:sha1:539587511835ea12d8daa444cbed766cf2bc3612</id>
<content type='text'>
In sg_timeout(), req-&gt;status is set to "-ETIMEDOUT" before calling
into usb_sg_cancel(). usb_sg_cancel() will do nothing and return
directly if req-&gt;status has been set to a non-zero value. This will
cause driver hang whenever transfer time out is triggered.

This patch fixes this issue. It could be backported to stable kernel
with version later than v3.15.

Cc: stable@vger.kernel.org # 3.15+
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Lu Baolu &lt;baolu.lu@linux.intel.com&gt;
Suggested-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: misc: usbtest: usbtest_do_ioctl may return positive integer</title>
<updated>2016-08-09T13:45:59+00:00</updated>
<author>
<name>Peter Chen</name>
<email>peter.chen@nxp.com</email>
</author>
<published>2016-07-26T08:01:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=28324936f3d672bbf83472fece8f36a158a52276'/>
<id>urn:sha1:28324936f3d672bbf83472fece8f36a158a52276</id>
<content type='text'>
For case 14 and case 21, their correct return value is the number
of bytes transferred, so it is a positive integer. But in usbtest_ioctl,
it takes non-zero as false return value for usbtest_do_ioctl, so
it will treat the correct test as wrong test, then the time on
tests will be the minus value.

Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Fixes: 18fc4ebdc705 ("usb: misc: usbtest: Remove timeval usage")
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
