⬢ DragonFlyBSD Kernel Audit
DF-2699 / fix.diff
← back to finding ↓ download raw
--- sys/kern/vfs_subr.c	2026-06-29 12:51:19.000000000 +0000
+++ /tmp/opencode/v26/fixtree/sys/kern/vfs_subr.c	2026-10-24 16:33:07.877714441 +0000
@@ -2269,6 +2269,15 @@
 		error = vn_get_namelen(rvp, &namelen);
 		if (error)
 			return (error);
+		/*
+		 * DF-2699: re-exporting MNT_EXPUBLIC on the same mount
+		 * without MNT_DELEXPORT overwrites np_index; free the
+		 * previous allocation first.
+		 */
+		if (nfs_pub.np_index != NULL) {
+			kfree(nfs_pub.np_index, M_TEMP);
+			nfs_pub.np_index = NULL;
+		}
 		nfs_pub.np_index = kmalloc(namelen, M_TEMP, M_WAITOK);
 		error = copyinstr(argp->ex_indexfile, nfs_pub.np_index,
 		    namelen, NULL);