Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2751629pxj; Mon, 31 May 2021 09:50:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyv6xEVEMt1PaRGh51j7P2ahdwhDTX2GkJRFwwha5nqjKrQPJoqkH4Ti94pCo/JfxlwQnYs X-Received: by 2002:a17:906:994d:: with SMTP id zm13mr16599726ejb.427.1622479813786; Mon, 31 May 2021 09:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479813; cv=none; d=google.com; s=arc-20160816; b=OW8CmNdp8Q7xLwmpGLm8G0iui3gPoTwjVMbc3VLnxfhFCaQ/0ZleqbRvOhM/yCrfIY 2s9pqEBKitTdZ/on8wZxXjlZO7IZDe393kgYfaWde5a8w7IYf69crfspNNR84faTQPBD rmInNCBh3eUXfTwXUIvTQCMi1urnjJLQbgPBDgjZQFQPYdPu2DuowAxzxj7GKGxaqoO9 YBpwUyHGsxbzCy/s/EJqbR+aJPqHj2ydNlyFXTHtY3PnTj4bjkmd+qR82mxittUCKrBg EgSTX/jDoF/gXxbPZy+oXkjLnmOPDhMOXJu0mE50/fgqKEzlZmYsKGBQkCh60WhxU9iR tD4A== 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=AHmQgY7Hq+rQe576Wut69sHPeVEjphz4H7cklzdVgbg=; b=RTs4mpwvqEXigAtXLKplW1Rgtab2NxIPSZnqNffkqMjQAk/V7/Ur9CcvimlPsD3LOM 7shWBUxWmGL27O/eXN0RLMjp+Zul8dmbAeLFQ01L8Aqy3yTuruCKRhQLoXOA/LMF6eWc a2ickfOKvYksBIXC9PmoWU+d0weBEXp6zNtz1igRGO55smpjgdYSfYz97oSA/X8rxkPe UjynUF9xv1d9Z10j4NomT13RRvnVsTUPmp3bGTZy26eh8y9vGVYbxLofhcf5FS7T73Hj LP96hDfWACbIZK6RNDq6klIiZKECmsI9b3jCEa99+QFhAeIw9KtdSd6Yn5Bxcz/75wOA 8yWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gdgUNBI9; 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 bc14si1427584edb.374.2021.05.31.09.49.51; Mon, 31 May 2021 09:50:13 -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=gdgUNBI9; 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 S232543AbhEaQug (ORCPT + 99 others); Mon, 31 May 2021 12:50:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:51030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231585AbhEaO5U (ORCPT ); Mon, 31 May 2021 10:57:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4155F61402; Mon, 31 May 2021 14:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469617; bh=e9Kvj+llEdXdE4vFZ3aybTT3zMofuM2ZWeu75cRbXRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdgUNBI9d3VNyYhCh7KATkkcWBtenbgJE5wdzarlhwBe0Yr3Kw5BLb/E8Uc84i2D9 zSbz1YN0+/zUtIHkxXyjLFpuWe5Bqb9jbapH/8wHbtIS0hvCXPo5/KfZ4AuHyYXAm2 ixA8vH+zBnJsula4w+wLMW4NEwBk+EbcLd7XFyVY= 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.12 266/296] cxgb4: avoid accessing registers when clearing filters Date: Mon, 31 May 2021 15:15:21 +0200 Message-Id: <20210531130712.685566907@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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 bde8494215c4..e664e05b9f02 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c @@ -1042,7 +1042,7 @@ void clear_all_filters(struct adapter *adapter) cxgb4_del_filter(dev, f->tid, &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