Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Nov 2017 12:11:54 +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-11@freebsd.org
Subject:   svn commit: r325550 - stable/11/sys/dev/hwpmc
Message-ID:  <201711081211.vA8CBsV6048322@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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