From patchwork Thu Oct 26 17:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cengiz Can X-Patchwork-Id: 1855893 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 4SGXjS36MNz23jh for ; Fri, 27 Oct 2023 04:24:43 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qw45w-0008Qi-SG; Thu, 26 Oct 2023 17:24:33 +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 1qw45r-0008Px-Jp for kernel-team@lists.ubuntu.com; Thu, 26 Oct 2023 17:24:27 +0000 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.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 4D84F3F6AE for ; Thu, 26 Oct 2023 17:24:27 +0000 (UTC) Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-99c8bbc902eso81963066b.1 for ; Thu, 26 Oct 2023 10:24:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698341066; x=1698945866; 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=S6Dqcmg6SqOPbi4XyONEMHDkhe0Y6bcg+u0n7fNDLV0=; b=TBoRGURGa41j5olL+GV5jcJXfqdShsJC0OBkciTK8YOOzLG+lLCIgjLQB+heXP5Cme CiLPaDYArov6rEoCpUIh7yHq3zsNxyBMBGPA8U+Rpb+jCpkhWpqKKnEV/0ssO0iJQT21 PpPwJ89iy/TDVrnq32EVwKfw+mauXl0r2xF7TEeVbHE6KP6ElI4m85PQuW+MTuuVBXc4 LMm0okNs/CqHuy3Yh2J5XZySDMYN8MVRntPgdEAs+pXPrHjuvFqqAsunJAT+rg797jGd s345SXeuNhxmNpmKjwc+DJgCUm1h1JN/tn4mAZ6hsTEPw4KKlSVbtl7+6zuBPVaUSxhi I2LQ== X-Gm-Message-State: AOJu0YwQSAU9pFAdIO5vVL/5J6mrZEB1ryI2h2wy4iWgQl3TPKLeZeed jcBR/fff5wDKjRG8QDdAZBeUgo/y5ZqGT4PqCwQtoXk9pnZvV1TNQ+qMGs3Bgd10zFddseEfzqn 10NJxD0ob2j3/kMLJ7EfyRIkIHVMqqs+uKXAR5E8Ss2TgTcGiaLdn X-Received: by 2002:a17:907:3da7:b0:9be:6ff7:128a with SMTP id he39-20020a1709073da700b009be6ff7128amr259654ejc.67.1698341066743; Thu, 26 Oct 2023 10:24:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFd9EjY1QlYlNC9rr3xlnIu9Pygt+Zx+whpy6iwD6Vq5FA6KUe4LzgTygt5EvGU2X8UueDSyA== X-Received: by 2002:a17:907:3da7:b0:9be:6ff7:128a with SMTP id he39-20020a1709073da700b009be6ff7128amr259641ejc.67.1698341066541; Thu, 26 Oct 2023 10:24:26 -0700 (PDT) Received: from localhost ([46.106.62.176]) by smtp.gmail.com with ESMTPSA id a19-20020a1709065f9300b009b94c545678sm11948847eju.153.2023.10.26.10.24.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 10:24:26 -0700 (PDT) From: Cengiz Can To: kernel-team@lists.ubuntu.com Subject: [SRU Bionic, Focal, Jammy, OEM-6.0, Lunar 1/1] igb: set max size RX buffer when store bad packet is enabled Date: Thu, 26 Oct 2023 20:24:18 +0300 Message-Id: <20231026172418.15745-2-cengiz.can@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026172418.15745-1-cengiz.can@canonical.com> References: <20231026172418.15745-1-cengiz.can@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: Radoslaw Tyl Increase the RX buffer size to 3K when the SBP bit is on. The size of the RX buffer determines the number of pages allocated which may not be sufficient for receive frames larger than the set MTU size. Cc: stable@vger.kernel.org Fixes: 89eaefb61dc9 ("igb: Support RX-ALL feature flag.") Reported-by: Manfred Rudigier Signed-off-by: Radoslaw Tyl Tested-by: Arpana Arland (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: David S. Miller (cherry picked from commit bb5ed01cd2428cd25b1c88a3a9cba87055eb289f) CVE-2023-45871 Signed-off-by: Cengiz Can --- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 6f2e9c606e4b..4dcb27d2f74d 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -4758,6 +4758,10 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, static void igb_set_rx_buffer_len(struct igb_adapter *adapter, struct igb_ring *rx_ring) { +#if (PAGE_SIZE < 8192) + struct e1000_hw *hw = &adapter->hw; +#endif + /* set build_skb and buffer size flags */ clear_ring_build_skb_enabled(rx_ring); clear_ring_uses_large_buffer(rx_ring); @@ -4768,10 +4772,9 @@ static void igb_set_rx_buffer_len(struct igb_adapter *adapter, set_ring_build_skb_enabled(rx_ring); #if (PAGE_SIZE < 8192) - if (adapter->max_frame_size <= IGB_MAX_FRAME_BUILD_SKB) - return; - - set_ring_uses_large_buffer(rx_ring); + if (adapter->max_frame_size > IGB_MAX_FRAME_BUILD_SKB || + rd32(E1000_RCTL) & E1000_RCTL_SBP) + set_ring_uses_large_buffer(rx_ring); #endif }