Re: [PATCH net] net/packet: fix race in tpacket_snd()

2019-08-15 Thread David Miller
From: Eric Dumazet Date: Wed, 14 Aug 2019 02:11:57 -0700 > packet_sendmsg() checks tx_ring.pg_vec to decide > if it must call tpacket_snd(). > > Problem is that the check is lockless, meaning another thread > can issue a concurrent setsockopt(PACKET_TX_RING ) to flip > tx_ring.pg_vec back to NUL

[PATCH net] net/packet: fix race in tpacket_snd()

2019-08-14 Thread Eric Dumazet
packet_sendmsg() checks tx_ring.pg_vec to decide if it must call tpacket_snd(). Problem is that the check is lockless, meaning another thread can issue a concurrent setsockopt(PACKET_TX_RING ) to flip tx_ring.pg_vec back to NULL. Given that tpacket_snd() grabs pg_vec_lock mutex, we can perform th