Date: Wed, 1 Nov 2017 11:37:45 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325276 - head/sys/dev/hwpmc Message-ID: <201711011137.vA1BbjK1076806@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Wed Nov 1 11:37:45 2017 New Revision: 325276 URL: https://svnweb.freebsd.org/changeset/base/325276 Log: Be protective and check the po_file validity before dropping the ref. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D12882 Modified: head/sys/dev/hwpmc/hwpmc_logging.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 1 11:32:52 2017 (r325275) +++ head/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 1 11:37:45 2017 (r325276) @@ -681,8 +681,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?201711011137.vA1BbjK1076806>