cxgb4: avoid accessing registers when clearing filters
authorRaju Rangoju <rajur@chelsio.com>
Wed, 19 May 2021 11:18:31 +0000 (16:48 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 07:00:49 +0000 (09:00 +0200)
[ 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 <rajur@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c

index bde8494..e664e05 100644 (file)
@@ -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];