[Devel] [PATCH RHEL7 COMMIT] vzprivnet6: Mask the jhash value to fit the chain into one page - fix hash access
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Mar 24 08:53:37 PDT 2016
The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.3
------>
commit 9393d1053494a6051009ff7473a1634e847e3115
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date: Thu Mar 24 19:53:37 2016 +0400
vzprivnet6: Mask the jhash value to fit the chain into one page - fix hash access
Port diff-vz-privnet6-fix-hash-access
privnet6: Mask the jhash value to fit the chain into one page...
Ported from rhel5
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
net/ipv6/netfilter/ip6_vzprivnet.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/netfilter/ip6_vzprivnet.c b/net/ipv6/netfilter/ip6_vzprivnet.c
index 44fb61b..3586c72 100644
--- a/net/ipv6/netfilter/ip6_vzprivnet.c
+++ b/net/ipv6/netfilter/ip6_vzprivnet.c
@@ -38,12 +38,14 @@ struct vzprivnet_hash {
static struct vzprivnet_hash hashes[MAX_PREFLEN];
static unsigned hash_rnd;
+#define HASH_MASK ((PAGE_SIZE / sizeof(struct hlist_head)) - 1)
+
static noinline unsigned hash_ip_and_prefix(u32 *ip, unsigned preflen)
{
u32 key[4];
ipv6_addr_prefix((struct in6_addr *)key, (struct in6_addr *)ip, preflen);
- return jhash2(key, 4, hash_rnd);
+ return jhash2(key, 4, hash_rnd) & HASH_MASK;
}
static inline int ip6_match(u32 *net, unsigned plen, u32 *ip)
More information about the Devel
mailing list