Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Feb 2016 17:21:19 +0000 (UTC)
From:      Konstantin Belousov <kib@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: r295613 - stable/10/sys/fs/devfs
Message-ID:  <201602141721.u1EHLJmD016036@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Feb 14 17:21:19 2016
New Revision: 295613
URL: https://svnweb.freebsd.org/changeset/base/295613

Log:
  MFC r294595:
  When devfs dirent is freed, a vnode might still keep a pointer to it,
  apparently.  Interlock and clear the pointer to avoid free memory
  dereference.
  
  Approved by:	re (marius)

Modified:
  stable/10/sys/fs/devfs/devfs_devs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/devfs/devfs_devs.c
==============================================================================
--- stable/10/sys/fs/devfs/devfs_devs.c	Sun Feb 14 16:38:32 2016	(r295612)
+++ stable/10/sys/fs/devfs/devfs_devs.c	Sun Feb 14 17:21:19 2016	(r295613)
@@ -304,6 +304,13 @@ devfs_vmkdir(struct devfs_mount *dmp, ch
 void
 devfs_dirent_free(struct devfs_dirent *de)
 {
+	struct vnode *vp;
+
+	vp = de->de_vnode;
+	mtx_lock(&devfs_de_interlock);
+	if (vp != NULL && vp->v_data == de)
+		vp->v_data = NULL;
+	mtx_unlock(&devfs_de_interlock);
 	free(de, M_DEVFS3);
 }
 



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