Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp861339pxb; Tue, 1 Feb 2022 11:59:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxjXrjv61Ji3X4FgwSMJttbnTNwNpM7zBtF3QP9ExMtihwNxjYT3Dcb3EapOkg2YNEqacn X-Received: by 2002:a63:6985:: with SMTP id e127mr21836819pgc.264.1643745550427; Tue, 01 Feb 2022 11:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745550; cv=none; d=google.com; s=arc-20160816; b=Q88dodgxCsGSrVitJiOEO6CgLs40sY6B1Re2Q6SLGUfhDAb7+G8XIog7ew1R4zDto4 Y3l4Q+NoD9JNI26KcByjzEY4eEZqgG63OHQOtXdtnhXyGlPeVunZsHW4iNxyHj8J8yUp p1ih8T/bnidmIsVl4djXWNJ9JN9+h1dm3oBtOveiiyhh8bYKL4yuCWv3qT99f/A2+lqa gb7M2oH2924wF9kanifpjY3qqn/qsh2qusQACXdXGNqs9HxipnVOIRtqjcOKQn2Cjlw/ /jMMXkgG3Ctl+M8JJfhsdIMmOK5n1tTFo4Jsvujlc9WH+B3CfM5WNSORRCy+x02ZvHrb FK4A== 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=iU0Gr4kBm+tu8zGHCW+wBGhXW5z/cELJoM0Q+ZiKB9U=; b=fYSRUURB+0Y5Wj5Qjr342AJjalj9brPdJnGM/38rT7in6P/zejI2SRSA2h+t/gvENv kPLxZPUiosz+rp0gsbgakiu7KnE28y3gbm7ZPTBtj24AJ2snOw9RDAdhB7YLX4Ol9p/a 7n4n65Ibge1NxB/mWZ0vBMWfr3HV6X7VxcTkFYRrnTJzt1eFADXTt0YzWcQaOEzHKyiL MC2qDyIOe62nyRrSfwAJkZ95LmW1lV4W53eSju6jAjinqbDbVe04QTRgAY8lc9fWL9Ws Cv03+lCe+H2OCFtRp/VbRBw1Zuv6c8I2LIUWEjByJ+Ow2cLYCxDPJMCKWDFIPzTmKcus XRxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KqKpgcJ5; 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 ls16si3741669pjb.119.2022.02.01.11.58.59; Tue, 01 Feb 2022 11:59:10 -0800 (PST) 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=KqKpgcJ5; 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 S1349452AbiAaLKq (ORCPT + 99 others); Mon, 31 Jan 2022 06:10:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40362 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348644AbiAaLF6 (ORCPT ); Mon, 31 Jan 2022 06:05:58 -0500 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 E31B460F96; Mon, 31 Jan 2022 11:05:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99CA0C340E8; Mon, 31 Jan 2022 11:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627157; bh=3hFFj0tKoi4W0dZl+5NryhfL92TrUgIrc2iiMZM4PNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KqKpgcJ5/szGiyQlYsV5akHUiI22U8sUl/cdjZzfzW6WpNRNiS7NGLBeCd8g7rEol xQdIm7O7Md45mpqlKnUZ/oROweQ7Q1SeBHlGEUFpSGCBsY0tSMXu7W6AoRHnGiA3zl lP12NZVPuh8EXgXNcFm+8OQXMw1RjydvVisNYWWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Poirier , Nikolay Aleksandrov , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 092/100] net: bridge: vlan: fix single net device option dumping Date: Mon, 31 Jan 2022 11:56:53 +0100 Message-Id: <20220131105223.546309373@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@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: Nikolay Aleksandrov [ Upstream commit dcb2c5c6ca9b9177f04abaf76e5a983d177c9414 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 08c77418c687b..1f508d998fb2d 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -1873,7 +1873,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