[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250216163016.57444-1-enjuk@amazon.com>
Date: Mon, 17 Feb 2025 01:30:16 +0900
From: Kohei Enju <enjuk@...zon.com>
To: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: "David S . Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Kuniyuki Iwashima
<kuniyu@...zon.com>, Gilad Naaman <gnaaman@...venets.com>, Joel Granados
<joel.granados@...nel.org>, Li Zetao <lizetao1@...wei.com>, Kohei Enju
<kohei.enju@...il.com>, Kohei Enju <enjuk@...zon.com>
Subject: [PATCH net-next v1] neighbour: Replace kvzalloc() with kzalloc() when GFP_ATOMIC is specified
Replace kvzalloc()/kvfree() with kzalloc()/kfree() when GFP_ATOMIC is
specified, since kvzalloc() doesn't support non-sleeping allocations such
as GFP_ATOMIC.
With incompatible gfp flags, kvzalloc() never falls back to the vmalloc
path and returns immediately after the kmalloc path fails.
Therefore, using kzalloc() is sufficient in this case.
Fixes: 41b3caa7c076 ("neighbour: Add hlist_node to struct neighbour")
Signed-off-by: Kohei Enju <enjuk@...zon.com>
---
net/core/neighbour.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index d8dd686b5287..344c9cd168ec 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -518,7 +518,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
if (!ret)
return NULL;
- hash_heads = kvzalloc(size, GFP_ATOMIC);
+ hash_heads = kzalloc(size, GFP_ATOMIC);
if (!hash_heads) {
kfree(ret);
return NULL;
@@ -536,7 +536,7 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
struct neigh_hash_table,
rcu);
- kvfree(nht->hash_heads);
+ kfree(nht->hash_heads);
kfree(nht);
}
--
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists