diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 42a319f8953cdac816433b11325315271c8e4e22..789ce59f04c4971363360e5f3a7bc504b8291e3b 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2616,6 +2616,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;