1. 31 Mar, 2018 7 commits
    • Shannon Nelson's avatar
      macvlan: filter out unsupported feature flags · 82fb8178
      Shannon Nelson authored
      
      [ Upstream commit 13fbcc8d ]
      
      Adding a macvlan device on top of a lowerdev that supports
      the xfrm offloads fails with a new regression:
        # ip link add link ens1f0 mv0 type macvlan
        RTNETLINK answers: Operation not permitted
      
      Tracing down the failure shows that the macvlan device inherits
      the NETIF_F_HW_ESP and NETIF_F_HW_ESP_TX_CSUM feature flags
      from the lowerdev, but with no dev->xfrmdev_ops API filled
      in, it doesn't actually support xfrm.  When the request is
      made to add the new macvlan device, the XFRM listener for
      NETDEV_REGISTER calls xfrm_api_check() which fails the new
      registration because dev->xfrmdev_ops is NULL.
      
      The macvlan creation succeeds when we filter out the ESP
      feature flags in macvlan_fix_features(), so let's filter them
      out like we're already filtering out ~NETIF_F_NETNS_LOCAL.
      When XFRM support is added in the future, we can add the flags
      into MACVLAN_FEATURES.
      
      This same problem could crop up in the future with any other
      new feature flags, so let's filter out any flags that aren't
      defined as supported in macvlan.
      
      Fixes: d77e38e6 ("xfrm: Add an IPsec hardware offloading API")
      Reported-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
      Signed-off-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82fb8178
    • Arkadi Sharshevsky's avatar
      devlink: Remove redundant free on error path · b51eb57d
      Arkadi Sharshevsky authored
      
      [ Upstream commit 7fe4d6dc ]
      
      The current code performs unneeded free. Remove the redundant skb freeing
      during the error path.
      
      Fixes: 1555d204 ("devlink: Support for pipeline debug (dpipe)")
      Signed-off-by: default avatarArkadi Sharshevsky <arkadis@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b51eb57d
    • Grygorii Strashko's avatar
      net: phy: relax error checking when creating sysfs link netdev->phydev · 67a1dc56
      Grygorii Strashko authored
      
      [ Upstream commit 4414b3ed ]
      
      Some ethernet drivers (like TI CPSW) may connect and manage >1 Net PHYs per
      one netdevice, as result such drivers will produce warning during system
      boot and fail to connect second phy to netdevice when PHYLIB framework
      will try to create sysfs link netdev->phydev for second PHY
      in phy_attach_direct(), because sysfs link with the same name has been
      created already for the first PHY. As result, second CPSW external
      port will became unusable.
      
      Fix it by relaxing error checking when PHYLIB framework is creating sysfs
      link netdev->phydev in phy_attach_direct(), suppressing warning by using
      sysfs_create_link_nowarn() and adding error message instead.
      After this change links (phy->netdev and netdev->phy) creation failure is not
      fatal any more and system can continue working, which fixes TI CPSW issue.
      
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Fixes: a3995460 ("net: phy: Relax error checking on sysfs_create_link()")
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67a1dc56
    • Grygorii Strashko's avatar
      sysfs: symlink: export sysfs_create_link_nowarn() · 223c5424
      Grygorii Strashko authored
      
      [ Upstream commit 2399ac42 ]
      
      The sysfs_create_link_nowarn() is going to be used in phylib framework in
      subsequent patch which can be built as module. Hence, export
      sysfs_create_link_nowarn() to avoid build errors.
      
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Fixes: a3995460 ("net: phy: Relax error checking on sysfs_create_link()")
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      223c5424
    • Michal Kalderon's avatar
      qed: Fix non TCP packets should be dropped on iWARP ll2 connection · 497166d6
      Michal Kalderon authored
      
      [ Upstream commit 16da0904 ]
      
      FW workaround. The iWARP LL2 connection did not expect TCP packets
      to arrive on it's connection. The fix drops any non-tcp packets
      
      Fixes b5c29ca7 ("qed: iWARP CM - setup a ll2 connection for handling
      SYN packets")
      Signed-off-by: default avatarMichal Kalderon <Michal.Kalderon@cavium.com>
      Signed-off-by: default avatarAriel Elior <Ariel.Elior@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      497166d6
    • Soheil Hassas Yeganeh's avatar
      tcp: purge write queue upon aborting the connection · e44c1733
      Soheil Hassas Yeganeh authored
      
      [ Upstream commit e05836ac ]
      
      When the connection is aborted, there is no point in
      keeping the packets on the write queue until the connection
      is closed.
      
      Similar to a27fd7a8 ('tcp: purge write queue upon RST'),
      this is essential for a correct MSG_ZEROCOPY implementation,
      because userspace cannot call close(fd) before receiving
      zerocopy signals even when the connection is aborted.
      
      Fixes: f214f915 ("tcp: enable MSG_ZEROCOPY")
      Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e44c1733
    • Soheil Hassas Yeganeh's avatar
      tcp: reset sk_send_head in tcp_write_queue_purge · dbbf2d1e
      Soheil Hassas Yeganeh authored
      
      tcp_write_queue_purge clears all the SKBs in the write queue
      but does not reset the sk_send_head. As a result, we can have
      a NULL pointer dereference anywhere that we use tcp_send_head
      instead of the tcp_write_queue_tail.
      
      For example, after a27fd7a8 (tcp: purge write queue upon RST),
      we can purge the write queue on RST. Prior to
      75c119af (tcp: implement rb-tree based retransmit queue),
      tcp_push will only check tcp_send_head and then accesses
      tcp_write_queue_tail to send the actual SKB. As a result, it will
      dereference a NULL pointer.
      
      This has been reported twice for 4.14 where we don't have
      75c119af:
      
      By Timofey Titovets:
      
      [  422.081094] BUG: unable to handle kernel NULL pointer dereference
      at 0000000000000038
      [  422.081254] IP: tcp_push+0x42/0x110
      [  422.081314] PGD 0 P4D 0
      [  422.081364] Oops: 0002 [#1] SMP PTI
      
      By Yongjian Xu:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
      IP: tcp_push+0x48/0x120
      PGD 80000007ff77b067 P4D 80000007ff77b067 PUD 7fd989067 PMD 0
      Oops: 0002 [#18] SMP PTI
      Modules linked in: tcp_diag inet_diag tcp_bbr sch_fq iTCO_wdt
      iTCO_vendor_support pcspkr ixgbe mdio i2c_i801 lpc_ich joydev input_leds shpchp
      e1000e igb dca ptp pps_core hwmon mei_me mei ipmi_si ipmi_msghandler sg ses
      scsi_transport_sas enclosure ext4 jbd2 mbcache sd_mod ahci libahci megaraid_sas
      wmi ast ttm dm_mirror dm_region_hash dm_log dm_mod dax
      CPU: 6 PID: 14156 Comm: [ET_NET 6] Tainted: G D 4.14.26-1.el6.x86_64 #1
      Hardware name: LENOVO ThinkServer RD440 /ThinkServer RD440, BIOS A0TS80A
      09/22/2014
      task: ffff8807d78d8140 task.stack: ffffc9000e944000
      RIP: 0010:tcp_push+0x48/0x120
      RSP: 0018:ffffc9000e947a88 EFLAGS: 00010246
      RAX: 00000000000005b4 RBX: ffff880f7cce9c00 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000040 RDI: ffff8807d00f5000
      RBP: ffffc9000e947aa8 R08: 0000000000001c84 R09: 0000000000000000
      R10: ffff8807d00f5158 R11: 0000000000000000 R12: ffff8807d00f5000
      R13: 0000000000000020 R14: 00000000000256d4 R15: 0000000000000000
      FS: 00007f5916de9700(0000) GS:ffff88107fd00000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000038 CR3: 00000007f8226004 CR4: 00000000001606e0
      Call Trace:
      tcp_sendmsg_locked+0x33d/0xe50
      tcp_sendmsg+0x37/0x60
      inet_sendmsg+0x39/0xc0
      sock_sendmsg+0x49/0x60
      sock_write_iter+0xb6/0x100
      do_iter_readv_writev+0xec/0x130
      ? rw_verify_area+0x49/0xb0
      do_iter_write+0x97/0xd0
      vfs_writev+0x7e/0xe0
      ? __wake_up_common_lock+0x80/0xa0
      ? __fget_light+0x2c/0x70
      ? __do_page_fault+0x1e7/0x530
      do_writev+0x60/0xf0
      ? inet_shutdown+0xac/0x110
      SyS_writev+0x10/0x20
      do_syscall_64+0x6f/0x140
      ? prepare_exit_to_usermode+0x8b/0xa0
      entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      RIP: 0033:0x3135ce0c57
      RSP: 002b:00007f5916de4b00 EFLAGS: 00000293 ORIG_RAX: 0000000000000014
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000003135ce0c57
      RDX: 0000000000000002 RSI: 00007f5916de4b90 RDI: 000000000000606f
      RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f5916de8c38
      R10: 0000000000000000 R11: 0000000000000293 R12: 00000000000464cc
      R13: 00007f5916de8c30 R14: 00007f58d8bef080 R15: 0000000000000002
      Code: 48 8b 97 60 01 00 00 4c 8d 97 58 01 00 00 41 b9 00 00 00 00 41 89 f3 4c 39
      d2 49 0f 44 d1 41 81 e3 00 80 00 00 0f 85 b0 00 00 00 <80> 4a 38 08 44 8b 8f 74
      06 00 00 44 89 8f 7c 06 00 00 83 e6 01
      RIP: tcp_push+0x48/0x120 RSP: ffffc9000e947a88
      CR2: 0000000000000038
      ---[ end trace 8d545c2e93515549 ]---
      
      Fixes: a27fd7a8 (tcp: purge write queue upon RST)
      Reported-by: default avatarTimofey Titovets <nefelim4ag@gmail.com>
      Reported-by: default avatarYongjian Xu <yongjianchn@gmail.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Tested-by: default avatarYongjian Xu <yongjianchn@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dbbf2d1e
  2. 28 Mar, 2018 33 commits