vfs: set cn_namelen when handling degenerate lookups

Turns out execve looks at it to store binary name, but in order to
trigger the problem one has to be trying to exec '/'. As is the value
would be left uninitialized (or rather set to -1 on debug kernels).

Fixes:	56244d35741a62e7 ("vfs: hoist degenerate path lookups out of the
loop")
This commit is contained in:
Mateusz Guzik 2022-03-25 18:19:36 +00:00
parent 45c4ff15e3
commit 0f60088399

View File

@ -853,6 +853,7 @@ vfs_lookup_degenerate(struct nameidata *ndp, struct vnode *dp, int wantparent)
VREF(dp);
}
ndp->ni_vp = dp;
cnp->cn_namelen = 0;
if (cnp->cn_flags & AUDITVNODE1)
AUDIT_ARG_VNODE1(dp);