diff options
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index c78bcc13ebab..5d8988185c59 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2498,6 +2498,13 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) mutex_lock(&po->pg_vec_lock); + /* packet_sendmsg() check on tx_ring.pg_vec was lockless, + * we need to confirm it under protection of pg_vec_lock. + */ + if (unlikely(!po->tx_ring.pg_vec)) { + err = -EBUSY; + goto out; + } if (likely(saddr == NULL)) { dev = packet_cached_dev_get(po); proto = po->num; |