]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
integrity: Fix possible multiple allocation in integrity_inode_get()
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Thu, 1 Jun 2023 06:42:44 +0000 (14:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 09:33:41 +0000 (11:33 +0200)
commit4868a24a4ccee09d25ec51f431e5910669e91aa0
tree4f253cc6fdd5c5c802cf6360e4235ba397a982b1
parentd24e1c4d5b25ea19296104037a2458e2ad758112
integrity: Fix possible multiple allocation in integrity_inode_get()

commit 9df6a4870dc371136e90330cfbbc51464ee66993 upstream.

When integrity_inode_get() is querying and inserting the cache, there
is a conditional race in the concurrent environment.

The race condition is the result of not properly implementing
"double-checked locking". In this case, it first checks to see if the
iint cache record exists before taking the lock, but doesn't check
again after taking the integrity_iint_lock.

Fixes: bf2276d10ce5 ("ima: allocating iint improvements")
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/integrity/iint.c