Date: Wed, 15 Apr 2009 12:59:06 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 160655 for review Message-ID: <200904151259.n3FCx6FT089429@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=160655 Change 160655 by hselasky@hselasky_laptop001 on 2009/04/15 12:59:06 USB CORE: Fix possible issue with clear-stall and set-config happening at the same time. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_device.c#25 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#25 (text+ko) ==== @@ -724,22 +724,33 @@ goto done; } } - udev->pipes_max = ep_max; - udev->pipes = NULL; - if (udev->pipes_max != 0) { - udev->pipes = malloc(sizeof(*pipe) * udev->pipes_max, + if (ep_max != 0) { + udev->pipes = malloc(sizeof(*pipe) * ep_max, M_USB, M_WAITOK | M_ZERO); if (udev->pipes == NULL) { err = USB_ERR_NOMEM; goto done; } + } else { + udev->pipes = NULL; } + USB_BUS_LOCK(udev->bus); + udev->pipes_max = ep_max; + /* reset any ongoing clear-stall */ + udev->pipe_curr = NULL; + USB_BUS_UNLOCK(udev->bus); } done: if (err) { if (cmd == USB_CFG_ALLOC) { cleanup: + USB_BUS_LOCK(udev->bus); + udev->pipes_max = 0; + /* reset any ongoing clear-stall */ + udev->pipe_curr = NULL; + USB_BUS_UNLOCK(udev->bus); + /* cleanup */ if (udev->ifaces != NULL) free(udev->ifaces, M_USB); @@ -749,7 +760,6 @@ udev->ifaces = NULL; udev->pipes = NULL; udev->ifaces_max = 0; - udev->pipes_max = 0; } } return (err);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904151259.n3FCx6FT089429>