⬢ DragonFlyBSD Kernel Audit
DF-5424 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/u4b/serial/uftdi.c
+++ b/sys/bus/u4b/serial/uftdi.c
@@ -366,8 +366,11 @@
 	USETW(req.wValue, FTDI_SIO_RESET_SIO);
 	USETW(req.wIndex, wIndex);
 	USETW(req.wLength, 0);
-	ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
-	    &req, NULL, 0, 1000);
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
+	    &req, NULL, 0, 1000) != 0) {
+		/* DF-5424: device not answering -- abort the chain */
+		return;
+	}
 
 	/* turn on RTS/CTS flow control */
 
@@ -376,8 +379,11 @@
 	USETW(req.wValue, 0);
 	USETW2(req.wIndex, FTDI_SIO_RTS_CTS_HS, wIndex);
 	USETW(req.wLength, 0);
-	ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
-	    &req, NULL, 0, 1000);
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
+	    &req, NULL, 0, 1000) != 0) {
+		/* DF-5424: device not answering -- abort the chain */
+		return;
+	}
 
 	/*
 	 * NOTE: with the new UCOM layer there will always be a
@@ -682,24 +688,33 @@
 	USETW(req.wValue, cfg.rate);
 	USETW(req.wIndex, wIndex);
 	USETW(req.wLength, 0);
-	ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
-	    &req, NULL, 0, 1000);
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
+	    &req, NULL, 0, 1000) != 0) {
+		/* DF-5424: device not answering -- abort the chain */
+		return;
+	}
 
 	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
 	req.bRequest = FTDI_SIO_SET_DATA;
 	USETW(req.wValue, cfg.lcr);
 	USETW(req.wIndex, wIndex);
 	USETW(req.wLength, 0);
-	ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
-	    &req, NULL, 0, 1000);
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
+	    &req, NULL, 0, 1000) != 0) {
+		/* DF-5424: device not answering -- abort the chain */
+		return;
+	}
 
 	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
 	req.bRequest = FTDI_SIO_SET_FLOW_CTRL;
 	USETW2(req.wValue, cfg.v_stop, cfg.v_start);
 	USETW2(req.wIndex, cfg.v_flow, wIndex);
 	USETW(req.wLength, 0);
-	ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
-	    &req, NULL, 0, 1000);
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
+	    &req, NULL, 0, 1000) != 0) {
+		/* DF-5424: device not answering -- abort the chain */
+		return;
+	}
 }
 
 static void