svn commit: r273845 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Oct 30 07:21:39 UTC 2014


Author: mjg
Date: Thu Oct 30 07:21:38 2014
New Revision: 273845
URL: https://svnweb.freebsd.org/changeset/base/273845

Log:
  filedesc: make sure to force table reload in fget_unlocked when count == 0
  
  This is a fixup to r273843.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Thu Oct 30 06:54:25 2014	(r273844)
+++ head/sys/kern/kern_descrip.c	Thu Oct 30 07:21:38 2014	(r273845)
@@ -2362,7 +2362,12 @@ fget_unlocked(struct filedesc *fdp, int 
 	retry:
 		count = fp->f_count;
 		if (count == 0) {
-			fdt = fdp->fd_files;
+			/*
+			 * Force a reload. Other thread could reallocate the
+			 * table before this fd was closed, so it possible that
+			 * there is a stale fp pointer in cached version.
+			 */
+			fdt = *(struct fdescenttbl * volatile *)&(fdp->fd_files);
 			continue;
 		}
 		/*


More information about the svn-src-all mailing list