From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=17BXUWiIYguEMGJokIrCTOxccvtI2kyM8Bai3DCFDYQ=; b=OznK617Nr2luBli1ad7a5RwxE5IiAbmq0F3vASgKKmFyWe4haBo/UqUwJawcS/RdX8j4Ga3P23H0SrdW1qjZjlqdt1zYz1fQXnOEodhYRkzS9Vrmoij/YqDUx52HayXdu+Mf1uKCEsAyjPA8lsgGdc5P6ViG7qUxT2CenzoHEfQZUoO4Yp8mVgWNwHSDBoXgWoMidjeF7RxwFlAgcoqlax+8vP3ZNbNleU40Gif0Io7zbJmDBax/lfCT8BEGOe8Ugu9p9iVfXIopAwYLd9R44dUCz73OwkkI+s7lVkQ5o4+lDJjBo36oTIIrzi5yuDBUjxjj2/znguy3u4MAX65b4Q== From: Nikolay Aleksandrov Date: Wed, 26 Jan 2022 15:10:25 +0200 Message-ID: <20220126131025.2500274-1-nikolay@nvidia.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Subject: [Bridge] [PATCH net] net: bridge: vlan: fix single net device option dumping List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: netdev@vger.kernel.org Cc: Benjamin Poirier , bridge@lists.linux-foundation.org, Nikolay Aleksandrov , roopa@nvidia.com, kuba@kernel.org, davem@davemloft.net When dumping vlan options for a single net device we send the same entries infinitely because user-space expects a 0 return at the end but we keep returning skb->len and restarting the dump on retry. Fix it by returning the value from br_vlan_dump_dev() if it completed or there was an error. The only case that must return skb->len is when the dump was incomplete and needs to continue (-EMSGSIZE). Reported-by: Benjamin Poirier Fixes: 8dcea187088b ("net: bridge: vlan: add rtm definitions and dump support") Signed-off-by: Nikolay Aleksandrov --- net/bridge/br_vlan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 84ba456a78cc..43201260e37b 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -2020,7 +2020,8 @@ static int br_vlan_rtm_dump(struct sk_buff *skb, struct netlink_callback *cb) goto out_err; } err = br_vlan_dump_dev(dev, skb, cb, dump_flags); - if (err && err != -EMSGSIZE) + /* if the dump completed without an error we return 0 here */ + if (err != -EMSGSIZE) goto out_err; } else { for_each_netdev_rcu(net, dev) { -- 2.34.1