All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] packet: free packet_rollover after synchronize_net
@ 2015-06-16 16:51 Willem de Bruijn
  2015-06-16 19:19 ` Eric Dumazet
  2015-06-21 16:31 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Willem de Bruijn @ 2015-06-16 16:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, Willem de Bruijn

From: Willem de Bruijn <willemb@google.com>

Destruction of the po->rollover must be delayed until there are no
more packets in flight that can access it. The field is destroyed in
packet_release, before synchronize_net. Delay using rcu.

Fixes: 0648ab70afe6 ("packet: rollover prepare: per-socket state")

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 net/packet/af_packet.c | 3 ++-
 net/packet/internal.h  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index fd51641..20e8c40 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1634,7 +1634,8 @@ static void fanout_release(struct sock *sk)
 	}
 	mutex_unlock(&fanout_mutex);
 
-	kfree(po->rollover);
+	if (po->rollover)
+		kfree_rcu(po->rollover, rcu);
 }
 
 static const struct proto_ops packet_ops;
diff --git a/net/packet/internal.h b/net/packet/internal.h
index c035d26..e20b3e8 100644
--- a/net/packet/internal.h
+++ b/net/packet/internal.h
@@ -89,6 +89,7 @@ struct packet_fanout {
 
 struct packet_rollover {
 	int			sock;
+	struct rcu_head		rcu;
 	atomic_long_t		num;
 	atomic_long_t		num_huge;
 	atomic_long_t		num_failed;
-- 
2.2.0.rc0.207.ga3a616c

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

* Re: [PATCH net-next] packet: free packet_rollover after synchronize_net
  2015-06-16 16:51 [PATCH net-next] packet: free packet_rollover after synchronize_net Willem de Bruijn
@ 2015-06-16 19:19 ` Eric Dumazet
  2015-06-21 16:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2015-06-16 19:19 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: netdev, davem, edumazet

On Tue, 2015-06-16 at 12:51 -0400, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
> 
> Destruction of the po->rollover must be delayed until there are no
> more packets in flight that can access it. The field is destroyed in
> packet_release, before synchronize_net. Delay using rcu.
> 
> Fixes: 0648ab70afe6 ("packet: rollover prepare: per-socket state")
> 
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Acked-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net-next] packet: free packet_rollover after synchronize_net
  2015-06-16 16:51 [PATCH net-next] packet: free packet_rollover after synchronize_net Willem de Bruijn
  2015-06-16 19:19 ` Eric Dumazet
@ 2015-06-21 16:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-06-21 16:31 UTC (permalink / raw)
  To: willemb; +Cc: netdev, edumazet

From: Willem de Bruijn <willemb@google.com>
Date: Tue, 16 Jun 2015 12:51:37 -0400

> From: Willem de Bruijn <willemb@google.com>
> 
> Destruction of the po->rollover must be delayed until there are no
> more packets in flight that can access it. The field is destroyed in
> packet_release, before synchronize_net. Delay using rcu.
> 
> Fixes: 0648ab70afe6 ("packet: rollover prepare: per-socket state")
> 
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied, thanks Willem.

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

end of thread, other threads:[~2015-06-21 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16 16:51 [PATCH net-next] packet: free packet_rollover after synchronize_net Willem de Bruijn
2015-06-16 19:19 ` Eric Dumazet
2015-06-21 16:31 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.