Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jan 2016 09:00:19 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293736 - stable/10/sys/ofed/include/linux
Message-ID:  <201601120900.u0C90JcG009242@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Jan 12 09:00:19 2016
New Revision: 293736
URL: https://svnweb.freebsd.org/changeset/base/293736

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

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

Modified: stable/10/sys/ofed/include/linux/file.h
==============================================================================
--- stable/10/sys/ofed/include/linux/file.h	Tue Jan 12 08:49:40 2016	(r293735)
+++ stable/10/sys/ofed/include/linux/file.h	Tue Jan 12 09:00:19 2016	(r293736)
@@ -95,10 +95,11 @@ fd_install(unsigned int fd, struct linux
 
 	if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file,
 	    NULL) != 0) {
-		file = NULL;
+		filp->_file = NULL;
+	} else {
+		filp->_file = file;
+		finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
 	}
-	filp->_file = file;
-	finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
 
 	/* drop the extra reference */
 	fput(filp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601120900.u0C90JcG009242>