⬢ DragonFlyBSD Kernel Audit
DF-2311 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/iicbus/iic.c
+++ b/sys/bus/iicbus/iic.c
@@ -263,6 +263,12 @@
 	error = iicbus_block_read(device_get_parent(iicdev), sc->sc_addr,
 	    sc->sc_inbuf, len, &bufsize);
 	if (error) {
+		/*
+		 * DF-2311: returning here without releasing the bus
+		 * leaves the I2C bus locked forever (iicwrite
+		 * always releases in its counterpart path).
+		 */
+		iicbus_release_bus(device_get_parent(iicdev), iicdev);
 		IIC_UNLOCK(sc);
 		return (error);
 	}