diff mbox series

[net-next,16/18] gve: Also WARN for skb index equals num_queues.

Message ID 20200818194417.2003932-17-awogbemila@google.com
State Changes Requested
Delegated to: David Miller
Headers show
Series GVE Driver v1.1.0 Features. | expand

Commit Message

David Awogbemila Aug. 18, 2020, 7:44 p.m. UTC
The WARN condition currently checks if the skb's
queue_mapping is (strictly) greater than tx_cfg.num_queues.

queue_mapping == tx_cfg.num_queues should also be invalid
and trigger the WARNing.

Use WARN_ON_ONCE instead otherwise the host will be stuck in syslog
flood.

Signed-off-by: David Awogbemila <awogbemila@google.com>
---
 drivers/net/ethernet/google/gve/gve_tx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c
index 5d75dec1c520..5beff4d4d2e3 100644
--- a/drivers/net/ethernet/google/gve/gve_tx.c
+++ b/drivers/net/ethernet/google/gve/gve_tx.c
@@ -602,8 +602,7 @@  netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev)
 	struct gve_tx_ring *tx;
 	int nsegs;
 
-	WARN(skb_get_queue_mapping(skb) > priv->tx_cfg.num_queues,
-	     "skb queue index out of range");
+	WARN_ON_ONCE(skb_get_queue_mapping(skb) >= priv->tx_cfg.num_queues);
 	tx = &priv->tx[skb_get_queue_mapping(skb)];
 	if (unlikely(gve_maybe_stop_tx(tx, skb))) {
 		/* We need to ring the txq doorbell -- we have stopped the Tx