Merge r191434 from stable/7 to releng/7.2:
In sysctl_ifdata(), query the ifnet pointer using the index only
once, rather than querying it, validating it, and then re-querying
it without validating it. This may avoid a NULL pointer
dereference and resulting kernel page fault if an interface is
being deleted while bsnmp or other tools are querying data on the
interface.
The full fix, to properly refcount the interface for the duration
of the sysctl, is in 8.x, but is considered too high-risk for
7.2, so instead will appear in 7.3 (if all goes well).
Reported by: mdtancsa
Approved by: re (kensmith)
git-svn-id: svn://svn.freebsd.org/base/releng/7.2@191435
ccf9f872-aa2e-dd11-9fc8-
001c23d0bc1f