svn commit: r368664 - head/sys/dev/usb

Hans Petter Selasky <[email protected]> Tue, 15 Dec 2020 15:36:42 +0000 (UTC)
Newsgroups gmane.os.freebsd.devel.cvs
Message-ID <202012151536.0BFFaguD013318__48654.2796644912$1608046609$gmane$org@repo.freebsd.org>
Author: hselasky
Date: Tue Dec 15 15:36:41 2020
New Revision: 368664
URL: https://svnweb.freebsd.org/changeset/base/368664

Log:
  Improve handling of alternate settings in the USB stack.
  
  Move initialization of num_altsetting under USB_CFG_INIT, else
  there will be a page fault when enumerating USB devices.
  
  PR:		251856
  MFC after:	1 week
  Submitted by:	Ma, Horse <[email protected]>
  Sponsored by:	Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Tue Dec 15 15:33:28 2020	(r368663)
+++ head/sys/dev/usb/usb_device.c	Tue Dec 15 15:36:41 2020	(r368664)
@@ -897,6 +897,9 @@ usb_config_parse(struct usb_device *udev, uint8_t ifac
 				/* initialise interface */
 				do_init = 1;
 			}
+			/* update number of alternate settings, if any */
+			if (iface_index == USB_IFACE_INDEX_ANY)
+				iface->num_altsetting = ips.iface_index_alt + 1;
 		} else
 			do_init = 0;
 
@@ -905,9 +908,6 @@ usb_config_parse(struct usb_device *udev, uint8_t ifac
 			/* update current number of endpoints */
 			ep_curr = ep_max;
 		}
-		/* update number of alternate settings, if any */
-		if (iface_index == USB_IFACE_INDEX_ANY)
-			iface->num_altsetting = ips.iface_index_alt + 1;
 
 		/* check for init */
 		if (do_init) {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"