<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/gadget/function/f_hid.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-07-20T14:21:12Z</updated>
<entry>
<title>usb: gadget: f_hid: fix endianness issue with descriptors</title>
<updated>2021-07-20T14:21:12Z</updated>
<author>
<name>Ruslan Bilovol</name>
</author>
<published>2021-06-17T16:27:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dc138ac10ed44f906561badc353556f212f101ee'/>
<id>urn:sha1:dc138ac10ed44f906561badc353556f212f101ee</id>
<content type='text'>
[ Upstream commit 33cb46c4676d01956811b68a29157ea969a5df70 ]

Running sparse checker it shows warning message about
incorrect endianness used for descriptor initialization:

| f_hid.c:91:43: warning: incorrect type in initializer (different base types)
| f_hid.c:91:43:    expected restricted __le16 [usertype] bcdHID
| f_hid.c:91:43:    got int

Fixing issue with cpu_to_le16() macro, however this is not a real issue
as the value is the same both endians.

Cc: Fabien Chouteau &lt;fabien.chouteau@barco.com&gt;
Cc: Segiy Stetsyuk &lt;serg_stetsuk@ukr.net&gt;
Signed-off-by: Ruslan Bilovol &lt;ruslan.bilovol@gmail.com&gt;
Link: https://lore.kernel.org/r/20210617162755.29676-1-ruslan.bilovol@gmail.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>idr: add ida_is_empty</title>
<updated>2021-03-30T12:41:41Z</updated>
<author>
<name>Matthew Wilcox</name>
</author>
<published>2016-12-14T23:09:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b71c271c6234161c0b8c43253a9d14c33adcf891'/>
<id>urn:sha1:b71c271c6234161c0b8c43253a9d14c33adcf891</id>
<content type='text'>
[ Upstream commit 99c494077e2d4282a17120a772eecc00ec3004cc ]

Two of the USB Gadgets were poking around in the internals of struct ida
in order to determine if it is empty.  Add the appropriate abstraction.

Link: http://lkml.kernel.org/r/1480369871-5271-63-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Acked-by: Konstantin Khlebnikov &lt;koct9i@gmail.com&gt;
Tested-by: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Cc: Ross Zwisler &lt;ross.zwisler@linux.intel.com&gt;
Cc: Felipe Balbi &lt;balbi@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Cc: Matthew Wilcox &lt;mawilcox@microsoft.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: gadget: f_hid: fix deadlock in f_hidg_write()</title>
<updated>2019-04-03T04:24:20Z</updated>
<author>
<name>Radoslav Gerganov</name>
</author>
<published>2019-03-05T10:10:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6c751894b864eaf85e4d2cc431691653be2713c5'/>
<id>urn:sha1:6c751894b864eaf85e4d2cc431691653be2713c5</id>
<content type='text'>
commit 072684e8c58d17e853f8e8b9f6d9ce2e58d2b036 upstream.

In f_hidg_write() the write_spinlock is acquired before calling
usb_ep_queue() which causes a deadlock when dummy_hcd is being used.
This is because dummy_queue() callbacks into f_hidg_req_complete() which
tries to acquire the same spinlock. This is (part of) the backtrace when
the deadlock occurs:

  0xffffffffc06b1410 in f_hidg_req_complete
  0xffffffffc06a590a in usb_gadget_giveback_request
  0xffffffffc06cfff2 in dummy_queue
  0xffffffffc06a4b96 in usb_ep_queue
  0xffffffffc06b1eb6 in f_hidg_write
  0xffffffff8127730b in __vfs_write
  0xffffffff812774d1 in vfs_write
  0xffffffff81277725 in SYSC_write

Fix this by releasing the write_spinlock before calling usb_ep_queue()

Reviewed-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Tested-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Cc: stable@vger.kernel.org # 4.11+
Fixes: 749494b6bdbb ("usb: gadget: f_hid: fix: Move IN request allocation to set_alt()")
Signed-off-by: Radoslav Gerganov &lt;rgerganov@vmware.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: gadget: f_hid: fix: Move IN request allocation to set_alt()</title>
<updated>2018-03-24T10:00:27Z</updated>
<author>
<name>Krzysztof Opasiak</name>
</author>
<published>2017-01-24T02:27:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8dd5c0c47332c67a04830e3842d4d6282f1824fd'/>
<id>urn:sha1:8dd5c0c47332c67a04830e3842d4d6282f1824fd</id>
<content type='text'>
commit 749494b6bdbbaf0899aa1c62a1ad74cd747bce47 upstream.

Since commit: ba1582f22231 ("usb: gadget: f_hid: use alloc_ep_req()")
we cannot allocate any requests in bind() as we check if we should
align request buffer based on endpoint descriptor which is assigned
in set_alt().

Allocating request in bind() function causes a NULL pointer
dereference.

This commit moves allocation of IN request from bind() to set_alt()
to prevent this issue.

Fixes: ba1582f22231 ("usb: gadget: f_hid: use alloc_ep_req()")
Cc: stable@vger.kernel.org
Tested-by: David Lechner &lt;david@lechnology.com&gt;
Signed-off-by: Krzysztof Opasiak &lt;k.opasiak@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Cc: Bin Liu &lt;b-liu@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: gadget: Fix copy/pasted error message</title>
<updated>2017-08-07T01:59:47Z</updated>
<author>
<name>David Lechner</name>
</author>
<published>2017-01-02T23:28:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=92d6a813b03a576dd821667b6566a1ddf7617137'/>
<id>urn:sha1:92d6a813b03a576dd821667b6566a1ddf7617137</id>
<content type='text'>
[ Upstream commit 43aef5c2ca90535b3227e97e71604291875444ed ]

This fixes an error message that was probably copied and pasted. The same
message is used for both the in and out endpoints, so it makes it impossible
to know which one actually failed because both cases say "IN".

Make the out endpoint error message say "OUT".

Signed-off-by: David Lechner &lt;david@lechnology.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: f_hid: Use spinlock instead of mutex</title>
<updated>2017-03-12T05:41:49Z</updated>
<author>
<name>Krzysztof Opasiak</name>
</author>
<published>2017-01-19T17:55:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6d0511ed15db30965f8a3be8f0733bb6efd2b95e'/>
<id>urn:sha1:6d0511ed15db30965f8a3be8f0733bb6efd2b95e</id>
<content type='text'>
commit 33e4c1a9987a1fc3b42c3b534100b5b006d55c61 upstream.

As IN request has to be allocated in set_alt() and released in
disable() we cannot use mutex to protect it as we cannot sleep
in those funcitons. Let's replace this mutex with a spinlock.

Tested-by: David Lechner &lt;david@lechnology.com&gt;
Signed-off-by: Krzysztof Opasiak &lt;k.opasiak@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: gadget: f_hid: fix: Prevent accessing released memory</title>
<updated>2017-03-12T05:41:49Z</updated>
<author>
<name>Krzysztof Opasiak</name>
</author>
<published>2017-01-19T17:55:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d3acd94c0f79387b0d1855bdd4690f1596eb3f25'/>
<id>urn:sha1:d3acd94c0f79387b0d1855bdd4690f1596eb3f25</id>
<content type='text'>
commit aa65d11aa008f4de58a9cee7e121666d9d68505e upstream.

When we unlock our spinlock to copy data to user we may get
disabled by USB host and free the whole list of completed out
requests including the one from which we are copying the data
to user memory.

To prevent from this let's remove our working element from
the list and place it back only if there is sth left when we
finish with it.

Fixes: 99c515005857 ("usb: gadget: hidg: register OUT INT endpoint for SET_REPORT")
Tested-by: David Lechner &lt;david@lechnology.com&gt;
Signed-off-by: Krzysztof Opasiak &lt;k.opasiak@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: gadget: f_hid: fix: Free out requests</title>
<updated>2017-03-12T05:41:49Z</updated>
<author>
<name>Krzysztof Opasiak</name>
</author>
<published>2017-01-19T17:55:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b6092a57150c1641dffb6bfeebbe2cbde7275d1f'/>
<id>urn:sha1:b6092a57150c1641dffb6bfeebbe2cbde7275d1f</id>
<content type='text'>
commit 20d2ca955bd09639c7b01db5761d157c297aea0a upstream.

Requests for out endpoint are allocated in bind() function
but never released.

This commit ensures that all pending requests are released
when we disable out endpoint.

Fixes: 99c515005857 ("usb: gadget: hidg: register OUT INT endpoint for SET_REPORT")
Tested-by: David Lechner &lt;david@lechnology.com&gt;
Signed-off-by: Krzysztof Opasiak &lt;k.opasiak@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: gadget: f_hid: use alloc_ep_req()</title>
<updated>2016-08-25T09:13:20Z</updated>
<author>
<name>Felipe F. Tonello</name>
</author>
<published>2016-08-23T17:24:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ba1582f22231821c57534e87b077d84adbc15dbd'/>
<id>urn:sha1:ba1582f22231821c57534e87b077d84adbc15dbd</id>
<content type='text'>
Use gadget's framework allocation function instead of directly calling
usb_ep_alloc_request().

Signed-off-by: Felipe F. Tonello &lt;eu@felipetonello.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: f_hid: use free_ep_req()</title>
<updated>2016-08-25T09:13:20Z</updated>
<author>
<name>Felipe F. Tonello</name>
</author>
<published>2016-08-23T17:24:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=14794d7133d0f16b4901207a489f04e4e700166a'/>
<id>urn:sha1:14794d7133d0f16b4901207a489f04e4e700166a</id>
<content type='text'>
We should always use free_ep_req() when allocating requests with
alloc_ep_req().

Signed-off-by: Felipe F. Tonello &lt;eu@felipetonello.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
</feed>
