FreeBSD-10.x-vfs_exports.patch 754 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#
# Backported fix from FreeBSD 11 to avoid a nasty kernel memory leak in
# the filesystem export code. Probably only a problem if you have lots
# (1000+) of exported filesystems and lots of node churn.
#
#   cd /usr/src
#   sudo patch -p0 < patchfile
#

10 11 12 13 14 15 16 17 18 19 20 21 22 23
Index: sys/kern/vfs_export.c
===================================================================
--- sys/kern/vfs_export.c	(revision 325353)
+++ sys/kern/vfs_export.c	(working copy)
@@ -253,8 +253,7 @@
 			(*rnh->rnh_walktree) (rnh, vfs_free_netcred, rnh);
 			RADIX_NODE_HEAD_UNLOCK(rnh);
 			RADIX_NODE_HEAD_DESTROY(rnh);
-			free(rnh, M_RTABLE);
-			nep->ne_rtable[i] = NULL;	/* not SMP safe XXX */
+			rn_detachhead((void **)&nep->ne_rtable[i]);
 		}
 	}
 	cred = nep->ne_defexported.netc_anon;