]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vfs: add NDREINIT to facilitate repeated namei calls
authormjg <mjg@FreeBSD.org>
Thu, 29 Oct 2020 12:56:02 +0000 (12:56 +0000)
committermjg <mjg@FreeBSD.org>
Thu, 29 Oct 2020 12:56:02 +0000 (12:56 +0000)
commit63f74e650a725126cf82382dd877f9eee72d823e
treec2889bb6a91cca748c10d12399c51b676d7a8cd2
parent4d8be72cd109c1bc20c8e0aa56cfaaa669a74469
vfs: add NDREINIT to facilitate repeated namei calls

struct nameidata mixes caller arguments, internal state and output, which
can be quite error prone.

Recent addition of valdiating ni_resflags uncovered a caller which could
repeatedly call namei, effectively operating on partially populated state.

Add bare minimium validation this does not happen. The real fix would
decouple aforementioned state.

Reported by: pho
Tested by: pho (different variant)
sys/kern/vfs_lookup.c
sys/kern/vfs_vnops.c
sys/sys/namei.h