Skip to content

Commit 978e117

Browse files
haiyangzmehmetb0
authored andcommitted
net: mana: Fix TX CQE error handling
[ Upstream commit b2b0000 ] For an unknown TX CQE error type (probably from a newer hardware), still free the SKB, update the queue tail, etc., otherwise the accounting will be wrong. Also, TX errors can be triggered by injecting corrupted packets, so replace the WARN_ONCE to ratelimited error logging. Cc: [email protected] Fixes: ca9c54d ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)") Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Shradha Gupta <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit b67d7b1bfc46d05c1a58b172516454698e8d5004 linux-6.1.y) CVE-2023-52532 Signed-off-by: Massimiliano Pellizzer <[email protected]> Acked-by: Koichiro Den <[email protected]> Acked-by: Chris Chiu <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent f2e19b8 commit 978e117

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -828,17 +828,21 @@ static void mana_poll_tx_cq(struct mana_cq *cq)
828828
case CQE_TX_VPORT_IDX_OUT_OF_RANGE:
829829
case CQE_TX_VPORT_DISABLED:
830830
case CQE_TX_VLAN_TAGGING_VIOLATION:
831-
WARN_ONCE(1, "TX: CQE error %d: ignored.\n",
832-
cqe_oob->cqe_hdr.cqe_type);
831+
if (net_ratelimit())
832+
netdev_err(ndev, "TX: CQE error %d\n",
833+
cqe_oob->cqe_hdr.cqe_type);
834+
833835
break;
834836

835837
default:
836-
/* If the CQE type is unexpected, log an error, assert,
837-
* and go through the error path.
838+
/* If the CQE type is unknown, log an error,
839+
* and still free the SKB, update tail, etc.
838840
*/
839-
WARN_ONCE(1, "TX: Unexpected CQE type %d: HW BUG?\n",
840-
cqe_oob->cqe_hdr.cqe_type);
841-
return;
841+
if (net_ratelimit())
842+
netdev_err(ndev, "TX: unknown CQE type %d\n",
843+
cqe_oob->cqe_hdr.cqe_type);
844+
845+
break;
842846
}
843847

844848
if (WARN_ON_ONCE(txq->gdma_txq_id != completions[i].wq_num))

0 commit comments

Comments
 (0)