Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3406327rwa; Tue, 23 Aug 2022 04:22:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR6JU+9U19/tjgCbkO35GqI7cUtGSjpdLVq1nKfwi3vaxcyD/Tr/klgPlPffq/ol6R7+3dXH X-Received: by 2002:a17:90b:3d8b:b0:1fb:6f72:3f8f with SMTP id pq11-20020a17090b3d8b00b001fb6f723f8fmr995167pjb.125.1661253721524; Tue, 23 Aug 2022 04:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253721; cv=none; d=google.com; s=arc-20160816; b=l+/SSlB83n7X7z/rY7LCu/SMo8xId6f3mP+Fd4pK7HVDORYyAp0xYnHCBLWvuyPmyR v0jwlWO9IItQm3j3aTO0NqwjNzjgx7uTAXWiDPGSFuRflGe1KU/Mb7hqCt4T5PZ40BZR 7OVNP9riCtS9gOEySfCnBfb+NXjV09PWuWI28ORgZclc/gKwqzuyyTcL3kEZvlsJtuZj 1N4GPCk+rXX8fTWY/W0dPri2aiWp3/YpXj2Mg3umv9YISX/qLtD2c7sG9zpxt8h8mjw6 50eLaylBIFJsql3EkTDLMrPblQMDQ30dR+TLhCZjOEeNF0QXdBTtMwT86q36zq6Cp/W3 ss6A== 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=PQqMpfj1rZHcFQQGESXLU1yVioJaxIHSzV1KqByHM+0=; b=xXuCRIY3jMuUG6V//HbaTuoDQrExpEswCs39JINp1lTVNJu47SD2dkBH1R2mPJRV78 DBXnZXoKcT/tEDvSKwrAK+0027mz9zOKTSARSd6wNjZr+vUEH7okWs/cpA4RaOcyqiUl s0R9ys0g5detr56UM0BVc4pityuZBgfwSJgCyuXrJxcjsdwUr5VuaPjEiC1RXCto21Ky xy8hJoQwd7c9EMkm6GiivndC2EyUw1rMf2B7iUjQ5xzYDBFj7/3q6/EwTxCngY0m1+M6 0UFpHDpSRaL8VRdzC5IKobg67dEWLiqjgbtSNzQXJ5IDjk6pN/ZfQmImhr9kpO/Qz5cF a/SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KCew92kT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a17090341c600b00158643c240asi5584164ple.87.2022.08.23.04.21.50; Tue, 23 Aug 2022 04:22:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KCew92kT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1348491AbiHWKM1 (ORCPT + 99 others); Tue, 23 Aug 2022 06:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352427AbiHWKFk (ORCPT ); Tue, 23 Aug 2022 06:05:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27272A3448; Tue, 23 Aug 2022 01:52:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FC08611DD; Tue, 23 Aug 2022 08:52:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EE2DC433C1; Tue, 23 Aug 2022 08:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244722; bh=Lj3vgTIfpEYlX7Q9QBsnBXWw2WeUak/ATk2ICgEljuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCew92kTEalx7DJ4Qk5J6lgAnd/abseY9v6S5UHwlgjl9jLi0RSeZzXI7uCddWOt8 pQtAxWFr4eFMdnFtzuwU7SpUNLT3Jd5lUTL6GzIggL8q4aw4czY4Pr0EZcXZ3oCfYg yIJ0wHVGY6qt+xoYB+PYP3e2ZraICF2CdFUCSmag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Ramadoss , Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.15 139/244] net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry Date: Tue, 23 Aug 2022 10:24:58 +0200 Message-Id: <20220823080103.795969863@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arun Ramadoss commit 36c0d935015766bf20d621c18313f17691bda5e3 upstream. In the ksz9477_fdb_dump function it reads the ALU control register and exit from the timeout loop if there is valid entry or search is complete. After exiting the loop, it reads the alu entry and report to the user space irrespective of entry is valid. It works till the valid entry. If the loop exited when search is complete, it reads the alu table. The table returns all ones and it is reported to user space. So bridge fdb show gives ff:ff:ff:ff:ff:ff as last entry for every port. To fix it, after exiting the loop the entry is reported only if it is valid one. Fixes: b987e98e50ab ("dsa: add DSA switch driver for Microchip KSZ9477") Signed-off-by: Arun Ramadoss Reviewed-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220816105516.18350-1-arun.ramadoss@microchip.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/microchip/ksz9477.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -759,6 +759,9 @@ static int ksz9477_port_fdb_dump(struct goto exit; } + if (!(ksz_data & ALU_VALID)) + continue; + /* read ALU table */ ksz9477_read_table(dev, alu_table);