Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2710719pxj; Mon, 31 May 2021 08:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaW358TFEtWjXEfEH3wkoRqcUAGqGDqomGiBJ3/+PmZynLdREoHCP+Gz4mAhiFK8Cu9sTF X-Received: by 2002:a17:906:2749:: with SMTP id a9mr23895895ejd.498.1622476184643; Mon, 31 May 2021 08:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622476184; cv=none; d=google.com; s=arc-20160816; b=iF6Ms7FRMQ4ES5UwFeVfiXPr6GNPUVpknQxhROSrs3+xJeJq//1AFhAwucYgkxqp44 XLpAOioUonbYNNyPcbaZMDsmJ8mrS5lxZZHgw1+893XsaPUGKatOoXuFX3wY/7ePdti2 i1j7Q1OsIhTzn4UJwaS+LYjk9p/dmJEh6RvXU2c0xQ7Jt6zIGF6U5ARoNgME2IIm5WQX MGmHen519vbW3Gge7c6ABPEUYQF7zSJvLljZuENqqRfvrIrv8YWQ4pRVFH0il8NtiRZw Nx+aZRb7l6knNFvwsqFRwY+ymw0FxDpTxj2xT2uBh3BATaQTErf8R3b9xx+OvZ1Z2acA JzSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Q/FnawoCBuAvHbxUna4a4OEyC3/b2RUTxRZ/iYBvap4=; b=YCgoR1mr47ZfhbJ0Cd0ysThhiJhrb+VJMHyo9RP3TVgYPpcbf2oEHTN9K1k97lvuWg TRZKBW2rXKif8R6X5WleIEyP2zSFwCtKibRr/yosyicdnX2FplzVQ/s8JA0YAVt8o3U2 gGngr/Rf1ZNHyrXAN/QhUWhB0KXj7DmigSN+0S+6NPyekEjho2UJnnMr8ISJrO6eT2vF 3KLl6aL/yYd2LMUg/+p8SrD6NkwddDKtOtB/DU2X9rAKc+ZEqBZIw+EaA3ygSVVGKzV4 PA+ujiJwUFAILyiVwNqW10O9E2VP/qjFNkyLBinUgTQDIQo8vVivV1dEk1uu1zAJcr0O Sekg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BJPmd4MJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si14433142edb.182.2021.05.31.08.49.22; Mon, 31 May 2021 08:49:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BJPmd4MJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234331AbhEaPtr (ORCPT + 99 others); Mon, 31 May 2021 11:49:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:56304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233871AbhEaO1g (ORCPT ); Mon, 31 May 2021 10:27:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D428561C1C; Mon, 31 May 2021 13:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468866; bh=uQ8FLyP5OfWHafxbDqXKDbOP/fJNh3eauwXWfEMHAd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJPmd4MJGYs5ISIL2snMolE1IcpLnPeBo6zK/cqbjL0r/2P2U9/Mi9nELVuj3WXHe IURt2nBb/RnW5UhIEDtkUkpJnej8fTEjzRtPJ1NSA0DvwLi3rG5Nbdhw9rBOzztbUF w4N8g6tlKR+R+/azCSkeg7xyT2gDDBfJtxAX615Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raju Rangoju , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 157/177] cxgb4: avoid accessing registers when clearing filters Date: Mon, 31 May 2021 15:15:14 +0200 Message-Id: <20210531130653.346722522@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Raju Rangoju [ Upstream commit 88c380df84fbd03f9b137c2b9d0a44b9f2f553b0 ] Hardware register having the server TID base can contain invalid values when adapter is in bad state (for example, due to AER fatal error). Reading these invalid values in the register can lead to out-of-bound memory access. So, fix by using the saved server TID base when clearing filters. Fixes: b1a79360ee86 ("cxgb4: Delete all hash and TCAM filters before resource cleanup") Signed-off-by: Raju Rangoju Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c index 64a2453e06ba..ccb28182f745 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c @@ -778,7 +778,7 @@ void clear_all_filters(struct adapter *adapter) cxgb4_del_filter(dev, i, &f->fs); } - sb = t4_read_reg(adapter, LE_DB_SRVR_START_INDEX_A); + sb = adapter->tids.stid_base; for (i = 0; i < sb; i++) { f = (struct filter_entry *)adapter->tids.tid_tab[i]; -- 2.30.2