]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ima: Fix use-after-free on a dentry's dname.name
authorStefan Berger <stefanb@linux.ibm.com>
Fri, 22 Mar 2024 14:03:12 +0000 (10:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:45 +0000 (19:51 +0100)
commit0b31e28fbd773aefb6164687e0767319b8199829
tree40baa9ee001a171e6ce40aa220a3222a86e5e2db
parent801d64177faaec184cee1e1aa4d8487df1364a54
ima: Fix use-after-free on a dentry's dname.name

commit be84f32bb2c981ca670922e047cdde1488b233de upstream.

->d_name.name can change on rename and the earlier value can be freed;
there are conditions sufficient to stabilize it (->d_lock on dentry,
->d_lock on its parent, ->i_rwsem exclusive on the parent's inode,
rename_lock), but none of those are met at any of the sites. Take a stable
snapshot of the name instead.

Link: https://lore.kernel.org/all/20240202182732.GE2087318@ZenIV/
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Libo Chen <libo.chen.cn@windriver.com>
security/integrity/ima/ima_api.c
security/integrity/ima/ima_template_lib.c