diff mbox series

[net] rtnetlink: Fix regression in bridge VLAN configuration

Message ID 20210609111753.1739008-1-idosch@idosch.org (mailing list archive)
State Accepted
Commit d2e381c4963663bca6f30c3b996fa4dbafe8fcb5
Delegated to: Netdev Maintainers
Headers show
Series [net] rtnetlink: Fix regression in bridge VLAN configuration | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers warning 5 maintainers not CCed: laniel_francis@privacyrequired.com zhudi21@huawei.com cong.wang@bytedance.com avagin@gmail.com roopa@cumulusnetworks.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Ido Schimmel June 9, 2021, 11:17 a.m. UTC
From: Ido Schimmel <idosch@nvidia.com>

Cited commit started returning errors when notification info is not
filled by the bridge driver, resulting in the following regression:

 # ip link add name br1 type bridge vlan_filtering 1
 # bridge vlan add dev br1 vid 555 self pvid untagged
 RTNETLINK answers: Invalid argument

As long as the bridge driver does not fill notification info for the
bridge device itself, an empty notification should not be considered as
an error. This is explained in commit 59ccaaaa49b5 ("bridge: dont send
notification when skb->len == 0 in rtnl_bridge_notify").

Fix by removing the error and add a comment to avoid future bugs.

Fixes: a8db57c1d285 ("rtnetlink: Fix missing error code in rtnl_bridge_notify()")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com>
---
 net/core/rtnetlink.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org June 9, 2021, 10 p.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed,  9 Jun 2021 14:17:53 +0300 you wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> Cited commit started returning errors when notification info is not
> filled by the bridge driver, resulting in the following regression:
> 
>  # ip link add name br1 type bridge vlan_filtering 1
>  # bridge vlan add dev br1 vid 555 self pvid untagged
>  RTNETLINK answers: Invalid argument
> 
> [...]

Here is the summary with links:
  - [net] rtnetlink: Fix regression in bridge VLAN configuration
    https://git.kernel.org/netdev/net/c/d2e381c49636

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Joachim Wiberg June 15, 2021, 5:06 p.m. UTC | #2
On Wed, Jun 09, 2021 at 14:17, Ido Schimmel <idosch@idosch.org> wrote:
> Cited commit started returning errors when notification info is not
> filled by the bridge driver, resulting in the following regression:
>
>  # ip link add name br1 type bridge vlan_filtering 1
>  # bridge vlan add dev br1 vid 555 self pvid untagged
>  RTNETLINK answers: Invalid argument
>
> As long as the bridge driver does not fill notification info for the
> bridge device itself, an empty notification should not be considered as
> an error. This is explained in commit 59ccaaaa49b5 ("bridge: dont send
> notification when skb->len == 0 in rtnl_bridge_notify").
>
> Fix by removing the error and add a comment to avoid future bugs.
>
> Fixes: a8db57c1d285 ("rtnetlink: Fix missing error code in rtnl_bridge_notify()")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com>

Fix does indeed solve the same problem I encountered myself yesterday,
and bisected today.  Tested successfully on a bridge setup with Marvell
88E6097 (DSA switch) for bridge offloading (not that it matters for this
particular fix).

Tested-by: Joachim Wiberg <troglobit@gmail.com>

Best regards
 /Joachim
diff mbox series

Patch

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 3e84279c4123..ec931b080156 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4842,10 +4842,12 @@  static int rtnl_bridge_notify(struct net_device *dev)
 	if (err < 0)
 		goto errout;
 
-	if (!skb->len) {
-		err = -EINVAL;
+	/* Notification info is only filled for bridge ports, not the bridge
+	 * device itself. Therefore, a zero notification length is valid and
+	 * should not result in an error.
+	 */
+	if (!skb->len)
 		goto errout;
-	}
 
 	rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
 	return 0;