From patchwork Fri Oct 4 12:44:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Massimiliano Pellizzer X-Patchwork-Id: 1992720 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XKpDJ4P5jz1xv2 for ; Fri, 4 Oct 2024 22:45:20 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1swhgH-0002jg-0v; Fri, 04 Oct 2024 12:45:13 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1swhgE-0002ij-Dz for kernel-team@lists.ubuntu.com; Fri, 04 Oct 2024 12:45:10 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 3EFA23F277 for ; Fri, 4 Oct 2024 12:45:10 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42ac185e26cso15281285e9.3 for ; Fri, 04 Oct 2024 05:45:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728045909; x=1728650709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KbuucepdmGg32HT8q5izi54C4pTE+33vC22YIBlJJ3g=; b=Gce+eVEN/m62bSggn8Rq7Y7gvdE3hbKL9377pwrPbauxhZn0aKSReg8SZmrnyTuQeX aIEfAXm/l/Z3Zg0iwomVXkq74MAVn78RJ5VdmDXZbtgTUUXfO+rGeS7gILjtyxGV0zVC V2A/WgDhcNJ2MX+3ALZA9IxVr2zwKiqAyG3dGLhb9hsSZ+0L6nTMatlDhLPVhlhbZlAw Ih5ztGBoN95xaYmyfDIuk/n36ZSqBfehlJL3twPGP/913ajj4fejc9uLxhi1qfGEyLp9 HniLiiYiSxvf0vEigplF1hK2kENYdQX4pcyZQnO3U97KbkxV5zuZlYqC5GXRhtP0EdrW J/wQ== X-Gm-Message-State: AOJu0YyGiJKXAWyQZZDY1vVhfZ8kYrMof/OoWaCJvgAEKhVxDlW/HnOI sY0Te7oIOZDOlNibj8Wlp4dFkVymrLBzbKe1JyfSCHJ6xk+0D09q85zVJcXAUuX0ZBoC9dSnaWJ DTRUK5uXcqZxJvigEOowR1cnblVk+7ToI89aZh5EEOx37IMjU5BVL6DaV8cZGmaqJ6940+OoTLX i/JudaHpZUlw== X-Received: by 2002:a05:600c:1d20:b0:42c:c28c:e477 with SMTP id 5b1f17b1804b1-42f85ae9231mr18676315e9.23.1728045909586; Fri, 04 Oct 2024 05:45:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1AMQ5uuaFgj/NwJjCv4DldCBbFACfBpz/22JhPh4t9WAkm98dINc0243yuoQzPJ9IZZsvDQ== X-Received: by 2002:a05:600c:1d20:b0:42c:c28c:e477 with SMTP id 5b1f17b1804b1-42f85ae9231mr18676105e9.23.1728045909084; Fri, 04 Oct 2024 05:45:09 -0700 (PDT) Received: from localhost.localdomain (net-93-71-67-9.cust.vodafonedsl.it. [93.71.67.9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d082163c4sm3184935f8f.33.2024.10.04.05.45.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 05:45:08 -0700 (PDT) From: Massimiliano Pellizzer To: kernel-team@lists.ubuntu.com Subject: [SRU][J][PATCH 1/1] net: mana: Fix TX CQE error handling Date: Fri, 4 Oct 2024 14:44:12 +0200 Message-ID: <20241004124432.36810-2-massimiliano.pellizzer@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241004124432.36810-1-massimiliano.pellizzer@canonical.com> References: <20241004124432.36810-1-massimiliano.pellizzer@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Haiyang Zhang [ Upstream commit b2b000069a4c307b09548dc2243f31f3ca0eac9c ] 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: stable@vger.kernel.org Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)") Signed-off-by: Haiyang Zhang Reviewed-by: Simon Horman Reviewed-by: Shradha Gupta Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin (cherry picked from commit b67d7b1bfc46d05c1a58b172516454698e8d5004 linux-6.1.y) CVE-2023-52532 Signed-off-by: Massimiliano Pellizzer --- drivers/net/ethernet/microsoft/mana/mana_en.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index b0963fda4d9f..f7b4efc3dadb 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -828,17 +828,21 @@ static void mana_poll_tx_cq(struct mana_cq *cq) case CQE_TX_VPORT_IDX_OUT_OF_RANGE: case CQE_TX_VPORT_DISABLED: case CQE_TX_VLAN_TAGGING_VIOLATION: - WARN_ONCE(1, "TX: CQE error %d: ignored.\n", - cqe_oob->cqe_hdr.cqe_type); + if (net_ratelimit()) + netdev_err(ndev, "TX: CQE error %d\n", + cqe_oob->cqe_hdr.cqe_type); + break; default: - /* If the CQE type is unexpected, log an error, assert, - * and go through the error path. + /* If the CQE type is unknown, log an error, + * and still free the SKB, update tail, etc. */ - WARN_ONCE(1, "TX: Unexpected CQE type %d: HW BUG?\n", - cqe_oob->cqe_hdr.cqe_type); - return; + if (net_ratelimit()) + netdev_err(ndev, "TX: unknown CQE type %d\n", + cqe_oob->cqe_hdr.cqe_type); + + break; } if (WARN_ON_ONCE(txq->gdma_txq_id != completions[i].wq_num))