⬢ DragonFlyBSD Kernel Audit
DF-3257 / fix.diff
← back to finding ↓ download raw
--- a/sys/vfs/isofs/cd9660/cd9660_bmap.c	2026-06-29 12:51:19.000000000 +0000
+++ b/sys/vfs/isofs/cd9660/cd9660_bmap.c	2026-10-26 03:30:00.392525197 +0000
@@ -71,10 +71,11 @@
 	 */
 	bshift = ip->i_mnt->im_bshift;
 	bsize = 1 << bshift;
+	/* the caller may pass an unaligned offset (SEEK_DATA/SEEK_HOLE walks
+	 * hand us the raw file offset); align it down before mapping */
+	loffset -= loffset & (bsize - 1);
 	*ap->a_doffsetp = loffset + ((off_t)ip->iso_start << bshift);
 
-	KKASSERT((loffset & (bsize - 1)) == 0);
-
 	/*
 	 * Determine maximum number of readahead bytes following the
 	 * requested offset.  Align the result to the nearest block
--- a/sys/vfs/isofs/cd9660/cd9660_vnops.c	2026-06-29 12:51:19.000000000 +0000
+++ b/sys/vfs/isofs/cd9660/cd9660_vnops.c	2026-10-26 03:30:28.480168557 +0000
@@ -222,6 +222,11 @@
 	case FIOGETLBA:
 		*(int *)(ap->a_data) = ip->iso_start;
 		return 0;
+	case FIOSEEKDATA:
+	case FIOSEEKHOLE:
+		/* cd9660_bmap aligns the offset internally */
+		return (vn_bmap_seekhole(ap->a_vp, ap->a_command,
+		    (off_t *)ap->a_data, ap->a_cred));
 	default:
 		return (ENOTTY);
 	}