netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/ipv4: Use non-atomic allocation of udp offloads structure instance
@ 2014-01-29 16:08 Or Gerlitz
  2014-01-29 16:20 ` Eric Dumazet
  2014-01-31  0:26 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Or Gerlitz @ 2014-01-29 16:08 UTC (permalink / raw)
  To: davem; +Cc: netdev, dan.carpenter, Or Gerlitz

Since udp_add_offload() can be called from non-sleepable context e.g
under this call tree from the vxlan driver use case:

  vxlan_socket_create() <-- holds the spinlock
  -> vxlan_notify_add_rx_port()
     -> udp_add_offload()  <-- schedules

we should allocate the udp_offloads structure in atomic manner.

Fixes: b582ef0 ('net: Add GRO support for UDP encapsulating protocols')
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 net/ipv4/udp_offload.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 25f5cee..2ffea6f 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -101,7 +101,7 @@ out:
 int udp_add_offload(struct udp_offload *uo)
 {
 	struct udp_offload_priv __rcu **head = &udp_offload_base;
-	struct udp_offload_priv *new_offload = kzalloc(sizeof(*new_offload), GFP_KERNEL);
+	struct udp_offload_priv *new_offload = kzalloc(sizeof(*new_offload), GFP_ATOMIC);
 
 	if (!new_offload)
 		return -ENOMEM;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-31  0:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 16:08 [PATCH net] net/ipv4: Use non-atomic allocation of udp offloads structure instance Or Gerlitz
2014-01-29 16:20 ` Eric Dumazet
2014-01-29 16:42   ` Or Gerlitz
2014-01-29 17:31     ` Eric Dumazet
2014-01-31  0:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).