Commit 59f21118 authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

packet: free packet_rollover after synchronize_net

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: 0648ab70 ("packet: rollover prepare: per-socket state")
Suggested-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 12011962
...@@ -1634,7 +1634,8 @@ static void fanout_release(struct sock *sk) ...@@ -1634,7 +1634,8 @@ static void fanout_release(struct sock *sk)
} }
mutex_unlock(&fanout_mutex); mutex_unlock(&fanout_mutex);
kfree(po->rollover); if (po->rollover)
kfree_rcu(po->rollover, rcu);
} }
static const struct proto_ops packet_ops; static const struct proto_ops packet_ops;
......
...@@ -89,6 +89,7 @@ struct packet_fanout { ...@@ -89,6 +89,7 @@ struct packet_fanout {
struct packet_rollover { struct packet_rollover {
int sock; int sock;
struct rcu_head rcu;
atomic_long_t num; atomic_long_t num;
atomic_long_t num_huge; atomic_long_t num_huge;
atomic_long_t num_failed; atomic_long_t num_failed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment