vfs: fix vnode use count leak in O_EMPTY_PATH support

The vnode returned by namei_setup is already referenced.

Reported by:	pho
This commit is contained in:
Mateusz Guzik 2021-05-13 11:23:03 +02:00
parent 82483ea7ad
commit cef8a95acb

View File

@ -495,8 +495,10 @@ namei_emptypath(struct nameidata *ndp)
goto errout;
}
/*
* Usecount on dp already provided by namei_setup.
*/
ndp->ni_vp = dp;
vref(dp);
namei_cleanup_cnp(cnp);
pwd_drop(pwd);
ndp->ni_resflags |= NIRES_EMPTYPATH;