dump_common_audit_data(): fix racy accesses to ->d_name
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 5 Jan 2021 19:43:46 +0000 (14:43 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Jan 2021 17:27:29 +0000 (18:27 +0100)
commita3fddad7af2cd1c60d1ea639a94e7d63c693cd23
tree5302272b835c8ff990fcd2f5c836c25ccec6eb8d
parent09b3e0bc8e9a4db653e5a2a626658f96542c344c
dump_common_audit_data(): fix racy accesses to ->d_name

commit d36a1dd9f77ae1e72da48f4123ed35627848507d upstream.

We are not guaranteed the locking environment that would prevent
dentry getting renamed right under us.  And it's possible for
old long name to be freed after rename, leading to UAF here.

Cc: stable@kernel.org # v2.6.2+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/lsm_audit.c