svn commit: r325550 - stable/11/sys/dev/hwpmc

Konstantin Belousov kib at FreeBSD.org
Wed Nov 8 12:11:56 UTC 2017


Author: kib
Date: Wed Nov  8 12:11:54 2017
New Revision: 325550
URL: https://svnweb.freebsd.org/changeset/base/325550

Log:
  MFC r325276:
  Be protective and check the po_file validity before dropping the ref.

Modified:
  stable/11/sys/dev/hwpmc/hwpmc_logging.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c
==============================================================================
--- stable/11/sys/dev/hwpmc/hwpmc_logging.c	Wed Nov  8 12:10:14 2017	(r325549)
+++ stable/11/sys/dev/hwpmc/hwpmc_logging.c	Wed Nov  8 12:11:54 2017	(r325550)
@@ -685,8 +685,11 @@ pmclog_deconfigure_log(struct pmc_owner *po)
 	}
 
 	/* drop a reference to the fd */
-	error = fdrop(po->po_file, curthread);
-	po->po_file  = NULL;
+	if (po->po_file != NULL) {
+		error = fdrop(po->po_file, curthread);
+		po->po_file  = NULL;
+	} else
+		error = 0;
 	po->po_error = 0;
 
 	return (error);


More information about the svn-src-all mailing list