svn commit: r293737 - stable/9/sys/ofed/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Tue Jan 12 09:03:40 UTC 2016


Author: hselasky
Date: Tue Jan 12 09:03:39 2016
New Revision: 293737
URL: https://svnweb.freebsd.org/changeset/base/293737

Log:
  MFC r292989:
  Handle when filedescriptors are closed before initialized. An early
  fdclose() call can cause fget_unlocked() to fail.

Modified:
  stable/9/sys/ofed/include/linux/file.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ofed/include/linux/file.h
==============================================================================
--- stable/9/sys/ofed/include/linux/file.h	Tue Jan 12 09:00:19 2016	(r293736)
+++ stable/9/sys/ofed/include/linux/file.h	Tue Jan 12 09:03:39 2016	(r293737)
@@ -90,8 +90,12 @@ fd_install(unsigned int fd, struct linux
 	struct file *file;
 
 	file = fget_unlocked(curthread->td_proc->p_fd, fd);
-	filp->_file = file;
-	finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
+	if (file == NULL) {
+		filp->_file = NULL;
+	} else {
+		filp->_file = file;
+		finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
+	}
 
 	/* drop the extra reference */
 	fput(filp);


More information about the svn-src-stable mailing list