DragonFlyBSD Kernel Audit
DF-1742 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/vinum/vinumioctl.c b/sys/dev/raid/vinum/vinumioctl.c
--- a/sys/dev/raid/vinum/vinumioctl.c
+++ b/sys/dev/raid/vinum/vinumioctl.c
@@ -131,15 +131,20 @@
 	     * Specify the index of the object in the first word of data,
 	     * and return the object there
 	     */
-	    index = *(int *) data;
-	    if (index >= (unsigned)vinum_conf.drives_allocated) {
-		error = ENXIO;
-	    } else {
-		bcopy(&DRIVE[index], data, sizeof(struct drive));
-	    }
-	    break;
-
-	case VINUM_SDCONFIG:
+	    index = *(int *) data;
+	    if (index >= (unsigned)vinum_conf.drives_allocated) {
+		error = ENXIO;
+	    } else {
+		struct drive sanitized_drive;
+		sanitized_drive = DRIVE[index];
+		sanitized_drive.vp = NULL;
+		sanitized_drive.dev = NULL;
+		sanitized_drive.lasterror = 0;
+		bcopy(&sanitized_drive, data, sizeof(struct drive));
+	    }
+	    break;
+
+	case VINUM_SDCONFIG:
 	    index = *(int *) data;
 	    if (index >= (unsigned) vinum_conf.subdisks_allocated) {
 		error = ENXIO;