<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/core/sysfs.c, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-09-04T11:25:04+00:00</updated>
<entry>
<title>usb: core: sysfs: Unmerge @usb3_hardware_lpm_attr_group in remove_power_attributes()</title>
<updated>2024-09-04T11:25:04+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-08-20T11:01:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=38e73085321805c8c92a2133f6e546f67ce7607f'/>
<id>urn:sha1:38e73085321805c8c92a2133f6e546f67ce7607f</id>
<content type='text'>
commit 3a8839bbb86da7968a792123ed2296d063871a52 upstream.

Device attribute group @usb3_hardware_lpm_attr_group is merged by
add_power_attributes(), but it is not unmerged explicitly, fixed by
unmerging it in remove_power_attributes().

Fixes: 655fe4effe0f ("usbcore: add sysfs support to xHCI usb3 hardware LPM")
Cc: stable@vger.kernel.org
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/r/20240820-sysfs_fix-v2-1-a9441487077e@quicinc.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: core: Fix deadlock in usb_deauthorize_interface()</title>
<updated>2024-04-03T13:19:55+00:00</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2024-03-12T15:48:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ab062fa3dc69aea88fe62162c5881ba14b50ecc5'/>
<id>urn:sha1:ab062fa3dc69aea88fe62162c5881ba14b50ecc5</id>
<content type='text'>
commit 80ba43e9f799cbdd83842fc27db667289b3150f5 upstream.

Among the attribute file callback routines in
drivers/usb/core/sysfs.c, the interface_authorized_store() function is
the only one which acquires a device lock on an ancestor device: It
calls usb_deauthorize_interface(), which locks the interface's parent
USB device.

The will lead to deadlock if another process already owns that lock
and tries to remove the interface, whether through a configuration
change or because the device has been disconnected.  As part of the
removal procedure, device_del() waits for all ongoing sysfs attribute
callbacks to complete.  But usb_deauthorize_interface() can't complete
until the device lock has been released, and the lock won't be
released until the removal has finished.

The mechanism provided by sysfs to prevent this kind of deadlock is
to use the sysfs_break_active_protection() function, which tells sysfs
not to wait for the attribute callback.

Reported-and-tested by: Yue Sun &lt;samsun1006219@gmail.com&gt;
Reported by: xingwei lee &lt;xrivendell7@gmail.com&gt;

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Link: https://lore.kernel.org/linux-usb/CAEkJfYO6jRVC8Tfrd_R=cjO0hguhrV31fDPrLrNOOHocDkPoAA@mail.gmail.com/#r
Fixes: 310d2b4124c0 ("usb: interface authorization: SysFS part of USB interface authorization")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1c37eea1-9f56-4534-b9d8-b443438dc869@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: core: Don't hold device lock while reading the "descriptors" sysfs file</title>
<updated>2023-03-03T10:52:25+00:00</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2023-01-31T20:49:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c87fb861ec185fdc578b4fdc6a05920b6a843840'/>
<id>urn:sha1:c87fb861ec185fdc578b4fdc6a05920b6a843840</id>
<content type='text'>
commit 45bf39f8df7f05efb83b302c65ae3b9bc92b7065 upstream.

Ever since commit 83e83ecb79a8 ("usb: core: get config and string
descriptors for unauthorized devices") was merged in 2013, there has
been no mechanism for reallocating the rawdescriptors buffers in
struct usb_device after the initial enumeration.  Before that commit,
the buffers would be deallocated when a device was deauthorized and
reallocated when it was authorized and enumerated.

This means that the locking in the read_descriptors() routine is not
needed, since the buffers it reads will never be reallocated while the
routine is running.  This locking can interfere with user programs
trying to read a hub's descriptors via sysfs while new child devices
of the hub are being initialized, since the hub is locked during this
procedure.

Since the locking in read_descriptors() hasn't been needed for over
nine years, we can remove it.

Reported-and-tested-by: Troels Liebe Bentsen &lt;troels@connectedcars.dk&gt;
Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
CC: stable@vger.kernel.org
Link: https://lore.kernel.org/r/Y9l+wDTRbuZABzsE@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: core: sysfs: convert sysfs snprintf to sysfs_emit</title>
<updated>2022-06-27T12:58:26+00:00</updated>
<author>
<name>Xuezhi Zhang</name>
<email>zhangxuezhi1@coolpad.com</email>
</author>
<published>2022-06-24T12:12:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6569689e78299ff91002960a163012b576f2b21a'/>
<id>urn:sha1:6569689e78299ff91002960a163012b576f2b21a</id>
<content type='text'>
Fix up all sysfs show entries to use sysfs_emit

Signed-off-by: Xuezhi Zhang &lt;zhangxuezhi1@coolpad.com&gt;
Link: https://lore.kernel.org/r/20220624121238.134256-1-zhangxuezhi1@coolpad.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver core: Move the "removable" attribute from USB to core</title>
<updated>2021-05-27T07:36:31+00:00</updated>
<author>
<name>Rajat Jain</name>
<email>rajatja@google.com</email>
</author>
<published>2021-05-24T17:18:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=70f400d4d957c2453c8689552ff212bc59f88938'/>
<id>urn:sha1:70f400d4d957c2453c8689552ff212bc59f88938</id>
<content type='text'>
Move the "removable" attribute from USB to core in order to allow it to be
supported by other subsystem / buses. Individual buses that want to support
this attribute can populate the removable property of the device while
enumerating it with the 3 possible values -
 - "unknown"
 - "fixed"
 - "removable"
Leaving the field unchanged (i.e. "not supported") would mean that the
attribute would not show up in sysfs for that device. The UAPI (location,
symantics etc) for the attribute remains unchanged.

Move the "removable" attribute from USB to the device core so it can be
used by other subsystems / buses.

By default, devices do not have a "removable" attribute in sysfs.

If a subsystem or bus driver wants to support a "removable" attribute, it
should call device_set_removable() before calling device_register() or
device_add(), e.g.:

    device_set_removable(dev, DEVICE_REMOVABLE);
    device_register(dev);

The possible values and the resulting sysfs attribute contents are:

    DEVICE_REMOVABLE_UNKNOWN  -&gt;  "unknown"
    DEVICE_REMOVABLE          -&gt;  "removable"
    DEVICE_FIXED              -&gt;  "fixed"

Convert the USB "removable" attribute to use this new device core
functionality.  There should be no user-visible change in the location or
semantics of attribute for USB devices.

Reviewed-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Signed-off-by: Rajat Jain &lt;rajatja@google.com&gt;
Link: https://lore.kernel.org/r/20210524171812.18095-1-rajatja@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: core: sysfs: Check for SSP rate in speed attr</title>
<updated>2021-03-23T12:18:22+00:00</updated>
<author>
<name>Thinh Nguyen</name>
<email>Thinh.Nguyen@synopsys.com</email>
</author>
<published>2021-03-11T03:43:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d07247ff2515d7d2db60e6492cd4662d87bf7bf2'/>
<id>urn:sha1:d07247ff2515d7d2db60e6492cd4662d87bf7bf2</id>
<content type='text'>
Check for usb_device-&gt;ssp_rate to output the signaling rate for genXxY.

Signed-off-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Link: https://lore.kernel.org/r/80a3214592b30da6ca95bb87984f2a9779de0b14.1615432770.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: core: Constify static attribute_group structs</title>
<updated>2020-11-26T12:40:42+00:00</updated>
<author>
<name>Rikard Falkeborn</name>
<email>rikard.falkeborn@gmail.com</email>
</author>
<published>2020-11-25T16:24:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4154a4f70a9488212f8731770e10eae957d33da9'/>
<id>urn:sha1:4154a4f70a9488212f8731770e10eae957d33da9</id>
<content type='text'>
These are never modified, so make them const to allow the compiler to
put them in read-only memory. Done with the help of coccinelle.

Signed-off-by: Rikard Falkeborn &lt;rikard.falkeborn@gmail.com&gt;
Link: https://lore.kernel.org/r/20201125162500.37228-2-rikard.falkeborn@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: core: fix slab-out-of-bounds Read in read_descriptors</title>
<updated>2020-09-04T14:41:22+00:00</updated>
<author>
<name>Zeng Tao</name>
<email>prime.zeng@hisilicon.com</email>
</author>
<published>2020-09-04T06:37:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a18cd6c9b6bc73dc17e8b7e9bd07decaa8833c97'/>
<id>urn:sha1:a18cd6c9b6bc73dc17e8b7e9bd07decaa8833c97</id>
<content type='text'>
The USB device descriptor may get changed between two consecutive
enumerations on the same device for some reason, such as DFU or
malicius device.
In that case, we may access the changing descriptor if we don't take
the device lock here.

The issue is reported:
https://syzkaller.appspot.com/bug?id=901a0d9e6519ef8dc7acab25344bd287dd3c7be9

Cc: stable &lt;stable@vger.kernel.org&gt;
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: syzbot+256e56ddde8b8957eabd@syzkaller.appspotmail.com
Fixes: 217a9081d8e6 ("USB: add all configs to the "descriptors" attribute")
Signed-off-by: Zeng Tao &lt;prime.zeng@hisilicon.com&gt;
Link: https://lore.kernel.org/r/1599201467-11000-1-git-send-email-prime.zeng@hisilicon.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: core: Replace an empty statement with a debug message</title>
<updated>2020-04-23T13:28:13+00:00</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2020-04-22T20:20:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a6cd27e9b594ccf4bf525969c1077f2dbe515476'/>
<id>urn:sha1:a6cd27e9b594ccf4bf525969c1077f2dbe515476</id>
<content type='text'>
This patch adds a dev_dbg() message to usb_create_sysfs_intf_files().
The message is not expected ever to appear; it's real purpose is to
satisfy the __must_check attribute on device_create_file() without
triggering a compiler warning about an empty statement.

In fact we don't really care if the sysfs attribute file doesn't get
created.  The interface string descriptor is purely informational and
hardly ever present.

Suggested-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;

Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2004221618500.11262-100000@iolanthe.rowland.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: use kobj_to_dev() API</title>
<updated>2020-02-14T16:38:15+00:00</updated>
<author>
<name>chenqiwu</name>
<email>chenqiwu@xiaomi.com</email>
</author>
<published>2020-02-14T12:37:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0616ca73fd35409b0d8d2a17bbca42f6febcd235'/>
<id>urn:sha1:0616ca73fd35409b0d8d2a17bbca42f6febcd235</id>
<content type='text'>
Use kobj_to_dev() API instead of container_of().

Signed-off-by: chenqiwu &lt;chenqiwu@xiaomi.com&gt;
Link: https://lore.kernel.org/r/1581683820-9978-1-git-send-email-qiwuchen55@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
