lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0c789d8-8ae0-4a46-a5b3-aa9a5a758915@rowland.harvard.edu>
Date: Wed, 10 Jul 2024 21:47:39 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: ryan <ryanzhou54@...il.com>
Cc: jikos@...nel.org, gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hid: usbhid: Enable remote wake-up based on device
 configuration

On Thu, Jul 11, 2024 at 07:16:06AM +0800, ryan wrote:
> According to the USB protocol, the host should automatically
> adapt the remote wake-up function based on the configuration
> descriptor reported by the device, rather than only the default
> keyboard support. Therefore, it's necessary to support other hid
> devices, such as digital headsets,mice,etc.

It's true that the host shouldn't try to enable remote wakeup if the 
configuration descriptor shows that the device doesn't support it.

However, it's not true that the host should try to enable remote wakeup 
for devices other than keyboards with boot-protocol support.  History 
has shown that quite a few HID devices don't handle remote wakeup 
properly; the decision about whether to enable it should be left to the 
user.

Alan Stern

> Signed-off-by: ryan <ryanzhou54@...il.com>
> ---
>  drivers/hid/usbhid/hid-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
> index a90ed2ceae84..d2901ad9a871 100644
> --- a/drivers/hid/usbhid/hid-core.c
> +++ b/drivers/hid/usbhid/hid-core.c
> @@ -1179,16 +1179,16 @@ static int usbhid_start(struct hid_device *hid)
>  	/* Some keyboards don't work until their LEDs have been set.
>  	 * Since BIOSes do set the LEDs, it must be safe for any device
>  	 * that supports the keyboard boot protocol.
> -	 * In addition, enable remote wakeup by default for all keyboard
> -	 * devices supporting the boot protocol.
>  	 */
>  	if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT &&
>  			interface->desc.bInterfaceProtocol ==
>  				USB_INTERFACE_PROTOCOL_KEYBOARD) {
>  		usbhid_set_leds(hid);
> -		device_set_wakeup_enable(&dev->dev, 1);
>  	}
>  
> +	if (dev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_WAKEUP)
> +		device_set_wakeup_enable(&dev->dev, 1);
> +
>  	mutex_unlock(&usbhid->mutex);
>  	return 0;
>  
> -- 
> 2.17.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ