svn commit: r227211 - stable/9/sys/fs/devfs

Konstantin Belousov kib at FreeBSD.org
Sun Nov 6 13:06:32 UTC 2011


Author: kib
Date: Sun Nov  6 13:06:31 2011
New Revision: 227211
URL: http://svn.freebsd.org/changeset/base/227211

Log:
  MFC r227062:
  Fix kernel panic when d_fdopen csw method is called for NULL fp.
  This may happen when kernel consumer calls VOP_OPEN().
  
  Approved by:	re (kensmith)

Modified:
  stable/9/sys/fs/devfs/devfs_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/9/sys/fs/devfs/devfs_vnops.c	Sun Nov  6 13:03:59 2011	(r227210)
+++ stable/9/sys/fs/devfs/devfs_vnops.c	Sun Nov  6 13:06:31 2011	(r227211)
@@ -1050,6 +1050,10 @@ devfs_open(struct vop_open_args *ap)
 	dsw = dev_refthread(dev, &ref);
 	if (dsw == NULL)
 		return (ENXIO);
+	if (fp == NULL && dsw->d_fdopen != NULL) {
+		dev_relthread(dev, ref);
+		return (ENXIO);
+	}
 
 	vlocked = VOP_ISLOCKED(vp);
 	VOP_UNLOCK(vp, 0);


More information about the svn-src-all mailing list