[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200818194417.2003932-17-awogbemila@google.com>
Date: Tue, 18 Aug 2020 12:44:15 -0700
From: David Awogbemila <awogbemila@...gle.com>
To: netdev@...r.kernel.org
Cc: David Awogbemila <awogbemila@...gle.com>
Subject: [PATCH net-next 16/18] gve: Also WARN for skb index equals num_queues.
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@...gle.com>
---
drivers/net/ethernet/google/gve/gve_tx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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
--
2.28.0.220.ged08abb693-goog
Powered by blists - more mailing lists