An error occurred fetching the project authors.
  1. 14 Feb, 2024 1 commit
  2. 18 Oct, 2023 2 commits
  3. 19 Jul, 2023 1 commit
    • Ido Schimmel's avatar
      bridge: Add backup nexthop ID support · 29cfb2aa
      Ido Schimmel authored
      Add a new bridge port attribute that allows attaching a nexthop object
      ID to an skb that is redirected to a backup bridge port with VLAN
      tunneling enabled.
      
      Specifically, when redirecting a known unicast packet, read the backup
      nexthop ID from the bridge port that lost its carrier and set it in the
      bridge control block of the skb before forwarding it via the backup
      port. Note that reading the ID from the bridge port should not result in
      a cache miss as the ID is added next to the 'backup_port' field that was
      already accessed. After this change, the 'state' field still stays on
      the first cache line, together with other data path related fields such
      as 'flags and 'vlgrp':
      
      struct net_bridge_port {
              struct net_bridge *        br;                   /*     0     8 */
              struct net_device *        dev;                  /*     8     8 */
              netdevice_tracker          dev_tracker;          /*    16     0 */
              struct list_head           list;                 /*    16    16 */
              long unsigned int          flags;                /*    32     8 */
              struct net_bridge_vlan_group * vlgrp;            /*    40     8 */
              struct net_bridge_port *   backup_port;          /*    48     8 */
              u32                        backup_nhid;          /*    56     4 */
              u8                         priority;             /*    60     1 */
              u8                         state;                /*    61     1 */
              u16                        port_no;              /*    62     2 */
              /* --- cacheline 1 boundary (64 bytes) --- */
      [...]
      } __attribute__((__aligned__(8)));
      
      When forwarding an skb via a bridge port that has VLAN tunneling
      enabled, check if the backup nexthop ID stored in the bridge control
      block is valid (i.e., not zero). If so, instead of attaching the
      pre-allocated metadata (that only has the tunnel key set), allocate a
      new metadata, set both the tunnel key and the nexthop object ID and
      attach it to the skb.
      
      By default, do not dump the new attribute to user space as a value of
      zero is an invalid nexthop object ID.
      
      The above is useful for EVPN multihoming. When one of the links
      composing an Ethernet Segment (ES) fails, traffic needs to be redirected
      towards the host via one of the other ES peers. For example, if a host
      is multihomed to three different VTEPs, the backup port of each ES link
      needs to be set to the VXLAN device and the backup nexthop ID needs to
      point to an FDB nexthop group that includes the IP addresses of the
      other two VTEPs. The VXLAN driver will extract the ID from the metadata
      of the redirected skb, calculate its flow hash and forward it towards
      one of the other VTEPs. If the ID does not exist, or represents an
      invalid nexthop object, the VXLAN driver will drop the skb. This
      relieves the bridge driver from the need to validate the ID.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      29cfb2aa
  4. 21 Apr, 2023 1 commit
  5. 17 Mar, 2023 1 commit
    • Ido Schimmel's avatar
      rtnetlink: bridge: mcast: Move MDB handlers out of bridge driver · cc7f5022
      Ido Schimmel authored
      Currently, the bridge driver registers handlers for MDB netlink
      messages, making it impossible for other drivers to implement MDB
      support.
      
      As a preparation for VXLAN MDB support, move the MDB handlers out of the
      bridge driver to the core rtnetlink code. The rtnetlink code will call
      into individual drivers by invoking their previously added MDB net
      device operations.
      
      Note that while the diffstat is large, the change is mechanical. It
      moves code out of the bridge driver to rtnetlink code. Also note that a
      similar change was made in 2012 with commit 77162022 ("net: add
      generic PF_BRIDGE:RTM_ FDB hooks") that moved FDB handlers out of the
      bridge driver to the core rtnetlink code.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc7f5022
  6. 06 Feb, 2023 2 commits
    • Petr Machata's avatar
      net: bridge: Add netlink knobs for number / maximum MDB entries · a1aee20d
      Petr Machata authored
      The previous patch added accounting for number of MDB entries per port and
      per port-VLAN, and the logic to verify that these values stay within
      configured bounds. However it didn't provide means to actually configure
      those bounds or read the occupancy. This patch does that.
      
      Two new netlink attributes are added for the MDB occupancy:
      IFLA_BRPORT_MCAST_N_GROUPS for the per-port occupancy and
      BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS for the per-port-VLAN occupancy.
      And another two for the maximum number of MDB entries:
      IFLA_BRPORT_MCAST_MAX_GROUPS for the per-port maximum, and
      BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS for the per-port-VLAN one.
      
      Note that the two new IFLA_BRPORT_ attributes prompt bumping of
      RTNL_SLAVE_MAX_TYPE to size the slave attribute tables large enough.
      
      The new attributes are used like this:
      
       # ip link add name br up type bridge vlan_filtering 1 mcast_snooping 1 \
                                            mcast_vlan_snooping 1 mcast_querier 1
       # ip link set dev v1 master br
       # bridge vlan add dev v1 vid 2
      
       # bridge vlan set dev v1 vid 1 mcast_max_groups 1
       # bridge mdb add dev br port v1 grp 230.1.2.3 temp vid 1
       # bridge mdb add dev br port v1 grp 230.1.2.4 temp vid 1
       Error: bridge: Port-VLAN is already in 1 groups, and mcast_max_groups=1.
      
       # bridge link set dev v1 mcast_max_groups 1
       # bridge mdb add dev br port v1 grp 230.1.2.3 temp vid 2
       Error: bridge: Port is already in 1 groups, and mcast_max_groups=1.
      
       # bridge -d link show
       5: v1@v2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br [...]
           [...] mcast_n_groups 1 mcast_max_groups 1
      
       # bridge -d vlan show
       port              vlan-id
       br                1 PVID Egress Untagged
                           state forwarding mcast_router 1
       v1                1 PVID Egress Untagged
                           [...] mcast_n_groups 1 mcast_max_groups 1
                         2
                           [...] mcast_n_groups 0 mcast_max_groups 0
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a1aee20d
    • Petr Machata's avatar
      net: bridge: Set strict_start_type at two policies · c00041cf
      Petr Machata authored
      Make any attributes newly-added to br_port_policy or vlan_tunnel_policy
      parsed strictly, to prevent userspace from passing garbage. Note that this
      patchset only touches the former policy. The latter was adjusted for
      completeness' sake. There do not appear to be other _deprecated calls
      with non-NULL policies.
      Suggested-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c00041cf
  7. 04 Nov, 2022 1 commit
    • Hans J. Schultz's avatar
      bridge: Add MAC Authentication Bypass (MAB) support · a35ec8e3
      Hans J. Schultz authored
      Hosts that support 802.1X authentication are able to authenticate
      themselves by exchanging EAPOL frames with an authenticator (Ethernet
      bridge, in this case) and an authentication server. Access to the
      network is only granted by the authenticator to successfully
      authenticated hosts.
      
      The above is implemented in the bridge using the "locked" bridge port
      option. When enabled, link-local frames (e.g., EAPOL) can be locally
      received by the bridge, but all other frames are dropped unless the host
      is authenticated. That is, unless the user space control plane installed
      an FDB entry according to which the source address of the frame is
      located behind the locked ingress port. The entry can be dynamic, in
      which case learning needs to be enabled so that the entry will be
      refreshed by incoming traffic.
      
      There are deployments in which not all the devices connected to the
      authenticator (the bridge) support 802.1X. Such devices can include
      printers and cameras. One option to support such deployments is to
      unlock the bridge ports connecting these devices, but a slightly more
      secure option is to use MAB. When MAB is enabled, the MAC address of the
      connected device is used as the user name and password for the
      authentication.
      
      For MAB to work, the user space control plane needs to be notified about
      MAC addresses that are trying to gain access so that they will be
      compared against an allow list. This can be implemented via the regular
      learning process with the sole difference that learned FDB entries are
      installed with a new "locked" flag indicating that the entry cannot be
      used to authenticate the device. The flag cannot be set by user space,
      but user space can clear the flag by replacing the entry, thereby
      authenticating the device.
      
      Locked FDB entries implement the following semantics with regards to
      roaming, aging and forwarding:
      
      1. Roaming: Locked FDB entries can roam to unlocked (authorized) ports,
         in which case the "locked" flag is cleared. FDB entries cannot roam
         to locked ports regardless of MAB being enabled or not. Therefore,
         locked FDB entries are only created if an FDB entry with the given {MAC,
         VID} does not already exist. This behavior prevents unauthenticated
         devices from disrupting traffic destined to already authenticated
         devices.
      
      2. Aging: Locked FDB entries age and refresh by incoming traffic like
         regular entries.
      
      3. Forwarding: Locked FDB entries forward traffic like regular entries.
         If user space detects an unauthorized MAC behind a locked port and
         wishes to prevent traffic with this MAC DA from reaching the host, it
         can do so using tc or a different mechanism.
      
      Enable the above behavior using a new bridge port option called "mab".
      It can only be enabled on a bridge port that is both locked and has
      learning enabled. Locked FDB entries are flushed from the port once MAB
      is disabled. A new option is added because there are pure 802.1X
      deployments that are not interested in notifications about locked FDB
      entries.
      Signed-off-by: default avatarHans J. Schultz <netdev@kapio-technology.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a35ec8e3
  8. 03 Nov, 2022 1 commit
    • Ido Schimmel's avatar
      bridge: Fix flushing of dynamic FDB entries · 628ac04a
      Ido Schimmel authored
      The following commands should result in all the dynamic FDB entries
      being flushed, but instead all the non-local (non-permanent) entries are
      flushed:
      
       # bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static
       # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic
       # ip link set dev br0 type bridge fdb_flush
       # bridge fdb show brport dummy1
       00:00:00:00:00:01 master br0 permanent
       33:33:00:00:00:01 self permanent
       01:00:5e:00:00:01 self permanent
      
      This is because br_fdb_flush() works with FDB flags and not the
      corresponding enumerator values. Fix by passing the FDB flag instead.
      
      After the fix:
      
       # bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static
       # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic
       # ip link set dev br0 type bridge fdb_flush
       # bridge fdb show brport dummy1
       00:aa:bb:cc:dd:ee master br0 static
       00:00:00:00:00:01 master br0 permanent
       33:33:00:00:00:01 self permanent
       01:00:5e:00:00:01 self permanent
      
      Fixes: 1f78ee14 ("net: bridge: fdb: add support for fine-grained flushing")
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Link: https://lore.kernel.org/r/20221101185753.2120691-1-idosch@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      628ac04a
  9. 26 Jul, 2022 1 commit
  10. 10 Jun, 2022 1 commit
  11. 13 Apr, 2022 1 commit
    • Nikolay Aleksandrov's avatar
      net: bridge: fdb: add support for fine-grained flushing · 1f78ee14
      Nikolay Aleksandrov authored
      Add the ability to specify exactly which fdbs to be flushed. They are
      described by a new structure - net_bridge_fdb_flush_desc. Currently it
      can match on port/bridge ifindex, vlan id and fdb flags. It is used to
      describe the existing dynamic fdb flush operation. Note that this flush
      operation doesn't treat permanent entries in a special way (fdb_delete vs
      fdb_delete_local), it will delete them regardless if any port is using
      them, so currently it can't directly replace deletes which need to handle
      that case, although we can extend it later for that too.
      Signed-off-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f78ee14
  12. 23 Mar, 2022 1 commit
  13. 22 Mar, 2022 1 commit
    • Eric Dumazet's avatar
      net: bridge: mst: prevent NULL deref in br_mst_info_size() · cde3fc24
      Eric Dumazet authored
      Call br_mst_info_size() only if vg pointer is not NULL.
      
      general protection fault, probably for non-canonical address 0xdffffc0000000058: 0000 [#1] PREEMPT SMP KASAN
      KASAN: null-ptr-deref in range [0x00000000000002c0-0x00000000000002c7]
      CPU: 0 PID: 975 Comm: syz-executor.0 Tainted: G        W         5.17.0-next-20220321-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:br_mst_info_size+0x97/0x270 net/bridge/br_mst.c:242
      Code: 00 00 31 c0 e8 ba 10 53 f9 31 c0 b9 40 00 00 00 4c 8d 6c 24 30 4c 89 ef f3 48 ab 48 8d 83 c0 02 00 00 48 89 04 24 48 c1 e8 03 <80> 3c 28 00 0f 85 ae 01 00 00 48 8b 83 c0 02 00 00 41 bf 04 00 00
      RSP: 0018:ffffc900153770a8 EFLAGS: 00010202
      RAX: 0000000000000058 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000040000 RSI: ffffffff88259876 RDI: ffffc900153772d8
      RBP: dffffc0000000000 R08: 0000000000000000 R09: ffffffff8db68957
      R10: ffffffff881f737b R11: 0000000000000000 R12: 0000000000000000
      R13: ffffc900153770d8 R14: 00000000000002a0 R15: 00000000ffffffff
      FS:  00007f18bbb6f700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020001a80 CR3: 000000001a7d9000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 00000000000000d8 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       br_get_link_af_size_filtered+0x6e9/0xc00 net/bridge/br_netlink.c:123
       rtnl_link_get_af_size net/core/rtnetlink.c:598 [inline]
       if_nlmsg_size+0x40c/0xa50 net/core/rtnetlink.c:1040
       rtnl_calcit.isra.0+0x25f/0x460 net/core/rtnetlink.c:3780
       rtnetlink_rcv_msg+0xa65/0xb80 net/core/rtnetlink.c:5937
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2496
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1921
       sock_sendmsg_nosec net/socket.c:705 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:725
       ____sys_sendmsg+0x6e8/0x810 net/socket.c:2413
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2467
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7f18baa89049
      Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f18bbb6f168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007f18bab9bf60 RCX: 00007f18baa89049
      RDX: 0000000000000000 RSI: 0000000020001a80 RDI: 0000000000000004
      RBP: 00007f18baae308d R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 00007ffeedb2be2f R14: 00007f18bbb6f300 R15: 0000000000022000
       </TASK>
      Modules linked in:
      ---[ end trace 0000000000000000 ]---
      RIP: 0010:br_mst_info_size+0x97/0x270 net/bridge/br_mst.c:242
      Code: 00 00 31 c0 e8 ba 10 53 f9 31 c0 b9 40 00 00 00 4c 8d 6c 24 30 4c 89 ef f3 48 ab 48 8d 83 c0 02 00 00 48 89 04 24 48 c1 e8 03 <80> 3c 28 00 0f 85 ae 01 00 00 48 8b 83 c0 02 00 00 41 bf 04 00 00
      RSP: 0018:ffffc900153770a8 EFLAGS: 00010202
      RAX: 0000000000000058 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000040000 RSI: ffffffff88259876 RDI: ffffc900153772d8
      RBP: dffffc0000000000 R08: 0000000000000000 R09: ffffffff8db68957
      R10: ffffffff881f737b R11: 0000000000000000 R12: 0000000000000000
      R13: ffffc900153770d8 R14: 00000000000002a0 R15: 00000000ffffffff
      FS:  00007f18bbb6f700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b2ca22000 CR3: 000000001a7d9000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 00000000000000d8 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      
      Fixes: 122c2948 ("net: bridge: mst: Support setting and reporting MST port states")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Tobias Waldekranz <tobias@waldekranz.com>
      Cc: Nikolay Aleksandrov <razor@blackwall.org>
      Reviewed-by: default avatarTobias Waldekranz <tobias@waldekranz.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Link: https://lore.kernel.org/r/20220322012314.795187-1-eric.dumazet@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      cde3fc24
  14. 17 Mar, 2022 1 commit
    • Tobias Waldekranz's avatar
      net: bridge: mst: Support setting and reporting MST port states · 122c2948
      Tobias Waldekranz authored
      Make it possible to change the port state in a given MSTI by extending
      the bridge port netlink interface (RTM_SETLINK on PF_BRIDGE).The
      proposed iproute2 interface would be:
      
          bridge mst set dev <PORT> msti <MSTI> state <STATE>
      
      Current states in all applicable MSTIs can also be dumped via a
      corresponding RTM_GETLINK. The proposed iproute interface looks like
      this:
      
      $ bridge mst
      port              msti
      vb1               0
      		    state forwarding
      		  100
      		    state disabled
      vb2               0
      		    state forwarding
      		  100
      		    state forwarding
      
      The preexisting per-VLAN states are still valid in the MST
      mode (although they are read-only), and can be queried as usual if one
      is interested in knowing a particular VLAN's state without having to
      care about the VID to MSTI mapping (in this example VLAN 20 and 30 are
      bound to MSTI 100):
      
      $ bridge -d vlan
      port              vlan-id
      vb1               10
      		    state forwarding mcast_router 1
      		  20
      		    state disabled mcast_router 1
      		  30
      		    state disabled mcast_router 1
      		  40
      		    state forwarding mcast_router 1
      vb2               10
      		    state forwarding mcast_router 1
      		  20
      		    state forwarding mcast_router 1
      		  30
      		    state forwarding mcast_router 1
      		  40
      		    state forwarding mcast_router 1
      Signed-off-by: default avatarTobias Waldekranz <tobias@waldekranz.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      122c2948
  15. 23 Feb, 2022 1 commit
  16. 29 Dec, 2021 2 commits
  17. 16 Oct, 2021 1 commit
  18. 05 Oct, 2021 2 commits
  19. 20 Aug, 2021 1 commit
  20. 14 Aug, 2021 1 commit
    • Nikolay Aleksandrov's avatar
      net: bridge: mcast: dump ipv4 querier state · c7fa1d9b
      Nikolay Aleksandrov authored
      Add support for dumping global IPv4 querier state, we dump the state
      only if our own querier is enabled or there has been another external
      querier which has won the election. For the bridge global state we use
      a new attribute IFLA_BR_MCAST_QUERIER_STATE and embed the state inside.
      The structure is:
       [IFLA_BR_MCAST_QUERIER_STATE]
        `[BRIDGE_QUERIER_IP_ADDRESS] - ip address of the querier
        `[BRIDGE_QUERIER_IP_PORT]    - bridge port ifindex where the querier was
                                       seen (set only if external querier)
        `[BRIDGE_QUERIER_IP_OTHER_TIMER]   -  other querier timeout
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c7fa1d9b
  21. 11 Aug, 2021 4 commits
  22. 20 Jul, 2021 2 commits
  23. 25 May, 2021 1 commit
  24. 29 Apr, 2021 1 commit
    • Zhang Zhengming's avatar
      bridge: Fix possible races between assigning rx_handler_data and setting IFF_BRIDGE_PORT bit · 59259ff7
      Zhang Zhengming authored
      There is a crash in the function br_get_link_af_size_filtered,
      as the port_exists(dev) is true and the rx_handler_data of dev is NULL.
      But the rx_handler_data of dev is correct saved in vmcore.
      
      The oops looks something like:
       ...
       pc : br_get_link_af_size_filtered+0x28/0x1c8 [bridge]
       ...
       Call trace:
        br_get_link_af_size_filtered+0x28/0x1c8 [bridge]
        if_nlmsg_size+0x180/0x1b0
        rtnl_calcit.isra.12+0xf8/0x148
        rtnetlink_rcv_msg+0x334/0x370
        netlink_rcv_skb+0x64/0x130
        rtnetlink_rcv+0x28/0x38
        netlink_unicast+0x1f0/0x250
        netlink_sendmsg+0x310/0x378
        sock_sendmsg+0x4c/0x70
        __sys_sendto+0x120/0x150
        __arm64_sys_sendto+0x30/0x40
        el0_svc_common+0x78/0x130
        el0_svc_handler+0x38/0x78
        el0_svc+0x8/0xc
      
      In br_add_if(), we found there is no guarantee that
      assigning rx_handler_data to dev->rx_handler_data
      will before setting the IFF_BRIDGE_PORT bit of priv_flags.
      So there is a possible data competition:
      
      CPU 0:                                                        CPU 1:
      (RCU read lock)                                               (RTNL lock)
      rtnl_calcit()                                                 br_add_slave()
        if_nlmsg_size()                                               br_add_if()
          br_get_link_af_size_filtered()                              -> netdev_rx_handler_register
                                                                          ...
                                                                          // The order is not guaranteed
            ...                                                           -> dev->priv_flags |= IFF_BRIDGE_PORT;
            // The IFF_BRIDGE_PORT bit of priv_flags has been set
            -> if (br_port_exists(dev)) {
              // The dev->rx_handler_data has NOT been assigned
              -> p = br_port_get_rcu(dev);
              ....
                                                                          -> rcu_assign_pointer(dev->rx_handler_data, rx_handler_data);
                                                                           ...
      
      Fix it in br_get_link_af_size_filtered, using br_port_get_check_rcu() and checking the return value.
      Signed-off-by: default avatarZhang Zhengming <zhangzhengming@huawei.com>
      Reviewed-by: default avatarZhao Lei <zhaolei69@huawei.com>
      Reviewed-by: default avatarWang Xiaogang <wangxiaogang3@huawei.com>
      Suggested-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      59259ff7
  25. 14 Apr, 2021 1 commit
  26. 15 Feb, 2021 3 commits
  27. 13 Feb, 2021 2 commits
  28. 28 Jan, 2021 1 commit
    • Nikolay Aleksandrov's avatar
      net: bridge: multicast: make tracked EHT hosts limit configurable · 2dba407f
      Nikolay Aleksandrov authored
      Add two new port attributes which make EHT hosts limit configurable and
      export the current number of tracked EHT hosts:
       - IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT: configure/retrieve current limit
       - IFLA_BRPORT_MCAST_EHT_HOSTS_CNT: current number of tracked hosts
      Setting IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT to 0 is currently not allowed.
      
      Note that we have to increase RTNL_SLAVE_MAX_TYPE to 38 minimum, I've
      increased it to 40 to have space for two more future entries.
      
      v2: move br_multicast_eht_set_hosts_limit() to br_multicast_eht.c,
          no functional change
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2dba407f
  29. 18 Jan, 2021 1 commit