⬢ DragonFlyBSD Kernel Audit
DF-5449 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/u4b/serial/uvscom.c b/sys/bus/u4b/serial/uvscom.c
index cc0e96f4..b3513cc0 100644
--- a/sys/bus/u4b/serial/uvscom.c
+++ b/sys/bus/u4b/serial/uvscom.c
@@ -177,7 +177,7 @@ static void	uvscom_start_write(struct ucom_softc *);
 static void	uvscom_stop_write(struct ucom_softc *);
 static void	uvscom_cfg_get_status(struct ucom_softc *, uint8_t *,
 		    uint8_t *);
-static void	uvscom_cfg_write(struct uvscom_softc *, uint8_t, uint16_t);
+static usb_error_t uvscom_cfg_write(struct uvscom_softc *, uint8_t, uint16_t);
 static uint16_t	uvscom_cfg_read_status(struct uvscom_softc *);
 static void	uvscom_poll(struct ucom_softc *ucom);
 
@@ -578,7 +578,10 @@ uvscom_cfg_param(struct ucom_softc *ucom, struct termios *t)
 		return;
 	}
 
-	uvscom_cfg_write(sc, UVSCOM_SET_SPEED, value);
+	if (uvscom_cfg_write(sc, UVSCOM_SET_SPEED, value) != 0) {
+		/* DF-5449: device not answering -- abort the chain */
+		return;
+	}
 
 	value = 0;
 
@@ -691,7 +694,7 @@ uvscom_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
 	*msr = sc->sc_msr;
 }
 
-static void
+static usb_error_t
 uvscom_cfg_write(struct uvscom_softc *sc, uint8_t index, uint16_t value)
 {
 	struct usb_device_request req;
@@ -703,12 +706,13 @@ uvscom_cfg_write(struct uvscom_softc *sc, uint8_t index, uint16_t value)
 	USETW(req.wIndex, 0);
 	USETW(req.wLength, 0);
 
-	err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
-	    &req, NULL, 0, 1000);
+	err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
+	    &req, NULL, 0, 250);
 	if (err) {
 		DPRINTFN(0, "device request failed, err=%s "
 		    "(ignored)\n", usbd_errstr(err));
 	}
+	return (err);
 }
 
 static uint16_t
@@ -725,7 +729,7 @@ uvscom_cfg_read_status(struct uvscom_softc *sc)
 	USETW(req.wLength, 2);
 
 	err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
-	    &req, data, 0, 1000);
+	    &req, data, 0, 250);
 	if (err) {
 		DPRINTFN(0, "device request failed, err=%s "
 		    "(ignored)\n", usbd_errstr(err));