[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200325161116.7082-3-roberto.sassu@huawei.com>
Date: Wed, 25 Mar 2020 17:11:14 +0100
From: Roberto Sassu <roberto.sassu@...wei.com>
To: <zohar@...ux.ibm.com>
CC: <linux-integrity@...r.kernel.org>,
<linux-security-module@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <krzysztof.struczynski@...wei.com>,
<silviu.vlasceanu@...wei.com>, <stable@...r.kernel.org>
Subject: [PATCH 3/5] ima: Fix ima digest hash table key calculation
From: Krzysztof Struczynski <krzysztof.struczynski@...wei.com>
Function hash_long() accepts unsigned long, while currently only one byte
is passed from ima_hash_key(), which calculates a key for ima_htable. Use
more bytes to avoid frequent collisions.
Length of the buffer is not explicitly passed as a function parameter,
because this function expects a digest whose length is greater than the
size of unsigned long.
Cc: stable@...r.kernel.org
Fixes: 3323eec921ef ("integrity: IMA as an integrity service provider")
Signed-off-by: Krzysztof Struczynski <krzysztof.struczynski@...wei.com>
---
security/integrity/ima/ima.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index 64317d95363e..cf0022c2bc14 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -177,7 +177,7 @@ extern struct ima_h_table ima_htable;
static inline unsigned long ima_hash_key(u8 *digest)
{
- return hash_long(*digest, IMA_HASH_BITS);
+ return hash_long(*((unsigned long *)digest), IMA_HASH_BITS);
}
#define __ima_hooks(hook) \
--
2.17.1
Powered by blists - more mailing lists