<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/gadget/function, branch linux-6.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-12-31T12:26:27+00:00</updated>
<entry>
<title>usb: gadget: f_hid: fix refcount leak on error path</title>
<updated>2022-12-31T12:26:27+00:00</updated>
<author>
<name>John Keeping</name>
<email>john@metanate.com</email>
</author>
<published>2022-11-22T12:35:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ba78f7c10606719f702c04a15fb0471507b32d7b'/>
<id>urn:sha1:ba78f7c10606719f702c04a15fb0471507b32d7b</id>
<content type='text'>
[ Upstream commit 70a3288a7586526315105c699b687d78cd32559a ]

When failing to allocate report_desc, opts-&gt;refcnt has already been
incremented so it needs to be decremented to avoid leaving the options
structure permanently locked.

Fixes: 21a9476a7ba8 ("usb: gadget: hid: add configfs support")
Tested-by: Lee Jones &lt;lee@kernel.org&gt;
Reviewed-by: Andrzej Pietrasiewicz &lt;andrzej.p@collabora.com&gt;
Reviewed-by: Lee Jones &lt;lee@kernel.org&gt;
Signed-off-by: John Keeping &lt;john@metanate.com&gt;
Link: https://lore.kernel.org/r/20221122123523.3068034-3-john@metanate.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: gadget: f_hid: fix f_hidg lifetime vs cdev</title>
<updated>2022-12-31T12:26:27+00:00</updated>
<author>
<name>John Keeping</name>
<email>john@metanate.com</email>
</author>
<published>2022-11-22T12:35:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9e4b85d815b14bd4db2deea2a54264a23de8b896'/>
<id>urn:sha1:9e4b85d815b14bd4db2deea2a54264a23de8b896</id>
<content type='text'>
[ Upstream commit 89ff3dfac604614287ad5aad9370c3f984ea3f4b ]

The embedded struct cdev does not have its lifetime correctly tied to
the enclosing struct f_hidg, so there is a use-after-free if /dev/hidgN
is held open while the gadget is deleted.

This can readily be replicated with libusbgx's example programs (for
conciseness - operating directly via configfs is equivalent):

	gadget-hid
	exec 3&lt;&gt; /dev/hidg0
	gadget-vid-pid-remove
	exec 3&lt;&amp;-

Pull the existing device up in to struct f_hidg and make use of the
cdev_device_{add,del}() helpers.  This changes the lifetime of the
device object to match struct f_hidg, but note that it is still added
and deleted at the same time.

Fixes: 71adf1189469 ("USB: gadget: add HID gadget driver")
Tested-by: Lee Jones &lt;lee@kernel.org&gt;
Reviewed-by: Andrzej Pietrasiewicz &lt;andrzej.p@collabora.com&gt;
Reviewed-by: Lee Jones &lt;lee@kernel.org&gt;
Signed-off-by: John Keeping &lt;john@metanate.com&gt;
Link: https://lore.kernel.org/r/20221122123523.3068034-2-john@metanate.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: gadget: uvc: Prevent buffer overflow in setup handler</title>
<updated>2022-12-21T16:41:13+00:00</updated>
<author>
<name>Szymon Heidrich</name>
<email>szymon.heidrich@gmail.com</email>
</author>
<published>2022-12-06T14:13:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7b1f773277a72f9756d47a41b94e43506cce1954'/>
<id>urn:sha1:7b1f773277a72f9756d47a41b94e43506cce1954</id>
<content type='text'>
commit 4c92670b16727365699fe4b19ed32013bab2c107 upstream.

Setup function uvc_function_setup permits control transfer
requests with up to 64 bytes of payload (UVC_MAX_REQUEST_SIZE),
data stage handler for OUT transfer uses memcpy to copy req-&gt;actual
bytes to uvc_event-&gt;data.data array of size 60. This may result
in an overflow of 4 bytes.

Fixes: cdda479f15cd ("USB gadget: video class function driver")
Cc: stable &lt;stable@kernel.org&gt;
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Reviewed-by: Daniel Scally &lt;dan.scally@ideasonboard.com&gt;
Signed-off-by: Szymon Heidrich &lt;szymon.heidrich@gmail.com&gt;
Link: https://lore.kernel.org/r/20221206141301.51305-1-szymon.heidrich@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: fix sg handling during video encode</title>
<updated>2022-11-03T15:00:18+00:00</updated>
<author>
<name>Jeff Vanhoof</name>
<email>qjv001@motorola.com</email>
</author>
<published>2022-10-18T21:50:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c028cec22129d61e2673d437dd6150fd710edd9c'/>
<id>urn:sha1:c028cec22129d61e2673d437dd6150fd710edd9c</id>
<content type='text'>
commit b57b08e6f431348363adffa5b6643fe3ec9dc7fe upstream.

In uvc_video_encode_isoc_sg, the uvc_request's sg list is
incorrectly being populated leading to corrupt video being
received by the remote end. When building the sg list the
usage of buf-&gt;sg's 'dma_length' field is not correct and
instead its 'length' field should be used.

Fixes: e81e7f9a0eb9 ("usb: gadget: uvc: add scatter gather support")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jeff Vanhoof &lt;qjv001@motorola.com&gt;
Signed-off-by: Dan Vacura &lt;w36195@motorola.com&gt;
Link: https://lore.kernel.org/r/20221018215044.765044-5-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: fix sg handling in error case</title>
<updated>2022-11-03T15:00:18+00:00</updated>
<author>
<name>Dan Vacura</name>
<email>w36195@motorola.com</email>
</author>
<published>2022-10-18T21:50:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a96c8afe53d1d7bbb44430d06f4b5f638323cac8'/>
<id>urn:sha1:a96c8afe53d1d7bbb44430d06f4b5f638323cac8</id>
<content type='text'>
commit 0a0a2760b04814428800d48281a447a7522470ad upstream.

If there is a transmission error the buffer will be returned too early,
causing a memory fault as subsequent requests for that buffer are still
queued up to be sent. Refactor the error handling to wait for the final
request to come in before reporting back the buffer to userspace for all
transfer types (bulk/isoc/isoc_sg). This ensures userspace knows if the
frame was successfully sent.

Fixes: e81e7f9a0eb9 ("usb: gadget: uvc: add scatter gather support")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Dan Vacura &lt;w36195@motorola.com&gt;
Link: https://lore.kernel.org/r/20221018215044.765044-4-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: fix dropped frame after missed isoc</title>
<updated>2022-11-03T15:00:18+00:00</updated>
<author>
<name>Dan Vacura</name>
<email>w36195@motorola.com</email>
</author>
<published>2022-10-18T21:50:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=912475a2b87da71c15102b8569520dcea461b28c'/>
<id>urn:sha1:912475a2b87da71c15102b8569520dcea461b28c</id>
<content type='text'>
commit 8e8e923a49967b798e7d69f1ce9eff1dd2533547 upstream.

With the re-use of the previous completion status in 0d1c407b1a749
("usb: dwc3: gadget: Return proper request status") it could be possible
that the next frame would also get dropped if the current frame has a
missed isoc error. Ensure that an interrupt is requested for the start
of a new frame.

Fixes: fc78941d8169 ("usb: gadget: uvc: decrease the interrupt load to a quarter")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Dan Vacura &lt;w36195@motorola.com&gt;
Link: https://lore.kernel.org/r/20221018215044.765044-2-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "usb: gadget: uvc: limit isoc_sg to super speed gadgets"</title>
<updated>2022-11-03T15:00:18+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2022-10-26T12:09:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a0928db7c752f107321766a93e09c9b73437d790'/>
<id>urn:sha1:a0928db7c752f107321766a93e09c9b73437d790</id>
<content type='text'>
commit 88c8e05ed5c0f05a637e654bbe4e49a1ebe7013c upstream.

This reverts commit 19905240aef0181d1e6944070eb85fce75f75bcd.

It was a new feature, and it doesn't even work properly yet, so revert
it from this branch as it is not needed for 6.1-final.

Cc: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Cc: stable &lt;stable@kernel.org&gt;
Fixes: 19905240aef0 ("usb: gadget: uvc: limit isoc_sg to super speed gadgets")
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: limit isoc_sg to super speed gadgets</title>
<updated>2022-11-03T15:00:18+00:00</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2022-10-17T22:11:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=48fd5d8c0f6921198b8ff7926c07a498156deff1'/>
<id>urn:sha1:48fd5d8c0f6921198b8ff7926c07a498156deff1</id>
<content type='text'>
commit 19905240aef0181d1e6944070eb85fce75f75bcd upstream.

The overhead of preparing sg data is high for transfers with limited
payload. When transferring isoc over high-speed usb the maximum payload
is rather small which is a good argument no to use sg. This patch is
changing the uvc_video_encode_isoc_sg encode function only to be used
for super speed gadgets.

Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Cc: stable &lt;stable@kernel.org&gt;
Link: https://lore.kernel.org/r/20221017221141.3134818-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: increase worker prio to WQ_HIGHPRI</title>
<updated>2022-10-21T10:39:22+00:00</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2022-09-07T21:58:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5609dcc9c3138e8c2229c94d1ebd89612b17cadc'/>
<id>urn:sha1:5609dcc9c3138e8c2229c94d1ebd89612b17cadc</id>
<content type='text'>
[ Upstream commit 9b91a65230784a9ef644b8bdbb82a79ba4ae9456 ]

This patch is changing the simple workqueue in the gadget driver to be
allocated as async_wq with a higher priority. The pump worker, that is
filling the usb requests, will have a higher priority and will not be
scheduled away so often while the video stream is handled. This will
lead to fewer streaming underruns.

Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20220907215818.2670097-1-m.grzeschik@pengutronix.de
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: gadget: function: fix dangling pnp_string in f_printer.c</title>
<updated>2022-10-21T10:38:48+00:00</updated>
<author>
<name>Albert Briscoe</name>
<email>albertsbriscoe@gmail.com</email>
</author>
<published>2022-09-11T22:37:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=75690346a19e75ddee75071a7bf27432c0833466'/>
<id>urn:sha1:75690346a19e75ddee75071a7bf27432c0833466</id>
<content type='text'>
[ Upstream commit 24b7ba2f88e04800b54d462f376512e8c41b8a3c ]

When opts-&gt;pnp_string is changed with configfs, new memory is allocated for
the string. It does not, however, update dev-&gt;pnp_string, even though the
memory is freed. When rquesting the string, the host then gets old or
corrupted data rather than the new string. The ieee 1284 id string should
be allowed to change while the device is connected.

The bug was introduced in commit fdc01cc286be ("usb: gadget: printer:
Remove pnp_string static buffer"), which changed opts-&gt;pnp_string from a
char[] to a char*.
This patch changes dev-&gt;pnp_string from a char* to a char** pointing to
opts-&gt;pnp_string.

Fixes: fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer")
Signed-off-by: Albert Briscoe &lt;albertsbriscoe@gmail.com&gt;
Link: https://lore.kernel.org/r/20220911223753.20417-1-albertsbriscoe@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>
</feed>
