1. 27 11月, 2018 7 次提交
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclge_reset() · 92cb1b09
      Huazhong Tan 提交于
      [ Upstream commit a963052e539887df481d4d3a6ad4c92ca6461852 ]
      
      Since hclge_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclge_reset_wait(). So this patch releases the lock for the duration
      of hclge_reset_wait().
      
      Fixes: 6d4fab39 ("net: hns3: Reset net device with rtnl_lock")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      92cb1b09
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclgevf_reset() · 733edfd6
      Huazhong Tan 提交于
      [ Upstream commit 29118ab962d5476fdc65fae312ac38db68092d78 ]
      
      Since hclgevf_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclgevf_reset_wait(). So this patch releases the lock for the duration
      of hclgevf_reset_wait().
      
      Fixes: 6988eb2a ("net: hns3: Add support to reset the enet/ring mgmt layer")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      733edfd6
    • M
      block: brd: associate with queue until adding disk · 0987d5a6
      Ming Lei 提交于
      [ Upstream commit 153fcd5f6d93b8e1e4040b1337f564a10f8d93af ]
      
      brd_free() may be called in failure path on one brd instance which
      disk isn't added yet, so release handler of gendisk may free the
      associated request_queue early and causes the following use-after-free[1].
      
      This patch fixes this issue by associating gendisk with request_queue
      just before adding disk.
      
      [1] KASAN: use-after-free Read in del_timer_syncNon-volatile memory driver v1.3
      Linux agpgart interface v0.103
      [drm] Initialized vgem 1.0.0 20120112 for virtual device on minor 0
      usbcore: registered new interface driver udl
      ==================================================================
      BUG: KASAN: use-after-free in __lock_acquire+0x36d9/0x4c20
      kernel/locking/lockdep.c:3218
      Read of size 8 at addr ffff8801d1b6b540 by task swapper/0/1
      
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0+ #88
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Call Trace:
        __dump_stack lib/dump_stack.c:77 [inline]
        dump_stack+0x244/0x39d lib/dump_stack.c:113
        print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
        kasan_report_error mm/kasan/report.c:354 [inline]
        kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
        __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
        __lock_acquire+0x36d9/0x4c20 kernel/locking/lockdep.c:3218
        lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844
        del_timer_sync+0xb7/0x270 kernel/time/timer.c:1283
        blk_cleanup_queue+0x413/0x710 block/blk-core.c:809
        brd_free+0x5d/0x71 drivers/block/brd.c:422
        brd_init+0x2eb/0x393 drivers/block/brd.c:518
        do_one_initcall+0x145/0x957 init/main.c:890
        do_initcall_level init/main.c:958 [inline]
        do_initcalls init/main.c:966 [inline]
        do_basic_setup init/main.c:984 [inline]
        kernel_init_freeable+0x5c6/0x6b9 init/main.c:1148
        kernel_init+0x11/0x1ae init/main.c:1068
        ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:350
      
      Reported-by: syzbot+3701447012fe951dabb2@syzkaller.appspotmail.com
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0987d5a6
    • A
      arm64: kprobe: make page to RO mode when allocate it · 262522cc
      Anders Roxell 提交于
      [ Upstream commit 966866892cf89d606544bca22d584ba2ef9ec208 ]
      
      Commit 1404d6f1 ("arm64: dump: Add checking for writable and exectuable pages")
      has successfully identified code that leaves a page with W+X
      permissions.
      
      [    3.245140] arm64/mm: Found insecure W+X mapping at address (____ptrval____)/0xffff000000d90000
      [    3.245771] WARNING: CPU: 0 PID: 1 at ../arch/arm64/mm/dump.c:232 note_page+0x410/0x420
      [    3.246141] Modules linked in:
      [    3.246653] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc5-next-20180928-00001-ge70ae259b853-dirty #62
      [    3.247008] Hardware name: linux,dummy-virt (DT)
      [    3.247347] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [    3.247623] pc : note_page+0x410/0x420
      [    3.247898] lr : note_page+0x410/0x420
      [    3.248071] sp : ffff00000804bcd0
      [    3.248254] x29: ffff00000804bcd0 x28: ffff000009274000
      [    3.248578] x27: ffff00000921a000 x26: ffff80007dfff000
      [    3.248845] x25: ffff0000093f5000 x24: ffff000009526f6a
      [    3.249109] x23: 0000000000000004 x22: ffff000000d91000
      [    3.249396] x21: ffff000000d90000 x20: 0000000000000000
      [    3.249661] x19: ffff00000804bde8 x18: 0000000000000400
      [    3.249924] x17: 0000000000000000 x16: 0000000000000000
      [    3.250271] x15: ffffffffffffffff x14: 295f5f5f5f6c6176
      [    3.250594] x13: 7274705f5f5f5f28 x12: 2073736572646461
      [    3.250941] x11: 20746120676e6970 x10: 70616d20582b5720
      [    3.251252] x9 : 6572756365736e69 x8 : 3039643030303030
      [    3.251519] x7 : 306666666678302f x6 : ffff0000095467b2
      [    3.251802] x5 : 0000000000000000 x4 : 0000000000000000
      [    3.252060] x3 : 0000000000000000 x2 : ffffffffffffffff
      [    3.252323] x1 : 4d151327adc50b00 x0 : 0000000000000000
      [    3.252664] Call trace:
      [    3.252953]  note_page+0x410/0x420
      [    3.253186]  walk_pgd+0x12c/0x238
      [    3.253417]  ptdump_check_wx+0x68/0xf8
      [    3.253637]  mark_rodata_ro+0x68/0x98
      [    3.253847]  kernel_init+0x38/0x160
      [    3.254103]  ret_from_fork+0x10/0x18
      
      kprobes allocates a writable executable page with module_alloc() in
      order to store executable code.
      Reworked to that when allocate a page it sets mode RO. Inspired by
      commit 63fef14f ("kprobes/x86: Make insn buffer always ROX and use text_poke()").
      Suggested-by: NArnd Bergmann <arnd@arndb.de>
      Suggested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NLaura Abbott <labbott@redhat.com>
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      [catalin.marinas@arm.com: removed unnecessary casts]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      262522cc
    • R
      cifs: fix return value for cifs_listxattr · e4ed4e68
      Ronnie Sahlberg 提交于
      [ Upstream commit 0c5d6cb6643f48ad3775322f3ebab6c7eb67484e ]
      
      If the application buffer was too small to fit all the names
      we would still count the number of bytes and return this for
      listxattr. This would then trigger a BUG in usercopy.c
      
      Fix the computation of the size so that we return -ERANGE
      correctly when the buffer is too small.
      
      This fixes the kernel BUG for xfstest generic/377
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e4ed4e68
    • C
      cifs: don't dereference smb_file_target before null check · ad1834fd
      Colin Ian King 提交于
      [ Upstream commit 8c6c9bed8773375b1d54ccca2911ec892c59db5d ]
      
      There is a null check on dst_file->private data which suggests
      it can be potentially null. However, before this check, pointer
      smb_file_target is derived from dst_file->private and dereferenced
      in the call to tlink_tcon, hence there is a potential null pointer
      deference.
      
      Fix this by assigning smb_file_target and target_tcon after the
      null pointer sanity checks.
      
      Detected by CoverityScan, CID#1475302 ("Dereference before null check")
      
      Fixes: 04b38d60 ("vfs: pull btrfs clone API to vfs layer")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ad1834fd
    • V
      drm/i915: Replace some PAGE_SIZE with I915_GTT_PAGE_SIZE · 1beb22c5
      Ville Syrjälä 提交于
      commit f6e35cda66146106cfeb85ed65696e0f8e793fee upstream.
      
      Use I915_GTT_PAGE_SIZE when talking about GTT pages rather than
      physical pages.
      
      There are some PAGE_SHIFTs left though. Not sure if we want to
      introduce I915_GTT_PAGE_SHIFT or what?
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> # at least some of it :)
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180913150405.706-1-ville.syrjala@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1beb22c5
  2. 23 11月, 2018 33 次提交
    • G
      Linux 4.19.4 · 98a661ea
      Greg Kroah-Hartman 提交于
      98a661ea
    • G
      Revert "x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation" · 6b188783
      Greg Kroah-Hartman 提交于
      This reverts commit 233b9d7d which is
      commit 53c613fe6349994f023245519265999eed75957f upstream.
      
      It's not ready for the stable trees as there are major slowdowns
      involved with this patch.
      Reported-by: NJiri Kosina <jkosina@suse.cz>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc:  "WoodhouseDavid" <dwmw@amazon.co.uk>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc:  "SchauflerCasey" <casey.schaufler@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6b188783
    • F
      usbnet: smsc95xx: disable carrier check while suspending · 520d5649
      Frieder Schrempf 提交于
      [ Upstream commit 7b900ead6cc66b2ee873cb042dfba169aa68b56c ]
      
      We need to make sure, that the carrier check polling is disabled
      while suspending. Otherwise we can end up with usbnet_read_cmd()
      being issued when only usbnet_read_cmd_nopm() is allowed. If this
      happens, read operations lock up.
      
      Fixes: d69d1694 ("usbnet: smsc95xx: fix link detection for disabled autonegotiation")
      Signed-off-by: NFrieder Schrempf <frieder.schrempf@kontron.de>
      Reviewed-by: NRaghuram Chary J <RaghuramChary.Jallipalli@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      520d5649
    • D
      rxrpc: Fix lockup due to no error backoff after ack transmit error · 36b05750
      David Howells 提交于
      [ Upstream commit c7e86acfcee30794dc99a0759924bf7b9d43f1ca ]
      
      If the network becomes (partially) unavailable, say by disabling IPv6, the
      background ACK transmission routine can get itself into a tizzy by
      proposing immediate ACK retransmission.  Since we're in the call event
      processor, that happens immediately without returning to the workqueue
      manager.
      
      The condition should clear after a while when either the network comes back
      or the call times out.
      
      Fix this by:
      
       (1) When re-proposing an ACK on failed Tx, don't schedule it immediately.
           This will allow a certain amount of time to elapse before we try
           again.
      
       (2) Enforce a return to the workqueue manager after a certain number of
           iterations of the call processing loop.
      
       (3) Add a backoff delay that increases the delay on deferred ACKs by a
           jiffy per failed transmission to a limit of HZ.  The backoff delay is
           cleared on a successful return from kernel_sendmsg().
      
       (4) Cancel calls immediately if the opening sendmsg fails.  The layer
           above can arrange retransmission or rotate to another server.
      
      Fixes: 248f219c ("rxrpc: Rewrite the data and ack handling code")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36b05750
    • S
      net: smsc95xx: Fix MTU range · 75f75716
      Stefan Wahren 提交于
      [ Upstream commit 85b18b0237ce9986a81a1b9534b5e2ee116f5504 ]
      
      The commit f77f0aee ("net: use core MTU range checking in USB NIC
      drivers") introduce a common MTU handling for usbnet. But it's missing
      the necessary changes for smsc95xx. So set the MTU range accordingly.
      
      This patch has been tested on a Raspberry Pi 3.
      
      Fixes: f77f0aee ("net: use core MTU range checking in USB NIC drivers")
      Signed-off-by: NStefan Wahren <stefan.wahren@i2se.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75f75716
    • S
      mlxsw: spectrum: Fix IP2ME CPU policer configuration · 34863c74
      Shalom Toledo 提交于
      [ Upstream commit 96801552f846460fe9ac10f1b189602992f004e1 ]
      
      The CPU policer used to police packets being trapped via a local route
      (IP2ME) was incorrectly configured to police based on bytes per second
      instead of packets per second.
      
      Change the policer to police based on packets per second and avoid
      packet loss under certain circumstances.
      
      Fixes: 9148e7cf ("mlxsw: spectrum: Add policers for trap groups")
      Signed-off-by: NShalom Toledo <shalomt@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      34863c74
    • X
      sctp: not increase stream's incnt before sending addstrm_in request · a886c278
      Xin Long 提交于
      [ Upstream commit e1e46479847e66f78f79d8c24d5169a5954b3fc2 ]
      
      Different from processing the addstrm_out request, The receiver handles
      an addstrm_in request by sending back an addstrm_out request to the
      sender who will increase its stream's in and incnt later.
      
      Now stream->incnt has been increased since it sent out the addstrm_in
      request in sctp_send_add_streams(), with the wrong stream->incnt will
      even cause crash when copying stream info from the old stream's in to
      the new one's in sctp_process_strreset_addstrm_out().
      
      This patch is to fix it by simply removing the stream->incnt change
      from sctp_send_add_streams().
      
      Fixes: 242bd2d5 ("sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter")
      Reported-by: NJianwen Ji <jiji@redhat.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a886c278
    • M
      net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs · 79abb48a
      Martin Schiller 提交于
      [ Upstream commit df5a8ec64eed7fe45b556cfff503acd6429ab817 ]
      
      Up until commit 7e5fbd1e ("net: mdio-gpio: Convert to use gpiod
      functions where possible"), the _cansleep variants of the gpio_ API was
      used. After that commit and the change to gpiod_ API, the _cansleep()
      was dropped. This then results in WARN_ON() when used with GPIO
      devices which do sleep. Add back the _cansleep() to avoid this.
      
      Fixes: 7e5fbd1e ("net: mdio-gpio: Convert to use gpiod functions where possible")
      Signed-off-by: NMartin Schiller <ms@dev.tdt.de>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79abb48a
    • X
      sctp: fix strchange_flags name for Stream Change Event · 5811532f
      Xin Long 提交于
      [ Upstream commit fd82d61ba142f0b83463e47064bf5460aac57b6e ]
      
      As defined in rfc6525#section-6.1.3, SCTP_STREAM_CHANGE_DENIED
      and SCTP_STREAM_CHANGE_FAILED should be used instead of
      SCTP_ASSOC_CHANGE_DENIED and SCTP_ASSOC_CHANGE_FAILED.
      
      To keep the compatibility, fix it by adding two macros.
      
      Fixes: b444153f ("sctp: add support for generating add stream change event notification")
      Reported-by: NJianwen Ji <jiji@redhat.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5811532f
    • T
      net: dsa: microchip: initialize mutex before use · 1d72b5d3
      Tristram Ha 提交于
      [ Upstream commit 284fb78ed7572117846f8e1d1d8e3dbfd16880c2 ]
      
      Initialize mutex before use.  Avoid kernel complaint when
      CONFIG_DEBUG_LOCK_ALLOC is enabled.
      
      Fixes: b987e98e ("dsa: add DSA switch driver for Microchip KSZ9477")
      Signed-off-by: NTristram Ha <Tristram.Ha@microchip.com>
      Reviewed-by: NPavel Machek <pavel@ucw.cz>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d72b5d3
    • S
      net: qualcomm: rmnet: Fix incorrect assignment of real_dev · ab60e82f
      Subash Abhinov Kasiviswanathan 提交于
      [ Upstream commit d02854dc1999ed3e7fd79ec700c64ac23ac0c458 ]
      
      A null dereference was observed when a sysctl was being set
      from userspace and rmnet was stuck trying to complete some actions
      in the NETDEV_REGISTER callback. This is because the real_dev is set
      only after the device registration handler completes.
      
      sysctl call stack -
      
      <6> Unable to handle kernel NULL pointer dereference at
          virtual address 00000108
      <2> pc : rmnet_vnd_get_iflink+0x1c/0x28
      <2> lr : dev_get_iflink+0x2c/0x40
      <2>  rmnet_vnd_get_iflink+0x1c/0x28
      <2>  inet6_fill_ifinfo+0x15c/0x234
      <2>  inet6_ifinfo_notify+0x68/0xd4
      <2>  ndisc_ifinfo_sysctl_change+0x1b8/0x234
      <2>  proc_sys_call_handler+0xac/0x100
      <2>  proc_sys_write+0x3c/0x4c
      <2>  __vfs_write+0x54/0x14c
      <2>  vfs_write+0xcc/0x188
      <2>  SyS_write+0x60/0xc0
      <2>  el0_svc_naked+0x34/0x38
      
      device register call stack -
      
      <2>  notifier_call_chain+0x84/0xbc
      <2>  raw_notifier_call_chain+0x38/0x48
      <2>  call_netdevice_notifiers_info+0x40/0x70
      <2>  call_netdevice_notifiers+0x38/0x60
      <2>  register_netdevice+0x29c/0x3d8
      <2>  rmnet_vnd_newlink+0x68/0xe8
      <2>  rmnet_newlink+0xa0/0x160
      <2>  rtnl_newlink+0x57c/0x6c8
      <2>  rtnetlink_rcv_msg+0x1dc/0x328
      <2>  netlink_rcv_skb+0xac/0x118
      <2>  rtnetlink_rcv+0x24/0x30
      <2>  netlink_unicast+0x158/0x1f0
      <2>  netlink_sendmsg+0x32c/0x338
      <2>  sock_sendmsg+0x44/0x60
      <2>  SyS_sendto+0x150/0x1ac
      <2>  el0_svc_naked+0x34/0x38
      
      Fixes: b752eff5 ("net: qualcomm: rmnet: Implement ndo_get_iflink")
      Signed-off-by: NSean Tranchetti <stranche@codeaurora.org>
      Signed-off-by: NSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ab60e82f
    • X
      sctp: define SCTP_SS_DEFAULT for Stream schedulers · cc8d2e53
      Xin Long 提交于
      [ Upstream commit 12480e3b16982c4026de10dd8155823219cd6391 ]
      
      According to rfc8260#section-4.3.2, SCTP_SS_DEFAULT is required to
      defined as SCTP_SS_FCFS or SCTP_SS_RR.
      
      SCTP_SS_FCFS is used for SCTP_SS_DEFAULT's value in this patch.
      
      Fixes: 5bbbbe32 ("sctp: introduce stream scheduler foundations")
      Reported-by: NJianwen Ji <jiji@redhat.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cc8d2e53
    • H
      net: phy: realtek: fix RTL8201F sysfs name · c87de869
      Holger Hoffstätte 提交于
      [ Upstream commit 0432e833191ad4d17b7fc2364941f91dad51db1a ]
      
      Since 4.19 the following error in sysfs has appeared when using the
      r8169 NIC driver:
      
      $cd /sys/module/realtek/drivers
      $ls -l
      ls: cannot access 'mdio_bus:RTL8201F 10/100Mbps Ethernet': No such file or directory
      [..garbled dir entries follow..]
      
      Apparently the forward slash in "10/100Mbps Ethernet" is interpreted
      as directory separator that leads nowhere, and was introduced in commit
      513588dd ("net: phy: realtek: add RTL8201F phy-id and functions").
      
      Fix this by removing the offending slash in the driver name.
      
      Other drivers in net/phy seem to have the same problem, but I cannot
      test/verify them.
      
      Fixes: 513588dd ("net: phy: realtek: add RTL8201F phy-id and functions")
      Signed-off-by: NHolger Hoffstätte <holger@applied-asynchrony.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c87de869
    • A
      net: dsa: mv88e6xxx: Fix clearing of stats counters · a043791f
      Andrew Lunn 提交于
      [ Upstream commit a9049ff9214da68df1179a7d5e36b43479abc9b8 ]
      
      The mv88e6161 would sometime fail to probe with a timeout waiting for
      the switch to complete an operation. This operation is supposed to
      clear the statistics counters. However, due to a read/modify/write,
      without the needed mask, the operation actually carried out was more
      random, with invalid parameters, resulting in the switch not
      responding. We need to preserve the histogram mode bits, so apply a
      mask to keep them.
      Reported-by: NChris Healy <Chris.Healy@zii.aero>
      Fixes: 40cff8fc ("net: dsa: mv88e6xxx: Fix stats histogram mode")
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a043791f
    • D
      net/mlx5e: IPoIB, Reset QP after channels are closed · 0b4beb0d
      Denis Drozdov 提交于
      [ Upstream commit acf3766b36d8e59ecbc307894c6d05703ee48014 ]
      
      The mlx5e channels should be closed before mlx5i_uninit_underlay_qp
      puts the QP into RST (reset) state during mlx5i_close. Currently QP
      state incorrectly set to RST before channels got deactivated and closed,
      since mlx5_post_send request expects QP in RTS (Ready To Send) state.
      
      The fix is to keep QP in RTS state until mlx5e channels get closed
      and to reset QP afterwards.
      
      Also this fix is simply correct in order to keep the open/close flow
      symmetric, i.e mlx5i_init_underlay_qp() is called first thing at open,
      the correct thing to do is to call mlx5i_uninit_underlay_qp() last thing
      at close, which is exactly what this patch is doing.
      
      Fixes: dae37456 ("net/mlx5: Support for attaching multiple underlay QPs to root flow table")
      Signed-off-by: NDenis Drozdov <denisd@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b4beb0d
    • R
      net/mlx5: IPSec, Fix the SA context hash key · 7962f000
      Raed Salem 提交于
      [ Upstream commit f2b18732ee9863ac036759baf616ffa03c252ed5 ]
      
      The commit "net/mlx5: Refactor accel IPSec code" introduced a
      bug where asynchronous short time change in hash key value
      by create/release SA context might happen during an asynchronous
      hash resize operation this could cause a subsequent remove SA
      context operation to fail as the key value used during resize is
      not the same key value used when remove SA context operation is
      invoked.
      
      This commit fixes the bug by defining the SA context hash key
      such that it includes only fields that never change during the
      lifetime of the SA context object.
      
      Fixes: d6c4f029 ("net/mlx5: Refactor accel IPSec code")
      Signed-off-by: NRaed Salem <raeds@mellanox.com>
      Reviewed-by: NAviad Yehezkel <aviadye@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7962f000
    • X
      l2tp: fix a sock refcnt leak in l2tp_tunnel_register · 79272fc2
      Xin Long 提交于
      [ Upstream commit f8504f4ca0a0e9f84546ef86e00b24d2ea9a0bd2 ]
      
      This issue happens when trying to add an existent tunnel. It
      doesn't call sock_put() before returning -EEXIST to release
      the sock refcnt that was held by calling sock_hold() before
      the existence check.
      
      This patch is to fix it by holding the sock after doing the
      existence check.
      
      Fixes: f6cd651b ("l2tp: fix race in duplicate tunnel detection")
      Reported-by: NJianlin Shi <jishi@redhat.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Reviewed-by: NGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79272fc2
    • E
      inet: frags: better deal with smp races · 115973a6
      Eric Dumazet 提交于
      [ Upstream commit 0d5b9311baf27bb545f187f12ecfd558220c607d ]
      
      Multiple cpus might attempt to insert a new fragment in rhashtable,
      if for example RPS is buggy, as reported by 배석진 in
      https://patchwork.ozlabs.org/patch/994601/
      
      We use rhashtable_lookup_get_insert_key() instead of
      rhashtable_insert_fast() to let cpus losing the race
      free their own inet_frag_queue and use the one that
      was inserted by another cpu.
      
      Fixes: 648700f7 ("inet: frags: use rhashtables for reassembly units")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: N배석진 <soukjin.bae@samsung.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      115973a6
    • S
      net/mlx5e: Removed unnecessary warnings in FEC caps query · 642e1d8a
      Shay Agroskin 提交于
      [ Upstream commit 64e283348458e2fd2fe41b60dfb6c30e88ee695f ]
      
      Querying interface FEC caps with 'ethtool [int]' after link reset
      throws warning regading link speed.
      This warning is not needed as there is already an indication in
      user space that the link is not up.
      
      Fixes: 0696d608 ("net/mlx5e: Receive buffer configuration")
      Signed-off-by: NShay Agroskin <shayag@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      642e1d8a
    • V
      net/mlx5e: Fix selftest for small MTUs · bb3255de
      Valentine Fatiev 提交于
      [ Upstream commit 228c4cd04dfd0667eda182c91504b83c17d97584 ]
      
      Loopback test had fixed packet size, which can be bigger than configured
      MTU. Shorten the loopback packet size to be bigger than minimal MTU
      allowed by the device. Text field removed from struct 'mlx5ehdr'
      as redundant to allow send small packets as minimal allowed MTU.
      
      Fixes: d605d668 ("net/mlx5e: Add support for ethtool self diagnostics test")
      Signed-off-by: NValentine Fatiev <valentinef@mellanox.com>
      Reviewed-by: NEran Ben Elisha <eranbe@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb3255de
    • O
      net/mlx5e: Always use the match level enum when parsing TC rule match · 52ae8d6c
      Or Gerlitz 提交于
      [ Upstream commit 83621b7df6a646e550fd3d36db2e301cf9a5096b ]
      
      We get the match level (none, l2, l3, l4) while going over the match
      dissectors of an offloaded tc rule. When doing this, the match level
      enum and the not min inline enum values should be used, fix that.
      
      This worked accidentally b/c both enums have the same numerical values.
      
      Fixes: d708f902 ('net/mlx5e: Get the required HW match level while parsing TC flow matches')
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: NRoi Dayan <roid@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      52ae8d6c
    • X
      Revert "sctp: remove sctp_transport_pmtu_check" · 00497302
      Xin Long 提交于
      [ Upstream commit 69fec325a64383667b8a35df5d48d6ce52fb2782 ]
      
      This reverts commit 22d7be26.
      
      The dst's mtu in transport can be updated by a non sctp place like
      in xfrm where the MTU information didn't get synced between asoc,
      transport and dst, so it is still needed to do the pmtu check
      in sctp_packet_config.
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      00497302
    • M
      net/mlx5e: RX, verify received packet size in Linear Striding RQ · 5fa9f2bd
      Moshe Shemesh 提交于
      [ Upstream commit 0073c8f72736b423aade8a817587a5f3e4df4ad8 ]
      
      In case of striding RQ, we use  MPWRQ (Multi Packet WQE RQ), which means
      that WQE (RX descriptor) can be used for many packets and so the WQE is
      much bigger than MTU.  In virtualization setups where the port mtu can
      be larger than the vf mtu, if received packet is bigger than MTU, it
      won't be dropped by HW on too small receive WQE. If we use linear SKB in
      striding RQ, since each stride has room for mtu size payload and skb
      info, an oversized packet can lead to crash for crossing allocated page
      boundary upon the call to build_skb. So driver needs to check packet
      size and drop it.
      
      Introduce new SW rx counter, rx_oversize_pkts_sw_drop, which counts the
      number of packets dropped by the driver for being too large.
      
      As a new field is added to the RQ struct, re-open the channels whenever
      this field is being used in datapath (i.e., in the case of linear
      Striding RQ).
      
      Fixes: 619a8f2a ("net/mlx5e: Use linear SKB in Striding RQ")
      Signed-off-by: NMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5fa9f2bd
    • Y
      net/mlx5e: Adjust to max number of channles when re-attaching · 97cc2cc1
      Yuval Avnery 提交于
      [ Upstream commit a1f240f1801721f76bee734c50df2d9529da86e0 ]
      
      When core driver enters deattach/attach flow after pci reset,
      Number of logical CPUs may have changed.
      As a result we need to update the cpu affiliated resource tables.
      	1. indirect rqt list
      	2. eq table
      
      Reproduction (PowerPC):
      	echo 1000 > /sys/kernel/debug/powerpc/eeh_max_freezes
      	ppc64_cpu --smt=on
      	# Restart driver
      	modprobe -r ... ; modprobe ...
      	# Link up
      	ifconfig ...
      	# Only physical CPUs
      	ppc64_cpu --smt=off
      	# Inject PCI errors so PCI will reset - calling the pci error handler
      	echo 0x8000000000000000 > /sys/kernel/debug/powerpc/<PCI BUS>/err_injct_inboundA
      
      Call trace when trying to add non-existing rqs to an indirect rqt:
      	mlx5e_redirect_rqt+0x84/0x260 [mlx5_core] (unreliable)
      	mlx5e_redirect_rqts+0x188/0x190 [mlx5_core]
      	mlx5e_activate_priv_channels+0x488/0x570 [mlx5_core]
      	mlx5e_open_locked+0xbc/0x140 [mlx5_core]
      	mlx5e_open+0x50/0x130 [mlx5_core]
      	mlx5e_nic_enable+0x174/0x1b0 [mlx5_core]
      	mlx5e_attach_netdev+0x154/0x290 [mlx5_core]
      	mlx5e_attach+0x88/0xd0 [mlx5_core]
      	mlx5_attach_device+0x168/0x1e0 [mlx5_core]
      	mlx5_load_one+0x1140/0x1210 [mlx5_core]
      	mlx5_pci_resume+0x6c/0xf0 [mlx5_core]
      
      Create cq will fail when trying to use non-existing EQ.
      
      Fixes: 89d44f0a ("net/mlx5_core: Add pci error handlers to mlx5_core driver")
      Signed-off-by: NYuval Avnery <yuvalav@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97cc2cc1
    • O
      net/mlx5e: Claim TC hw offloads support only under a proper build config · 92a2f39f
      Or Gerlitz 提交于
      [ Upstream commit 077ecd785d90c6cbba08d719faa4be8561aa0a1e ]
      
      Currently, we are only supporting tc hw offloads when the eswitch
      support is compiled in, but we are not gating the adevertizment
      of the NETIF_F_HW_TC feature on this config being set.
      
      Fix it, and while doing that, also avoid dealing with the feature
      on ethtool when the config is not set.
      
      Fixes: e8f887ac ('net/mlx5e: Introduce tc offload support')
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: NRoi Dayan <roid@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      92a2f39f
    • O
      net/mlx5e: Don't match on vlan non-existence if ethertype is wildcarded · 5351b859
      Or Gerlitz 提交于
      [ Upstream commit d3a80bb5a3eac311ddf28387402593977574460d ]
      
      For the "all" ethertype we should not care whether the packet has
      vlans. Besides being wrong, the way we did it caused FW error
      for rules such as:
      
      tc filter add dev eth0 protocol all parent ffff: \
      	prio 1 flower skip_sw action drop
      
      b/c the matching meta-data (outer headers bit in struct mlx5_flow_spec)
      wasn't set. Fix that by matching on vlan non-existence only if we were
      also told to match on the ethertype.
      
      Fixes: cee26487 ('net/mlx5e: Set vlan masks for all offloaded TC rules')
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Reported-by: NSlava Ovsiienko <viacheslavo@mellanox.com>
      Reviewed-by: NJianbo Liu <jianbol@mellanox.com>
      Reviewed-by: NRoi Dayan <roid@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5351b859
    • J
      tipc: fix link re-establish failure · 961842dc
      Jon Maloy 提交于
      [ Upstream commit 7ab412d33b4c7ff3e0148d3db25dd861edd1283d ]
      
      When a link failure is detected locally, the link is reset, the flag
      link->in_session is set to false, and a RESET_MSG with the 'stopping'
      bit set is sent to the peer.
      
      The purpose of this bit is to inform the peer that this endpoint just
      is going down, and that the peer should handle the reception of this
      particular RESET message as a local failure. This forces the peer to
      accept another RESET or ACTIVATE message from this endpoint before it
      can re-establish the link. This again is necessary to ensure that
      link session numbers are properly exchanged before the link comes up
      again.
      
      If a failure is detected locally at the same time at the peer endpoint
      this will do the same, which is also a correct behavior.
      
      However, when receiving such messages, the endpoints will not
      distinguish between 'stopping' RESETs and ordinary ones when it comes
      to updating session numbers. Both endpoints will copy the received
      session number and set their 'in_session' flags to true at the
      reception, while they are still expecting another RESET from the
      peer before they can go ahead and re-establish. This is contradictory,
      since, after applying the validation check referred to below, the
      'in_session' flag will cause rejection of all such messages, and the
      link will never come up again.
      
      We now fix this by not only handling received RESET/STOPPING messages
      as a local failure, but also by omitting to set a new session number
      and the 'in_session' flag in such cases.
      
      Fixes: 7ea817f4 ("tipc: check session number before accepting link protocol messages")
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      961842dc
    • J
      net: sched: cls_flower: validate nested enc_opts_policy to avoid warning · ed25a206
      Jakub Kicinski 提交于
      [ Upstream commit 63c82997f5c0f3e1b914af43d82f712a86bc5f3a ]
      
      TCA_FLOWER_KEY_ENC_OPTS and TCA_FLOWER_KEY_ENC_OPTS_MASK can only
      currently contain further nested attributes, which are parsed by
      hand, so the policy is never actually used resulting in a W=1
      build warning:
      
      net/sched/cls_flower.c:492:1: warning: ‘enc_opts_policy’ defined but not used [-Wunused-const-variable=]
       enc_opts_policy[TCA_FLOWER_KEY_ENC_OPTS_MAX + 1] = {
      
      Add the validation anyway to avoid potential bugs when other
      attributes are added and to make the attribute structure slightly
      more clear.  Validation will also set extact to point to bad
      attribute on error.
      
      Fixes: 0a6e7778 ("net/sched: allow flower to match tunnel options")
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Acked-by: NSimon Horman <simon.horman@netronome.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed25a206
    • D
      net/sched: act_pedit: fix memory leak when IDR allocation fails · ae06e2f9
      Davide Caratti 提交于
      [ Upstream commit 19ab69107d3ecfb7cd3e38ad262a881be40c01a3 ]
      
      tcf_idr_check_alloc() can return a negative value, on allocation failures
      (-ENOMEM) or IDR exhaustion (-ENOSPC): don't leak keys_ex in these cases.
      
      Fixes: 0190c1d4 ("net: sched: atomically check-allocate action")
      Signed-off-by: NDavide Caratti <dcaratti@redhat.com>
      Acked-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae06e2f9
    • F
      net: systemport: Protect stop from timeout · 3d6679c8
      Florian Fainelli 提交于
      [ Upstream commit 7cb6a2a2c72c1ed8f42fb01f1a661281b568dead ]
      
      A timing hazard exists when the network interface is stopped that
      allows a watchdog timeout to be processed by a separate core in
      parallel. This creates the potential for the timeout handler to
      wake the queues while the driver is shutting down, or access
      registers after their clocks have been removed.
      
      The more common case is that the watchdog timeout will produce a
      warning message which doesn't lead to a crash. The chances of this
      are greatly increased by the fact that bcm_sysport_netif_stop stops
      the transmit queues which can easily precipitate a watchdog time-
      out because of stale trans_start data in the queues.
      
      This commit corrects the behavior by ensuring that the watchdog
      timeout is disabled before enterring bcm_sysport_netif_stop. There
      are currently only two users of the bcm_sysport_netif_stop function:
      close and suspend.
      
      The close case already handles the issue by exiting the RUNNING
      state before invoking the driver close service.
      
      The suspend case now performs the netif_device_detach to exit the
      PRESENT state before the call to bcm_sysport_netif_stop rather than
      after it.
      
      These behaviors prevent any future scheduling of the driver timeout
      service during the window. The netif_tx_stop_all_queues function
      in bcm_sysport_netif_stop is replaced with netif_tx_disable to ensure
      synchronization with any transmit or timeout threads that may
      already be executing on other cores.
      
      For symmetry, the netif_device_attach call upon resume is moved to
      after the call to bcm_sysport_netif_start. Since it wakes the transmit
      queues it is not necessary to invoke netif_tx_start_all_queues from
      bcm_sysport_netif_start so it is moved into the driver open service.
      
      Fixes: 40755a0f ("net: systemport: add suspend and resume support")
      Fixes: 80105bef ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d6679c8
    • M
      tuntap: fix multiqueue rx · 3e8f5d55
      Matthew Cover 提交于
      [ Upstream commit 8ebebcba559a1bfbaec7bbda64feb9870b9c58da ]
      
      When writing packets to a descriptor associated with a combined queue, the
      packets should end up on that queue.
      
      Before this change all packets written to any descriptor associated with a
      tap interface end up on rx-0, even when the descriptor is associated with a
      different queue.
      
      The rx traffic can be generated by either of the following.
        1. a simple tap program which spins up multiple queues and writes packets
           to each of the file descriptors
        2. tx from a qemu vm with a tap multiqueue netdev
      
      The queue for rx traffic can be observed by either of the following (done
      on the hypervisor in the qemu case).
        1. a simple netmap program which opens and reads from per-queue
           descriptors
        2. configuring RPS and doing per-cpu captures with rxtxcpu
      
      Alternatively, if you printk() the return value of skb_get_rx_queue() just
      before each instance of netif_receive_skb() in tun.c, you will get 65535
      for every skb.
      
      Calling skb_record_rx_queue() to set the rx queue to the queue_index fixes
      the association between descriptor and rx queue.
      Signed-off-by: NMatthew Cover <matthew.cover@stackpath.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e8f5d55
    • J
      tipc: fix lockdep warning when reinitilaizing sockets · ce209966
      Jon Maloy 提交于
      [ Upstream commit adba75be0d23cca92a028749d92c60c8909bbdb3 ]
      
      We get the following warning:
      
      [   47.926140] 32-bit node address hash set to 2010a0a
      [   47.927202]
      [   47.927433] ================================
      [   47.928050] WARNING: inconsistent lock state
      [   47.928661] 4.19.0+ #37 Tainted: G            E
      [   47.929346] --------------------------------
      [   47.929954] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
      [   47.930116] swapper/3/0 [HC0[0]:SC1[3]:HE1:SE0] takes:
      [   47.930116] 00000000af8bc31e (&(&ht->lock)->rlock){+.?.}, at: rhashtable_walk_enter+0x36/0xb0
      [   47.930116] {SOFTIRQ-ON-W} state was registered at:
      [   47.930116]   _raw_spin_lock+0x29/0x60
      [   47.930116]   rht_deferred_worker+0x556/0x810
      [   47.930116]   process_one_work+0x1f5/0x540
      [   47.930116]   worker_thread+0x64/0x3e0
      [   47.930116]   kthread+0x112/0x150
      [   47.930116]   ret_from_fork+0x3a/0x50
      [   47.930116] irq event stamp: 14044
      [   47.930116] hardirqs last  enabled at (14044): [<ffffffff9a07fbba>] __local_bh_enable_ip+0x7a/0xf0
      [   47.938117] hardirqs last disabled at (14043): [<ffffffff9a07fb81>] __local_bh_enable_ip+0x41/0xf0
      [   47.938117] softirqs last  enabled at (14028): [<ffffffff9a0803ee>] irq_enter+0x5e/0x60
      [   47.938117] softirqs last disabled at (14029): [<ffffffff9a0804a5>] irq_exit+0xb5/0xc0
      [   47.938117]
      [   47.938117] other info that might help us debug this:
      [   47.938117]  Possible unsafe locking scenario:
      [   47.938117]
      [   47.938117]        CPU0
      [   47.938117]        ----
      [   47.938117]   lock(&(&ht->lock)->rlock);
      [   47.938117]   <Interrupt>
      [   47.938117]     lock(&(&ht->lock)->rlock);
      [   47.938117]
      [   47.938117]  *** DEADLOCK ***
      [   47.938117]
      [   47.938117] 2 locks held by swapper/3/0:
      [   47.938117]  #0: 0000000062c64f90 ((&d->timer)){+.-.}, at: call_timer_fn+0x5/0x280
      [   47.938117]  #1: 00000000ee39619c (&(&d->lock)->rlock){+.-.}, at: tipc_disc_timeout+0xc8/0x540 [tipc]
      [   47.938117]
      [   47.938117] stack backtrace:
      [   47.938117] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G            E     4.19.0+ #37
      [   47.938117] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [   47.938117] Call Trace:
      [   47.938117]  <IRQ>
      [   47.938117]  dump_stack+0x5e/0x8b
      [   47.938117]  print_usage_bug+0x1ed/0x1ff
      [   47.938117]  mark_lock+0x5b5/0x630
      [   47.938117]  __lock_acquire+0x4c0/0x18f0
      [   47.938117]  ? lock_acquire+0xa6/0x180
      [   47.938117]  lock_acquire+0xa6/0x180
      [   47.938117]  ? rhashtable_walk_enter+0x36/0xb0
      [   47.938117]  _raw_spin_lock+0x29/0x60
      [   47.938117]  ? rhashtable_walk_enter+0x36/0xb0
      [   47.938117]  rhashtable_walk_enter+0x36/0xb0
      [   47.938117]  tipc_sk_reinit+0xb0/0x410 [tipc]
      [   47.938117]  ? mark_held_locks+0x6f/0x90
      [   47.938117]  ? __local_bh_enable_ip+0x7a/0xf0
      [   47.938117]  ? lockdep_hardirqs_on+0x20/0x1a0
      [   47.938117]  tipc_net_finalize+0xbf/0x180 [tipc]
      [   47.938117]  tipc_disc_timeout+0x509/0x540 [tipc]
      [   47.938117]  ? call_timer_fn+0x5/0x280
      [   47.938117]  ? tipc_disc_msg_xmit.isra.19+0xa0/0xa0 [tipc]
      [   47.938117]  ? tipc_disc_msg_xmit.isra.19+0xa0/0xa0 [tipc]
      [   47.938117]  call_timer_fn+0xa1/0x280
      [   47.938117]  ? tipc_disc_msg_xmit.isra.19+0xa0/0xa0 [tipc]
      [   47.938117]  run_timer_softirq+0x1f2/0x4d0
      [   47.938117]  __do_softirq+0xfc/0x413
      [   47.938117]  irq_exit+0xb5/0xc0
      [   47.938117]  smp_apic_timer_interrupt+0xac/0x210
      [   47.938117]  apic_timer_interrupt+0xf/0x20
      [   47.938117]  </IRQ>
      [   47.938117] RIP: 0010:default_idle+0x1c/0x140
      [   47.938117] Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 41 54 55 53 65 8b 2d d8 2b 74 65 0f 1f 44 00 00 e8 c6 2c 8b ff fb f4 <65> 8b 2d c5 2b 74 65 0f 1f 44 00 00 5b 5d 41 5c c3 65 8b 05 b4 2b
      [   47.938117] RSP: 0018:ffffaf6ac0207ec8 EFLAGS: 00000206 ORIG_RAX: ffffffffffffff13
      [   47.938117] RAX: ffff8f5b3735e200 RBX: 0000000000000003 RCX: 0000000000000001
      [   47.938117] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff8f5b3735e200
      [   47.938117] RBP: 0000000000000003 R08: 0000000000000001 R09: 0000000000000000
      [   47.938117] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
      [   47.938117] R13: 0000000000000000 R14: ffff8f5b3735e200 R15: ffff8f5b3735e200
      [   47.938117]  ? default_idle+0x1a/0x140
      [   47.938117]  do_idle+0x1bc/0x280
      [   47.938117]  cpu_startup_entry+0x19/0x20
      [   47.938117]  start_secondary+0x187/0x1c0
      [   47.938117]  secondary_startup_64+0xa4/0xb0
      
      The reason seems to be that tipc_net_finalize()->tipc_sk_reinit() is
      calling the function rhashtable_walk_enter() within a timer interrupt.
      We fix this by executing tipc_net_finalize() in work queue context.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ce209966
    • J
      tipc: don't assume linear buffer when reading ancillary data · aaf13772
      Jon Maloy 提交于
      [ Upstream commit 1c1274a56999fbdf9cf84e332b28448bb2d55221 ]
      
      The code for reading ancillary data from a received buffer is assuming
      the buffer is linear. To make this assumption true we have to linearize
      the buffer before message data is read.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aaf13772