Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3325611rwa; Tue, 23 Aug 2022 02:53:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR5M7AHtTX7SQHWeuwuWITEnF/cqMKPxLVPI/3OrFtl5PUDNlRgZQkvMHN+rc5VBEyMHdDJL X-Received: by 2002:a17:902:9888:b0:172:e456:307 with SMTP id s8-20020a170902988800b00172e4560307mr9958110plp.21.1661248422096; Tue, 23 Aug 2022 02:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248422; cv=none; d=google.com; s=arc-20160816; b=ntdZoo0F/or08+d5yFQO7Y5Rc26QdXxVBcojtrhzNZfvoz+kmTvZoFNYq22qvNBbyd KmU7909ykt7WlEInfr1R7L7Hz2JKmH3xCeNnbwUp6qd2ajf0auUhyM9eznEHezE9Gotq oQXaYkzW0EiRoRhJKGC5Gi60GaCxm375txrp6BsNB445dEYUM2XCbFViEerR6NIbjjxz BtRhM2JUIAQWHBidbDfnJI8+h+7akmAhGf9ihuar64V5lEzcrtIYFgZ2pFeqjDJRa71l Cq0I2XUBOSoSjlAW9+HfdSQnRfJy0L6C9oyhdusQK7W39J5S+2DJRAOWKfHqDX4Fxs4T 9EVQ== 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=XZ3Pfhz5ka5h1Lm43uocJThUj9YrWyQuUjHBwDgbmkY=; b=zHsKftKECSEBvcYdExWonEDCUERd3tLY/tf7SxdiXSIl/grXYISs+Lr2pDghHjyTAC /aFGXCtCb6mJjt2HxeL74qS9Eo9hor5nvvJG5/B3DfBxk3SqW76aH6ES8nDch9Xb39KA +N5Z3CEGCZDpdD8Vkpft9se2vOm0xvkQKFVNruAnMLkWgMY+ZQpSVed+yS89jaKG1mNN SAFRiK4640teMe2zMvZZlB99jNdc8PA2tfM8Yuhx3T+lOaftpkOsjOhQpFtP/OTUg9b5 7MNyimxQN9nuBZBTek6CyITWm/M/O8O3N4FZ4/7TY7ZM3Ow5UnJzAW5vgY7pV+sMUYpI 9R/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dnghjkmo; 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 m12-20020a170902bb8c00b001712cbdfa11si9185894pls.581.2022.08.23.02.53.31; Tue, 23 Aug 2022 02:53:42 -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=Dnghjkmo; 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 S241501AbiHWJDh (ORCPT + 99 others); Tue, 23 Aug 2022 05:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240826AbiHWJCZ (ORCPT ); Tue, 23 Aug 2022 05:02:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F26E228E2A; Tue, 23 Aug 2022 01:28:42 -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 CDE576148F; Tue, 23 Aug 2022 08:27:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F770C433C1; Tue, 23 Aug 2022 08:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243240; bh=IFaID+CQU1LWumGJBq/pb2DyzIiBuMz6+s+qtnvsl/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnghjkmoT99KFqdTC/EhdaZhbh9AxGYytKMghKSS+MG3x8k/dK2G5/G6SxT+cXOKs 9JksQxdGDdKd2Bp9iW8FdoBGBa5EFnnL2k42Pv0klxOKAT68qI4udWWzj64bXs0dW4 bHsB0MUF7s4PhairOfmUY0B5FKtzossDhAeYGrt0= 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.19 214/365] net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry Date: Tue, 23 Aug 2022 10:01:55 +0200 Message-Id: <20220823080127.159146679@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@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 @@ -658,6 +658,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);