aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/cpucontrol
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-01-11 08:35:49 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-01-11 08:35:49 +0000
commite4e0dad424a79284ad44de86c216bbf4cf202ddb (patch)
treedd42abdc7c47a36f9f7f4db4e17f777d8fd75851 /usr.sbin/cpucontrol
parent6651cf410c7e74738589fd8e92dec98176ee763e (diff)
downloadsrc-e4e0dad424a79284ad44de86c216bbf4cf202ddb.tar.gz
src-e4e0dad424a79284ad44de86c216bbf4cf202ddb.zip
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
Notes
Notes: svn path=/head/; revision=342934
Diffstat (limited to 'usr.sbin/cpucontrol')
-rw-r--r--usr.sbin/cpucontrol/cpucontrol.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.sbin/cpucontrol/cpucontrol.c b/usr.sbin/cpucontrol/cpucontrol.c
index 5904a912bc32..f3bebec9e4d8 100644
--- a/usr.sbin/cpucontrol/cpucontrol.c
+++ b/usr.sbin/cpucontrol/cpucontrol.c
@@ -369,6 +369,8 @@ try_a_fw_image(const char *dev_path, int devfd, int fwdfd, const char *dpath,
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;