]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
res_find: Fix fallback logic
authorkevans <kevans@FreeBSD.org>
Sat, 18 Aug 2018 19:45:56 +0000 (19:45 +0000)
committerkevans <kevans@FreeBSD.org>
Sat, 18 Aug 2018 19:45:56 +0000 (19:45 +0000)
commitad8cc64e2bbc2750a8552ef57e33b49fcc5e91f1
treec5caa40e7fd2ad20d3753aa3e0c39ae7ed7aac39
parent453e23bd43cd429887ebf43566bd56f387571565
res_find: Fix fallback logic

The fallback logic was broken if hints were found in multiple environments.
If we found a hint in either the loader environment or the static
environment, fallback would be incremented excessively when we returned to
the environment-selection bits. These checks should have also been guarded
by the fbacklvl checks. As a result, fbacklvl could quickly get to a point
where we skip either the static environment and/or the static hints
depending on which environments contained valid hints.

The impact of this bug is minimal, mostly affecting mips boards that use
static hints and may have hints in either the loader environment or the
static environment.

There may be better ways to express the searchable environments and
describing their characteristics (immutable, already searched, etc.) but
this may be revisited after 12 branches.

Reported by: Dan Nelson <dnelson_1901@yahoo.com>
Triaged by: Dan Nelson <dnelson_1901@yahoo.com>
MFC after: 3 days
sys/kern/subr_hints.c