From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC39EC43331 for ; Sat, 7 Sep 2019 13:45:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FF9F218AE for ; Sat, 7 Sep 2019 13:45:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oiT8MFdN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393214AbfIGNpb (ORCPT ); Sat, 7 Sep 2019 09:45:31 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35056 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728809AbfIGNpb (ORCPT ); Sat, 7 Sep 2019 09:45:31 -0400 Received: by mail-pl1-f194.google.com with SMTP id gn20so4515588plb.2 for ; Sat, 07 Sep 2019 06:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=j19RFP0TsTBXxQsNNowbSIVffkRKYLkAx+QypCFCzxs=; b=oiT8MFdNi1EVSr+i6nwIXRO07wo4nl+f+BNfrUm8Am/7PqOnZe2nOkcb9qknptxFMv ShbhLXcxjOT9WnysZRP5jEZQrkAEwZHrzStmr8hI9/rZQXw6REkXlUAvZVf853G1tHhB mL0N9UDYV7p5C2l7MFSzPFB544Jl6NZ6lF6dnPPdhQwSr84n0Kn7+qsEIaDlArsypArc KLr5vhQkipMfYok5U6IY/bHyNP342sTnp4U5Zjqw2pqIpjxOxqS4orTOkDoi6n9cTBzF pIw8368543k8bZFc6QJoaFbJAl8Ht2bsi+yqGdv1MYR0oOEYGqsRsCQJSfJ5DiKXKkoZ psSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=j19RFP0TsTBXxQsNNowbSIVffkRKYLkAx+QypCFCzxs=; b=SdKBddDOTGlbwlRectOKOjWVdqcXOawBctIaIH6/MGf1UOdi4rhZRRS0dGo9ifdq0s 7LRIDOHgzNYtTeLPtg8t2kMMUB1P0pO8K9HG23gliobhYDuDAogv1fQhMKeuwVCNBzk/ lVBrDV1gECv0zxYijuA9/jaZBVCN3viGv6Z8oLVNIvwm74BYK2bAJQ08KekgQ9S4Lgxp PtYsf/X9+ZW+4w+0kkaH+P6wV98AgkWXMGyvWtrgOtXYCQtTZn7ryTczaqgpvgfIpnq4 +4PTVYj/18ngHFhQdEHOYO1QXiAOcsmrmXqfdTt10TR2V6/+YNwFp3lv8REpoTMoRe+s INhg== X-Gm-Message-State: APjAAAU4E76LvyQwAoZe8EDdEGTLG+rCitQ1uY0Zyl8NNKmTmJsPtAQ+ NFjQS8UIDlx3XuBC+40RXw0= X-Google-Smtp-Source: APXvYqwdRj+S/T32gVhVfrMAQ/K89tZ/O09fnF91nBWI7UKvFCObOYuPZYQ0oYGAQ1+HUmUiRy3Yog== X-Received: by 2002:a17:902:b607:: with SMTP id b7mr10448630pls.38.1567863930503; Sat, 07 Sep 2019 06:45:30 -0700 (PDT) Received: from ap-To-be-filled-by-O-E-M.8.8.8.8 ([14.33.120.60]) by smtp.gmail.com with ESMTPSA id v10sm7562786pjk.23.2019.09.07.06.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2019 06:45:29 -0700 (PDT) From: Taehee Yoo To: davem@davemloft.net, netdev@vger.kernel.org, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, jiri@resnulli.us, sd@queasysnail.net, roopa@cumulusnetworks.com, saeedm@mellanox.com, manishc@marvell.com, rahulv@marvell.com, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, sashal@kernel.org, hare@suse.de, varun@chelsio.com, ubraun@linux.ibm.com, kgraul@linux.ibm.com, jay.vosburgh@canonical.com Cc: ap420073@gmail.com Subject: [PATCH net v2 00/11] net: fix nested device bugs Date: Sat, 7 Sep 2019 22:45:19 +0900 Message-Id: <20190907134519.31880-1-ap420073@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patchset fixes several bugs that are related to nesting device infrastructure. Current nesting infrastructure code doesn't limit the depth level of devices. nested devices could be handled recursively. at that moment, it needs huge memory and stack overflow could occur. Below devices type have same bug. VLAN, BONDING, TEAM, MACSEC, MACVLAN and VXLAN. Test commands: ip link add dummy0 type dummy ip link add vlan1 link dummy0 type vlan id 1 for i in {2..100} do let A=$i-1 ip link add name vlan$i link vlan$A type vlan id $i done ip link del dummy0 1st patch actually fixes the root cause. It adds new common variables {upper/lower}_level that represent depth level. upper_level variable is depth of upper devices. lower_level variable is depth of lower devices. [U][L] [U][L] vlan1 1 5 vlan4 1 4 vlan2 2 4 vlan5 2 3 vlan3 3 3 | | | +------------+ | vlan6 4 2 dummy0 5 1 After this patch, the nesting infrastructure code uses this variable to check the depth level. 2, 4, 5, 6, 7 patches fix lockdep related problem. Before this patch, devices use static lockdep map. So, if devices that are same type is nested, lockdep will warn about recursive situation. These patches make these devices use dynamic lockdep key instead of static lock or subclass. 3rd patch fixes unexpected IFF_BONDING bit unset. 8th patch fixes a refcnt leak in the macsec module. 9th patch adds ignore flag to an adjacent structure. In order to exchange an adjacent node safely, ignore flag is needed. 10th patch makes vxlan add an adjacent link to limit depth level. 11th patch removes unnecessary variables and callback. v1 -> v2 : - Make the 3rd patch do not add a new priv_flag. Taehee Yoo (11): net: core: limit nested device depth vlan: use dynamic lockdep key instead of subclass bonding: fix unexpected IFF_BONDING bit unset bonding: use dynamic lockdep key instead of subclass team: use dynamic lockdep key instead of static key macsec: use dynamic lockdep key instead of subclass macvlan: use dynamic lockdep key instead of subclass macsec: fix refcnt leak in module exit routine net: core: add ignore flag to netdev_adjacent structure vxlan: add adjacent link to limit depth level net: remove unnecessary variables and callback drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_main.c | 81 ++++-- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- drivers/net/macsec.c | 50 ++-- drivers/net/macvlan.c | 36 ++- drivers/net/team/team.c | 61 ++++- drivers/net/vxlan.c | 71 ++++- include/linux/if_macvlan.h | 3 +- include/linux/if_team.h | 5 + include/linux/if_vlan.h | 13 +- include/linux/netdevice.h | 20 +- include/net/bonding.h | 4 +- include/net/vxlan.h | 1 + net/8021q/vlan.c | 1 - net/8021q/vlan_dev.c | 32 +-- net/core/dev.c | 252 ++++++++++++++++-- net/core/dev_addr_lists.c | 12 +- net/smc/smc_core.c | 2 +- net/smc/smc_pnet.c | 2 +- 19 files changed, 508 insertions(+), 142 deletions(-) -- 2.17.1