Skip to content
  1. Mar 30, 2018
  2. Mar 29, 2018
  3. Mar 28, 2018
  4. Mar 27, 2018
    • Ursula Braun's avatar
      net/smc: use announced length in sock_recvmsg() · ab6f6dd1
      Ursula Braun authored
      
      
      Not every CLC proposal message needs the maximum buffer length.
      Due to the MSG_WAITALL flag, it is important to use the peeked
      real length when receiving the message.
      
      Fixes: d63d271c ("smc: switch to sock_recvmsg()")
      Signed-off-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab6f6dd1
    • Cong Wang's avatar
      llc: properly handle dev_queue_xmit() return value · b85ab56c
      Cong Wang authored
      
      
      llc_conn_send_pdu() pushes the skb into write queue and
      calls llc_conn_send_pdus() to flush them out. However, the
      status of dev_queue_xmit() is not returned to caller,
      in this case, llc_conn_state_process().
      
      llc_conn_state_process() needs hold the skb no matter
      success or failure, because it still uses it after that,
      therefore we should hold skb before dev_queue_xmit() when
      that skb is the one being processed by llc_conn_state_process().
      
      For other callers, they can just pass NULL and ignore
      the return value as they are.
      
      Reported-by: default avatarNoam Rathaus <noamr@beyondsecurity.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b85ab56c
    • David S. Miller's avatar
      Merge tag 'mlx5-fixes-2018-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 2a7fdec9
      David S. Miller authored
      
      
      Saeed Mahameed says:
      
      ====================
      Mellanox, mlx5 fixes 2018-03-23
      
      The following series includes fixes for mlx5 netdev and eswitch.
      
      v1->v2:
          - Fixed commit message quotation marks in patch #7
      
      For -stable v4.12
          ('net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path')
          ('net/mlx5e: Fix traffic being dropped on VF representor')
      
      For -stable v4.13
          ('net/mlx5e: Fix memory usage issues in offloading TC flows')
          ('net/mlx5e: Verify coalescing parameters in range')
      
      For -stable v4.14
          ('net/mlx5e: Don't override vport admin link state in switchdev mode')
      
      For -stable v4.15
          ('108b2b6d5c02 net/mlx5e: Sync netdev vxlan ports at open')
      
      Please pull and let me know if there's any problem.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a7fdec9
    • Dave Watson's avatar
      strparser: Fix sign of err codes · cd00edc1
      Dave Watson authored
      
      
      strp_parser_err is called with a negative code everywhere, which then
      calls abort_parser with a negative code.  strp_msg_timeout calls
      abort_parser directly with a positive code.  Negate ETIMEDOUT
      to match signed-ness of other calls.
      
      The default abort_parser callback, strp_abort_strp, sets
      sk->sk_err to err.  Also negate the error here so sk_err always
      holds a positive value, as the rest of the net code expects.  Currently
      a negative sk_err can result in endless loops, or user code that
      thinks it actually sent/received err bytes.
      
      Found while testing net/tls_sw recv path.
      
      Fixes: 43a0c675 ("strparser: Stream parser for messages")
      Signed-off-by: default avatarDave Watson <davejwatson@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd00edc1
    • Craig Dillabaugh's avatar
      net sched actions: fix dumping which requires several messages to user space · 734549eb
      Craig Dillabaugh authored
      
      
      Fixes a bug in the tcf_dump_walker function that can cause some actions
      to not be reported when dumping a large number of actions. This issue
      became more aggrevated when cookies feature was added. In particular
      this issue is manifest when large cookie values are assigned to the
      actions and when enough actions are created that the resulting table
      must be dumped in multiple batches.
      
      The number of actions returned in each batch is limited by the total
      number of actions and the memory buffer size.  With small cookies
      the numeric limit is reached before the buffer size limit, which avoids
      the code path triggering this bug. When large cookies are used buffer
      fills before the numeric limit, and the erroneous code path is hit.
      
      For example after creating 32 csum actions with the cookie
      aaaabbbbccccdddd
      
      $ tc actions ls action csum
      total acts 26
      
          action order 0: csum (tcp) action continue
          index 1 ref 1 bind 0
          cookie aaaabbbbccccdddd
      
          .....
      
          action order 25: csum (tcp) action continue
          index 26 ref 1 bind 0
          cookie aaaabbbbccccdddd
      total acts 6
      
          action order 0: csum (tcp) action continue
          index 28 ref 1 bind 0
          cookie aaaabbbbccccdddd
      
          ......
      
          action order 5: csum (tcp) action continue
          index 32 ref 1 bind 0
          cookie aaaabbbbccccdddd
      
      Note that the action with index 27 is omitted from the report.
      
      Fixes: 4b3550ef ("[NET_SCHED]: Use nla_nest_start/nla_nest_end")"
      Signed-off-by: default avatarCraig Dillabaugh <cdillaba@mojatatu.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      734549eb
    • Heiner Kallweit's avatar
      r8169: fix setting driver_data after register_netdev · 19c9ea36
      Heiner Kallweit authored
      
      
      pci_set_drvdata() is called only after registering the net_device,
      therefore we could run into a NPE if one of the functions using
      driver_data is called before it's set.
      
      Fix this by calling pci_set_drvdata() before registering the
      net_device.
      
      This fix is a candidate for stable. As far as I can see the
      bug has been there in kernel version 3.2 already, therefore
      I can't provide a reference which commit is fixed by it.
      
      The fix may need small adjustments per kernel version because
      due to other changes the label which is jumped to if
      register_netdev() fails has changed over time.
      
      Reported-by: default avatarDavid Miller <davem@davemloft.net>
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19c9ea36
    • Eric Dumazet's avatar
      net: fix possible out-of-bound read in skb_network_protocol() · 1dfe82eb
      Eric Dumazet authored
      
      
      skb mac header is not necessarily set at the time skb_network_protocol()
      is called. Use skb->data instead.
      
      BUG: KASAN: slab-out-of-bounds in skb_network_protocol+0x46b/0x4b0 net/core/dev.c:2739
      Read of size 2 at addr ffff8801b3097a0b by task syz-executor5/14242
      
      CPU: 1 PID: 14242 Comm: syz-executor5 Not tainted 4.16.0-rc6+ #280
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:17 [inline]
       dump_stack+0x194/0x24d lib/dump_stack.c:53
       print_address_description+0x73/0x250 mm/kasan/report.c:256
       kasan_report_error mm/kasan/report.c:354 [inline]
       kasan_report+0x23c/0x360 mm/kasan/report.c:412
       __asan_report_load_n_noabort+0xf/0x20 mm/kasan/report.c:443
       skb_network_protocol+0x46b/0x4b0 net/core/dev.c:2739
       harmonize_features net/core/dev.c:2924 [inline]
       netif_skb_features+0x509/0x9b0 net/core/dev.c:3011
       validate_xmit_skb+0x81/0xb00 net/core/dev.c:3084
       validate_xmit_skb_list+0xbf/0x120 net/core/dev.c:3142
       packet_direct_xmit+0x117/0x790 net/packet/af_packet.c:256
       packet_snd net/packet/af_packet.c:2944 [inline]
       packet_sendmsg+0x3aed/0x60b0 net/packet/af_packet.c:2969
       sock_sendmsg_nosec net/socket.c:629 [inline]
       sock_sendmsg+0xca/0x110 net/socket.c:639
       ___sys_sendmsg+0x767/0x8b0 net/socket.c:2047
       __sys_sendmsg+0xe5/0x210 net/socket.c:2081
      
      Fixes: 19acc327 ("gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Pravin B Shelar <pshelar@ovn.org>
      Reported-by: default avatarReported-by: syzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1dfe82eb
    • Giuseppe Lippolis's avatar
      net-usb: add qmi_wwan if on lte modem wistron neweb d18q1 · d4c4bc11
      Giuseppe Lippolis authored
      
      
      This modem is embedded on dlink dwr-921 router.
          The oem configuration states:
      
          T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
          D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
          P:  Vendor=1435 ProdID=0918 Rev= 2.32
          S:  Manufacturer=Android
          S:  Product=Android
          S:  SerialNumber=0123456789ABCDEF
          C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=500mA
          I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
          E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
          E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
          E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
          E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
          E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
          E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
          E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
          E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
          E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
          E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          I:* If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
          E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
          E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
      
      Tested on openwrt distribution
      
      Signed-off-by: default avatarGiuseppe Lippolis <giu.lippolis@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d4c4bc11
    • David S. Miller's avatar
      Merge tag 'batadv-net-for-davem-20180326' of git://git.open-mesh.org/linux-merge · d7785b59
      David S. Miller authored
      
      
      Simon Wunderlich says:
      
      ====================
      Here are some batman-adv bugfixes:
      
       - fix multicast-via-unicast transmissions for AP isolation and gateway
         extension, by Linus Luessing (2 patches)
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d7785b59
    • Shahar Klein's avatar
      net/mlx5e: Sync netdev vxlan ports at open · a117f73d
      Shahar Klein authored
      
      
      When mlx5_core is loaded it is expected to sync ports
      with all vxlan devices so it can support vxlan encap/decap.
      This is done via udp_tunnel_get_rx_info(). Currently this
      call is set in mlx5e_nic_enable() and if the netdev is not in
      NETREG_REGISTERED state it will not be called.
      
      Normally on load the netdev state is not NETREG_REGISTERED
      so udp_tunnel_get_rx_info() will not be called.
      
      Moving udp_tunnel_get_rx_info() to mlx5e_open() so
      it will be called on netdev UP event and allow encap/decap.
      
      Fixes: 610e89e0 ("net/mlx5e: Don't sync netdev state when not registered")
      Signed-off-by: default avatarShahar Klein <shahark@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      a117f73d
    • Or Gerlitz's avatar
      net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path · 423c9db2
      Or Gerlitz authored
      
      
      Currently we use the global ipv6_stub var to access the ipv6 global
      nd table. This practice gets us to troubles when the stub is only partially
      set e.g when ipv6 is loaded under the disabled policy. In this case, as of commit
      343d60aa ("ipv6: change ipv6_stub_impl.ipv6_dst_lookup to take net argument")
      the stub is not null, but stub->nd_tbl is and we crash.
      
      As we can access the ipv6 nd_tbl directly, the fix is just to avoid the
      reference through the stub. There is one place in the code where we
      issue ipv6 route lookup and keep doing it through the stub, but that
      mentioned commit makes sure we get -EAFNOSUPPORT from the stack.
      
      Fixes: 232c0013 ("net/mlx5e: Add support to neighbour update flow")
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: default avatarAviv Heller <avivh@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      423c9db2
    • Jianbo Liu's avatar
      net/mlx5e: Fix memory usage issues in offloading TC flows · af1607c3
      Jianbo Liu authored
      
      
      For NIC flows, the parsed attributes are not freed when we exit
      successfully from mlx5e_configure_flower().
      
      There is possible double free for eswitch flows. If error is returned
      from rhashtable_insert_fast(), the parse attrs will be freed in
      mlx5e_tc_del_flow(), but they will be freed again before exiting
      mlx5e_configure_flower().
      
      To fix both issues we do the following:
      (1) change the condition that determines if to issue the free call to
          check if this flow is NIC flow, or it does not have encap action.
      (2) reorder the code such that that the check and free calls are done
          before we attempt to add into the hash table.
      
      Fixes: 232c0013 ('net/mlx5e: Add support to neighbour update flow')
      Signed-off-by: default avatarJianbo Liu <jianbol@mellanox.com>
      Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      af1607c3
    • Roi Dayan's avatar
      net/mlx5e: Fix traffic being dropped on VF representor · 4246f698
      Roi Dayan authored
      
      
      Increase representor netdev RQ size to avoid dropped packets.
      The current size (two) is just too small to keep up with
      conventional slow path traffic patterns.
      Also match the SQ size to the RQ size.
      
      Fixes: cb67b832 ("net/mlx5e: Introduce SRIOV VF representors")
      Signed-off-by: default avatarRoi Dayan <roid@mellanox.com>
      Reviewed-by: default avatarPaul Blakey <paulb@mellanox.com>
      Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      4246f698
    • Moshe Shemesh's avatar
      net/mlx5e: Verify coalescing parameters in range · b392a207
      Moshe Shemesh authored
      
      
      Add check of coalescing parameters received through ethtool are within
      range of values supported by the HW.
      Driver gets the coalescing rx/tx-usecs and rx/tx-frames as set by the
      users through ethtool. The ethtool support up to 32 bit value for each.
      However, mlx5 modify cq limits the coalescing time parameter to 12 bit
      and coalescing frames parameters to 16 bits.
      Return out of range error if user tries to set these parameters to
      higher values.
      
      Fixes: f62b8bb8 ('net/mlx5: Extend mlx5_core to support ConnectX-4 Ethernet functionality')
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      b392a207
    • Or Gerlitz's avatar
      net/mlx5: Make eswitch support to depend on switchdev · f125376b
      Or Gerlitz authored
      
      
      Add dependancy for switchdev to be congfigured as any user-space control
      plane SW is expected to use the HW switchdev ID to locate the representors
      related to VFs of a certain PF and apply SW/offloaded switching on them.
      
      Fixes: e80541ec ('net/mlx5: Add CONFIG_MLX5_ESWITCH Kconfig')
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      f125376b
    • Or Gerlitz's avatar
      net/mlx5e: Use 32 bits to store VF representor SQ number · 5ecadff0
      Or Gerlitz authored
      
      
      SQs are 32 and not 16 bits, hence it's wrong to use only 16 bits to
      store the sq number for which are going to set steering rule, fix that.
      
      Fixes: cb67b832 ('net/mlx5e: Introduce SRIOV VF representors')
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      5ecadff0
    • Jianbo Liu's avatar
      net/mlx5e: Don't override vport admin link state in switchdev mode · 84c9c8f2
      Jianbo Liu authored
      
      
      The vport admin original link state will be re-applied after returning
      back to legacy mode, it is not right to change the admin link state value
      when in switchdev mode.
      
      Use direct vport commands to alter logical vport state in netdev
      representor open/close flows rather than the administrative eswitch API.
      
      Fixes: 20a1ea67 ('net/mlx5e: Support VF vport link state control for SRIOV switchdev mode')
      Signed-off-by: default avatarJianbo Liu <jianbol@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      84c9c8f2
    • Sean Wang's avatar
      net: dsa: mt7530: fix module autoloading for OF platform drivers · 3c82b372
      Sean Wang authored
      
      
      It's required to create a modules.alias via MODULE_DEVICE_TABLE helper
      for the OF platform driver. Otherwise, module autoloading cannot work.
      
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3c82b372
    • Sean Wang's avatar
      net: dsa: mt7530: remove redundant MODULE_ALIAS entries · 1c82c9e1
      Sean Wang authored
      
      
      MODULE_ALIAS exports information to allow the module to be auto-loaded at
      boot for the drivers registered using legacy platform registration.
      
      However, currently the driver is always used by DT-only platform,
      MODULE_ALIAS is redundant and should be removed properly.
      
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1c82c9e1
    • Jason Wang's avatar
      vhost_net: add missing lock nesting notation · aaa3149b
      Jason Wang authored
      
      
      We try to hold TX virtqueue mutex in vhost_net_rx_peek_head_len()
      after RX virtqueue mutex is held in handle_rx(). This requires an
      appropriate lock nesting notation to calm down deadlock detector.
      
      Fixes: 03088137 ("vhost_net: basic polling support")
      Reported-by: default avatar <syzbot+7f073540b1384a614e09@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aaa3149b
    • Torsten Hilbrich's avatar
      net/usb/qmi_wwan.c: Add USB id for lt4120 modem · f3d801ba
      Torsten Hilbrich authored
      
      
      This is needed to support the modem found in HP EliteBook 820 G3.
      
      Signed-off-by: default avatarTorsten Hilbrich <torsten.hilbrich@secunet.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f3d801ba
    • Xin Long's avatar
      team: move dev_mc_sync after master_upper_dev_link in team_port_add · 982cf3b3
      Xin Long authored
      
      
      The same fix as in 'bonding: move dev_mc_sync after master_upper_dev_link
      in bond_enslave' is needed for team driver.
      
      The panic can be reproduced easily:
      
        ip link add team1 type team
        ip link set team1 up
        ip link add link team1 vlan1 type vlan id 80
        ip link set vlan1 master team1
      
      Fixes: cb41c997 ("team: team should sync the port's uc/mc addrs when add a port")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      982cf3b3
    • David S. Miller's avatar
      Merge branch 'bond-hwaddr-sync-fixes' · e49c78f4
      David S. Miller authored
      
      
      Xin Long says:
      
      ====================
      bonding: a bunch of fixes for dev hwaddr sync in bond_enslave
      
      This patchset is mainly to fix a crash when adding vlan as slave of
      bond which is also the parent link in patch 2/3,  and also fix some
      err process problems in bond_enslave in patch 1/3 and 3/3.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e49c78f4
    • Xin Long's avatar
      bonding: process the err returned by dev_set_allmulti properly in bond_enslave · 9f5a90c1
      Xin Long authored
      
      
      When dev_set_promiscuity(1) succeeds but dev_set_allmulti(1) fails,
      dev_set_promiscuity(-1) should be done before going to the err path.
      Otherwise, dev->promiscuity will leak.
      
      Fixes: 7e1a1ac1 ("bonding: Check return of dev_set_promiscuity/allmulti")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarAndy Gospodarek <andy@greyhouse.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9f5a90c1
    • Xin Long's avatar
      bonding: move dev_mc_sync after master_upper_dev_link in bond_enslave · ae42cc62
      Xin Long authored
      
      
      Beniamino found a crash when adding vlan as slave of bond which is also
      the parent link:
      
        ip link add bond1 type bond
        ip link set bond1 up
        ip link add link bond1 vlan1 type vlan id 80
        ip link set vlan1 master bond1
      
      The call trace is as below:
      
        [<ffffffffa850842a>] queued_spin_lock_slowpath+0xb/0xf
        [<ffffffffa8515680>] _raw_spin_lock+0x20/0x30
        [<ffffffffa83f6f07>] dev_mc_sync+0x37/0x80
        [<ffffffffc08687dc>] vlan_dev_set_rx_mode+0x1c/0x30 [8021q]
        [<ffffffffa83efd2a>] __dev_set_rx_mode+0x5a/0xa0
        [<ffffffffa83f7138>] dev_mc_sync_multiple+0x78/0x80
        [<ffffffffc084127c>] bond_enslave+0x67c/0x1190 [bonding]
        [<ffffffffa8401909>] do_setlink+0x9c9/0xe50
        [<ffffffffa8403bf2>] rtnl_newlink+0x522/0x880
        [<ffffffffa8403ff7>] rtnetlink_rcv_msg+0xa7/0x260
        [<ffffffffa8424ecb>] netlink_rcv_skb+0xab/0xc0
        [<ffffffffa83fe498>] rtnetlink_rcv+0x28/0x30
        [<ffffffffa8424850>] netlink_unicast+0x170/0x210
        [<ffffffffa8424bf8>] netlink_sendmsg+0x308/0x420
        [<ffffffffa83cc396>] sock_sendmsg+0xb6/0xf0
      
      This is actually a dead lock caused by sync slave hwaddr from master when
      the master is the slave's 'slave'. This dead loop check is actually done
      by netdev_master_upper_dev_link. However, Commit 1f718f0f ("bonding:
      populate neighbour's private on enslave") moved it after dev_mc_sync.
      
      This patch is to fix it by moving dev_mc_sync after master_upper_dev_link,
      so that this loop check would be earlier than dev_mc_sync. It also moves
      if (mode == BOND_MODE_8023AD) into if (!bond_uses_primary) clause as an
      improvement.
      
      Note team driver also has this issue, I will fix it in another patch.
      
      Fixes: 1f718f0f ("bonding: populate neighbour's private on enslave")
      Reported-by: default avatarBeniamino Galvani <bgalvani@redhat.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarAndy Gospodarek <andy@greyhouse.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ae42cc62
    • Xin Long's avatar
      bonding: fix the err path for dev hwaddr sync in bond_enslave · 5c78f6bf
      Xin Long authored
      
      
      vlan_vids_add_by_dev is called right after dev hwaddr sync, so on
      the err path it should unsync dev hwaddr. Otherwise, the slave
      dev's hwaddr will never be unsync when this err happens.
      
      Fixes: 1ff412ad ("bonding: change the bond's vlan syncing functions with the standard ones")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Acked-by: default avatarAndy Gospodarek <andy@greyhouse.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5c78f6bf
    • John Fastabend's avatar
      net: sched, fix OOO packets with pfifo_fast · eb82a994
      John Fastabend authored
      
      
      After the qdisc lock was dropped in pfifo_fast we allow multiple
      enqueue threads and dequeue threads to run in parallel. On the
      enqueue side the skb bit ooo_okay is used to ensure all related
      skbs are enqueued in-order. On the dequeue side though there is
      no similar logic. What we observe is with fewer queues than CPUs
      it is possible to re-order packets when two instances of
      __qdisc_run() are running in parallel. Each thread will dequeue
      a skb and then whichever thread calls the ndo op first will
      be sent on the wire. This doesn't typically happen because
      qdisc_run() is usually triggered by the same core that did the
      enqueue. However, drivers will trigger __netif_schedule()
      when queues are transitioning from stopped to awake using the
      netif_tx_wake_* APIs. When this happens netif_schedule() calls
      qdisc_run() on the same CPU that did the netif_tx_wake_* which
      is usually done in the interrupt completion context. This CPU
      is selected with the irq affinity which is unrelated to the
      enqueue operations.
      
      To resolve this we add a RUNNING bit to the qdisc to ensure
      only a single dequeue per qdisc is running. Enqueue and dequeue
      operations can still run in parallel and also on multi queue
      NICs we can still have a dequeue in-flight per qdisc, which
      is typically per CPU.
      
      Fixes: c5ad119f ("net: sched: pfifo_fast use skb_array")
      Reported-by: default avatarJakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eb82a994