Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2019 08:35:50 +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: r342934 - head/usr.sbin/cpucontrol
Message-ID:  <201901110835.x0B8Zoto017156@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jan 11 08:35:49 2019
New Revision: 342934
URL: https://svnweb.freebsd.org/changeset/base/342934

Log:
  cpucontrol: check for the supposed firmware file type and skip
  non-regular entry.
  
  do_update() skips entries with DT_DIR type.  This does not eliminate
  other entries that might exist in the directory.  More, since NFS
  might fill d_type with DT_UNKNOWN, dot and dotdot entries are not
  skipped, then mmap(2) call failed for them when update microcode files
  are located on NFS.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/usr.sbin/cpucontrol/cpucontrol.c

Modified: head/usr.sbin/cpucontrol/cpucontrol.c
==============================================================================
--- head/usr.sbin/cpucontrol/cpucontrol.c	Fri Jan 11 07:58:25 2019	(r342933)
+++ head/usr.sbin/cpucontrol/cpucontrol.c	Fri Jan 11 08:35:49 2019	(r342934)
@@ -369,6 +369,8 @@ try_a_fw_image(const char *dev_path, int devfd, int fw
 		rc = 0;
 		goto out;
 	}
+	if (!S_ISREG(st.st_mode))
+		goto out;
 	if (st.st_size <= 0) {
 		WARN(0, "%s: empty", fw_path);
 		goto out;



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