<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/gadget/composite.c, branch linux-rolling-lts</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-rolling-lts</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-rolling-lts'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-07-21T14:32:23Z</updated>
<entry>
<title>usb: gadget : fix use-after-free in composite_dev_cleanup()</title>
<updated>2025-07-21T14:32:23Z</updated>
<author>
<name>Tao Xue</name>
</author>
<published>2025-07-21T09:39:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=151c0aa896c47a4459e07fee7d4843f44c1bb18e'/>
<id>urn:sha1:151c0aa896c47a4459e07fee7d4843f44c1bb18e</id>
<content type='text'>
1. In func configfs_composite_bind() -&gt; composite_os_desc_req_prepare():
if kmalloc fails, the pointer cdev-&gt;os_desc_req will be freed but not
set to NULL. Then it will return a failure to the upper-level function.
2. in func configfs_composite_bind() -&gt; composite_dev_cleanup():
it will checks whether cdev-&gt;os_desc_req is NULL. If it is not NULL, it
will attempt to use it.This will lead to a use-after-free issue.

BUG: KASAN: use-after-free in composite_dev_cleanup+0xf4/0x2c0
Read of size 8 at addr 0000004827837a00 by task init/1

CPU: 10 PID: 1 Comm: init Tainted: G           O      5.10.97-oh #1
 kasan_report+0x188/0x1cc
 __asan_load8+0xb4/0xbc
 composite_dev_cleanup+0xf4/0x2c0
 configfs_composite_bind+0x210/0x7ac
 udc_bind_to_driver+0xb4/0x1ec
 usb_gadget_probe_driver+0xec/0x21c
 gadget_dev_desc_UDC_store+0x264/0x27c

Fixes: 37a3a533429e ("usb: gadget: OS Feature Descriptors support")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Tao Xue &lt;xuetao09@huawei.com&gt;
Link: https://lore.kernel.org/r/20250721093908.14967-1-xuetao09@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: Remove unused usb_remove_config</title>
<updated>2025-06-19T10:26:48Z</updated>
<author>
<name>Dr. David Alan Gilbert</name>
</author>
<published>2025-06-08T23:33:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=227280ad66ac50287a3ea8b8fd43b7c7a6eb09ac'/>
<id>urn:sha1:227280ad66ac50287a3ea8b8fd43b7c7a6eb09ac</id>
<content type='text'>
usb_remove_config() was added in 2012's
commit Fixes: 51cce6fc155c ("usb: gadget: composite: Add
usb_remove_config")
but has remained unused.

I see there was a use in drivers/staging/cch that
was removed by
commit 515e6dd20b3f ("Staging: ccg: delete it from the tree")
but it had it's own copy of usb_remove_config()

Remove it.

Signed-off-by: "Dr. David Alan Gilbert" &lt;linux@treblig.org&gt;
Link: https://lore.kernel.org/r/20250608233338.179894-3-linux@treblig.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: composite: Use USB API functions rather than constants</title>
<updated>2025-06-19T10:24:08Z</updated>
<author>
<name>Chen Ni</name>
</author>
<published>2025-06-18T03:55:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=24214604d25beedf2a089bdd7bee8bb801880bcb'/>
<id>urn:sha1:24214604d25beedf2a089bdd7bee8bb801880bcb</id>
<content type='text'>
Use the function usb_endpoint_num() rather than constants.

The Coccinelle semantic patch is as follows:

@@ struct usb_endpoint_descriptor *epd; @@

- (epd-&gt;bEndpointAddress &amp; \(USB_ENDPOINT_NUMBER_MASK\|0x0f\))
+ usb_endpoint_num(epd)

Signed-off-by: Chen Ni &lt;nichen@iscas.ac.cn&gt;
Link: https://lore.kernel.org/r/20250618035540.290411-1-nichen@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: Use get_status callback to set remote wakeup capability</title>
<updated>2025-05-01T15:38:51Z</updated>
<author>
<name>Prashanth K</name>
</author>
<published>2025-04-22T10:32:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5977a58dd5a4865198b0204b998adb0f634abe19'/>
<id>urn:sha1:5977a58dd5a4865198b0204b998adb0f634abe19</id>
<content type='text'>
Currently when the host sends GET_STATUS request for an interface,
we use get_status callbacks to set/clear remote wakeup capability
of that interface. And if get_status callback isn't present for
that interface, then we assume its remote wakeup capability based
on bmAttributes.

Now consider a scenario, where we have a USB configuration with
multiple interfaces (say ECM + ADB), here ECM is remote wakeup
capable and as of now ADB isn't. And bmAttributes will indicate
the device as wakeup capable. With the current implementation,
when host sends GET_STATUS request for both interfaces, we will
set FUNC_RW_CAP for both. This results in USB3 CV Chapter 9.15
(Function Remote Wakeup Test) failures as host expects remote
wakeup from both interfaces.

The above scenario is just an example, and the failure can be
observed if we use configuration with any interface except ECM.
Hence avoid configuring remote wakeup capability from composite
driver based on bmAttributes, instead use get_status callbacks
and let the function drivers decide this.

Cc: stable &lt;stable@kernel.org&gt;
Fixes: 481c225c4802 ("usb: gadget: Handle function suspend feature selector")
Signed-off-by: Prashanth K &lt;prashanth.k@oss.qualcomm.com&gt;
Reviewed-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Link: https://lore.kernel.org/r/20250422103231.1954387-3-prashanth.k@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: Check bmAttributes only if configuration is valid</title>
<updated>2025-03-03T09:12:14Z</updated>
<author>
<name>Prashanth K</name>
</author>
<published>2025-02-24T08:56:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8e812e9355a6f14dffd54a33d951ca403b9732f5'/>
<id>urn:sha1:8e812e9355a6f14dffd54a33d951ca403b9732f5</id>
<content type='text'>
If the USB configuration is not valid, then avoid checking for
bmAttributes to prevent null pointer deference.

Cc: stable &lt;stable@kernel.org&gt;
Fixes: 40e89ff5750f ("usb: gadget: Set self-powered based on MaxPower and bmAttributes")
Signed-off-by: Prashanth K &lt;prashanth.k@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20250224085604.417327-1-prashanth.k@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: Fix setting self-powered state on suspend</title>
<updated>2025-02-20T12:29:37Z</updated>
<author>
<name>Marek Szyprowski</name>
</author>
<published>2025-02-20T12:03:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c783e1258f29c5caac9eea0aea6b172870f1baf8'/>
<id>urn:sha1:c783e1258f29c5caac9eea0aea6b172870f1baf8</id>
<content type='text'>
cdev-&gt;config might be NULL, so check it before dereferencing.

CC: stable &lt;stable@kernel.org&gt;
Fixes: 40e89ff5750f ("usb: gadget: Set self-powered based on MaxPower and bmAttributes")
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Link: https://lore.kernel.org/r/20250220120314.3614330-1-m.szyprowski@samsung.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: Set self-powered based on MaxPower and bmAttributes</title>
<updated>2025-02-19T14:18:55Z</updated>
<author>
<name>Prashanth K</name>
</author>
<published>2025-02-17T12:03:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=40e89ff5750fca2c1d6da93f98a2038716bba86c'/>
<id>urn:sha1:40e89ff5750fca2c1d6da93f98a2038716bba86c</id>
<content type='text'>
Currently the USB gadget will be set as bus-powered based solely
on whether its bMaxPower is greater than 100mA, but this may miss
devices that may legitimately draw less than 100mA but still want
to report as bus-powered. Similarly during suspend &amp; resume, USB
gadget is incorrectly marked as bus/self powered without checking
the bmAttributes field. Fix these by configuring the USB gadget
as self or bus powered based on bmAttributes, and explicitly set
it as bus-powered if it draws more than 100mA.

Cc: stable &lt;stable@kernel.org&gt;
Fixes: 5e5caf4fa8d3 ("usb: gadget: composite: Inform controller driver of self-powered")
Signed-off-by: Prashanth K &lt;prashanth.k@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20250217120328.2446639-1-prashanth.k@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "usb: gadget: composite: fix OS descriptors w_value logic"</title>
<updated>2024-11-16T08:04:34Z</updated>
<author>
<name>Michal Vrastil</name>
</author>
<published>2024-11-13T23:54:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=51cdd69d6a857f527d6d0697a2e1f0fa8bca1005'/>
<id>urn:sha1:51cdd69d6a857f527d6d0697a2e1f0fa8bca1005</id>
<content type='text'>
This reverts commit ec6ce7075ef879b91a8710829016005dc8170f17.

Fix installation of WinUSB driver using OS descriptors. Without the
fix the drivers are not installed correctly and the property
'DeviceInterfaceGUID' is missing on host side.

The original change was based on the assumption that the interface
number is in the high byte of wValue but it is in the low byte,
instead. Unfortunately, the fix is based on MS documentation which is
also wrong.

The actual USB request for OS descriptors (using USB analyzer) looks
like:

Offset  0   1   2   3   4   5   6   7
0x000   C1  A1  02  00  05  00  0A  00

C1: bmRequestType (device to host, vendor, interface)
A1: nas magic number
0002: wValue (2: nas interface)
0005: wIndex (5: get extended property i.e. nas interface GUID)
008E: wLength (142)

The fix was tested on Windows 10 and Windows 11.

Cc: stable@vger.kernel.org
Fixes: ec6ce7075ef8 ("usb: gadget: composite: fix OS descriptors w_value logic")
Signed-off-by: Michal Vrastil &lt;michal.vrastil@hidglobal.com&gt;
Signed-off-by: Elson Roy Serrao &lt;quic_eserrao@quicinc.com&gt;
Acked-by: Peter korsgaard &lt;peter@korsgaard.com&gt;
Link: https://lore.kernel.org/r/20241113235433.20244-1-quic_eserrao@quicinc.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers/usb/gadget: refactor min with min_t</title>
<updated>2024-11-13T14:09:50Z</updated>
<author>
<name>Sabyrzhan Tasbolatov</name>
</author>
<published>2024-11-12T15:58:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b7d49096d595c3413420b02e7851e8b5524353bf'/>
<id>urn:sha1:b7d49096d595c3413420b02e7851e8b5524353bf</id>
<content type='text'>
Ensure type safety by using min_t() instead of casted min().

Signed-off-by: Sabyrzhan Tasbolatov &lt;snovitoll@gmail.com&gt;
Link: https://lore.kernel.org/r/20241112155817.3512577-2-snovitoll@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>move asm/unaligned.h to linux/unaligned.h</title>
<updated>2024-10-02T21:23:23Z</updated>
<author>
<name>Al Viro</name>
</author>
<published>2024-10-01T19:35:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5f60d5f6bbc12e782fac78110b0ee62698f3b576'/>
<id>urn:sha1:5f60d5f6bbc12e782fac78110b0ee62698f3b576</id>
<content type='text'>
asm/unaligned.h is always an include of asm-generic/unaligned.h;
might as well move that thing to linux/unaligned.h and include
that - there's nothing arch-specific in that header.

auto-generated by the following:

for i in `git grep -l -w asm/unaligned.h`; do
	sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i
done
for i in `git grep -l -w asm-generic/unaligned.h`; do
	sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i
done
git mv include/asm-generic/unaligned.h include/linux/unaligned.h
git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h
sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild
sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
</content>
</entry>
</feed>
