⬢ DragonFlyBSD Kernel Audit
DF-2264 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/cam/scsi/scsi_sa.c	2026-10-17 18:26:47.605472930 +0000
+++ b/sys/bus/cam/scsi/scsi_sa.c	2026-10-17 18:26:56.409359887 +0000
@@ -875,7 +875,7 @@
 			if ((periph->flags & CAM_PERIPH_LOCKED) == 0) {
 				error = cam_periph_hold(periph, PCATCH);
 				if (error != 0) {
-					return (error);
+					goto out_locked;
 				}
 				didholdperiph = 1;
 			}
@@ -911,13 +911,14 @@
 			 */
 			error = cam_periph_hold(periph, PCATCH);
 			if (error != 0) {
-				return (error);
+				goto out_locked;
 			}
 			didholdperiph = 1;
 			break;
 
 		default:
-			return (EINVAL);
+			error = EINVAL;
+			goto out_locked;
 		}
 	}
 
@@ -1344,6 +1345,10 @@
 	else
 		cam_periph_unlock(periph);
 	return (error);
+
+out_locked:
+	cam_periph_unlock(periph);
+	return (error);
 }
 
 static void