packet: free packet_rollover after synchronize_net
Subsystems (3)
PATCH 1/1 packet: free packet_rollover after synchronize_net
From: Willem de Bruijn <[email protected]>
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.
--- net/packet/af_packet.c | 3 ++- net/packet/internal.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
net/packet/af_packet.c +2 -1
@@ -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;
net/packet/internal.h +1 -0
@@ -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;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Quoted 10 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
Destruction of the
po->rollovermust be delayed until there are no more packets in flight that can access it. The field is destroyed inpacket_release, beforesynchronize_net. Delay using rcu.Fixes 0648ab70afe6 ("packet: rollover prepare: per-socket state")Suggested-by Eric Dumazet <[email protected]>Signed-off-by Willem de Bruijn <[email protected]>
From: Willem de Bruijn <[email protected]>
Date: Tue, 16 Jun 2015 12:51:37 -0400
Quoted 10 lines
From: Willem de Bruijn <[email protected]>
Destruction of the
po->rollovermust be delayed until there are no more packets in flight that can access it. The field is destroyed inpacket_release, beforesynchronize_net. Delay using rcu.Fixes 0648ab70afe6 ("packet: rollover prepare: per-socket state")Suggested-by Eric Dumazet <[email protected]>Signed-off-by Willem de Bruijn <[email protected]>
Applied, thanks Willem.