[Devel] [PATCH RH9 23/23] netfilter/x_tables: account entry offsets allocations

Vasily Averin vvs at virtuozzo.com
Sun Sep 26 13:34:09 MSK 2021


Entry offsets may consume a lot of kernel memory. So let's account
them.

https://jira.sw.ru/browse/PSBM-54407

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

(cherry picked from vz7 commit 56c0d7d5cc4b ("netfilter/x_tables: account
entry offsets allocations"))

VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127783

Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
VvS: rh9 rebase.
(cherry picked from commit 563cb8c18fb3cd6007a219ccc4020bd338f52208)
https://jira.sw.ru/browse/PSBM-133990
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 net/netfilter/x_tables.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index f3be58c9bb6b..8e250454e9a7 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -951,8 +951,7 @@ unsigned int *xt_alloc_entry_offsets(unsigned int size)
 	if (size > XT_MAX_TABLE_SIZE / sizeof(unsigned int))
 		return NULL;
 
-	return kvcalloc(size, sizeof(unsigned int), GFP_KERNEL);
-
+	return kvcalloc(size, sizeof(unsigned int), GFP_KERNEL_ACCOUNT);
 }
 EXPORT_SYMBOL(xt_alloc_entry_offsets);
 
-- 
2.25.1



More information about the Devel mailing list