1. 17 Apr, 2020 24 commits
  2. 13 Apr, 2020 16 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.19.115 · 6dd0e326
      Greg Kroah-Hartman authored
      6dd0e326
    • Rob Clark's avatar
      drm/msm: Use the correct dma_sync calls in msm_gem · 39718d08
      Rob Clark authored
      commit 3de433c5 upstream.
      
      [subject was: drm/msm: shake fist angrily at dma-mapping]
      
      So, using dma_sync_* for our cache needs works out w/ dma iommu ops, but
      it falls appart with dma direct ops.  The problem is that, depending on
      display generation, we can have either set of dma ops (mdp4 and dpu have
      iommu wired to mdss node, which maps to toplevel drm device, but mdp5
      has iommu wired up to the mdp sub-node within mdss).
      
      Fixes this splat on mdp5 devices:
      
         Unable to handle kernel paging request at virtual address ffffffff80000000
         Mem abort info:
           ESR = 0x96000144
           Exception class = DABT (current EL), IL = 32 bits
           SET = 0, FnV = 0
           EA = 0, S1PTW = 0
         Data abort info:
           ISV = 0, ISS = 0x00000144
           CM = 1, WnR = 1
         swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000810e4000
         [ffffffff80000000] pgd=0000000000000000
         Internal error: Oops: 96000144 [#1] SMP
         Modules linked in: btqcomsmd btqca bluetooth cfg80211 ecdh_generic ecc rfkill libarc4 panel_simple msm wcnss_ctrl qrtr_smd drm_kms_helper venus_enc venus_dec videobuf2_dma_sg videobuf2_memops drm venus_core ipv6 qrtr qcom_wcnss_pil v4l2_mem2mem qcom_sysmon videobuf2_v4l2 qmi_helpers videobuf2_common crct10dif_ce mdt_loader qcom_common videodev qcom_glink_smem remoteproc bmc150_accel_i2c bmc150_magn_i2c bmc150_accel_core bmc150_magn snd_soc_lpass_apq8016 snd_soc_msm8916_analog mms114 mc nf_defrag_ipv6 snd_soc_lpass_cpu snd_soc_apq8016_sbc industrialio_triggered_buffer kfifo_buf snd_soc_lpass_platform snd_soc_msm8916_digital drm_panel_orientation_quirks
         CPU: 2 PID: 33 Comm: kworker/2:1 Not tainted 5.3.0-rc2 #1
         Hardware name: Samsung Galaxy A5U (EUR) (DT)
         Workqueue: events deferred_probe_work_func
         pstate: 80000005 (Nzcv daif -PAN -UAO)
         pc : __clean_dcache_area_poc+0x20/0x38
         lr : arch_sync_dma_for_device+0x28/0x30
         sp : ffff0000115736a0
         x29: ffff0000115736a0 x28: 0000000000000001
         x27: ffff800074830800 x26: ffff000011478000
         x25: 0000000000000000 x24: 0000000000000001
         x23: ffff000011478a98 x22: ffff800009fd1c10
         x21: 0000000000000001 x20: ffff800075ad0a00
         x19: 0000000000000000 x18: ffff0000112b2000
         x17: 0000000000000000 x16: 0000000000000000
         x15: 00000000fffffff0 x14: ffff000011455d70
         x13: 0000000000000000 x12: 0000000000000028
         x11: 0000000000000001 x10: ffff00001106c000
         x9 : ffff7e0001d6b380 x8 : 0000000000001000
         x7 : ffff7e0001d6b380 x6 : ffff7e0001d6b382
         x5 : 0000000000000000 x4 : 0000000000001000
         x3 : 000000000000003f x2 : 0000000000000040
         x1 : ffffffff80001000 x0 : ffffffff80000000
         Call trace:
          __clean_dcache_area_poc+0x20/0x38
          dma_direct_sync_sg_for_device+0xb8/0xe8
          get_pages+0x22c/0x250 [msm]
          msm_gem_get_and_pin_iova+0xdc/0x168 [msm]
          ...
      
      Fixes the combination of two patches:
      
      Fixes: 0036bc73 (drm/msm: stop abusing dma_map/unmap for cache)
      Fixes: 449fa54d (dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device)
      Tested-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      [seanpaul changed subject to something more desriptive]
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190730214633.17820-1-robdclark@gmail.com
      Cc: nobuhiro1.iwamatsu@toshiba.co.jp
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39718d08
    • Hans Verkuil's avatar
      drm_dp_mst_topology: fix broken drm_dp_sideband_parse_remote_dpcd_read() · 329ef07f
      Hans Verkuil authored
      commit a4c30a48 upstream.
      
      When parsing the reply of a DP_REMOTE_DPCD_READ DPCD command the
      result is wrong due to a missing idx increment.
      
      This was never noticed since DP_REMOTE_DPCD_READ is currently not
      used, but if you enable it, then it is all wrong.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/e72ddac2-1dc0-100a-d816-9ac98ac009dd@xs4all.nlSigned-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      329ef07f
    • Roger Quadros's avatar
      usb: dwc3: don't set gadget->is_otg flag · b0434aae
      Roger Quadros authored
      commit c09b73cf upstream.
      
      This reverts
      commit 6a4290cc ("usb: dwc3: gadget: set the OTG flag in dwc3 gadget driver.")
      
      We don't yet support any of the OTG mechanisms (HNP/SRP/ADP)
      and are not setting gadget->otg_caps, so don't set gadget->is_otg
      flag.
      
      If we do then we end up publishing a OTG1.0 descriptor in
      the gadget descriptor which causes device enumeration to fail
      if we are connected to a host with CONFIG_USB_OTG enabled.
      
      Host side log without this patch
      
      [   96.720453] usb 1-1: new high-speed USB device number 2 using xhci-hcd
      [   96.901391] usb 1-1: Dual-Role OTG device on non-HNP port
      [   96.907552] usb 1-1: set a_alt_hnp_support failed: -32
      [   97.060447] usb 1-1: new high-speed USB device number 3 using xhci-hcd
      [   97.241378] usb 1-1: Dual-Role OTG device on non-HNP port
      [   97.247536] usb 1-1: set a_alt_hnp_support failed: -32
      [   97.253606] usb usb1-port1: attempt power cycle
      [   97.960449] usb 1-1: new high-speed USB device number 4 using xhci-hcd
      [   98.141383] usb 1-1: Dual-Role OTG device on non-HNP port
      [   98.147540] usb 1-1: set a_alt_hnp_support failed: -32
      [   98.300453] usb 1-1: new high-speed USB device number 5 using xhci-hcd
      [   98.481391] usb 1-1: Dual-Role OTG device on non-HNP port
      [   98.487545] usb 1-1: set a_alt_hnp_support failed: -32
      [   98.493532] usb usb1-port1: unable to enumerate USB device
      Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0434aae
    • Chris Lew's avatar
      rpmsg: glink: Remove chunk size word align warning · 7abfe991
      Chris Lew authored
      commit f0beb4ba upstream.
      
      It is possible for the chunk sizes coming from the non RPM remote procs
      to not be word aligned. Remove the alignment warning and continue to
      read from the FIFO so execution is not stalled.
      Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
      Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
      Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7abfe991
    • Arun KS's avatar
      arm64: Fix size of __early_cpu_boot_status · 31f7497c
      Arun KS authored
      commit 61cf61d8 upstream.
      
      __early_cpu_boot_status is of type long. Use quad
      assembler directive to allocate proper size.
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarArun KS <arunks@codeaurora.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31f7497c
    • Rob Clark's avatar
      drm/msm: stop abusing dma_map/unmap for cache · 9c23e008
      Rob Clark authored
      commit 0036bc73 upstream.
      
      Recently splats like this started showing up:
      
         WARNING: CPU: 4 PID: 251 at drivers/iommu/dma-iommu.c:451 __iommu_dma_unmap+0xb8/0xc0
         Modules linked in: ath10k_snoc ath10k_core fuse msm ath mac80211 uvcvideo cfg80211 videobuf2_vmalloc videobuf2_memops vide
         CPU: 4 PID: 251 Comm: kworker/u16:4 Tainted: G        W         5.2.0-rc5-next-20190619+ #2317
         Hardware name: LENOVO 81JL/LNVNB161216, BIOS 9UCN23WW(V1.06) 10/25/2018
         Workqueue: msm msm_gem_free_work [msm]
         pstate: 80c00005 (Nzcv daif +PAN +UAO)
         pc : __iommu_dma_unmap+0xb8/0xc0
         lr : __iommu_dma_unmap+0x54/0xc0
         sp : ffff0000119abce0
         x29: ffff0000119abce0 x28: 0000000000000000
         x27: ffff8001f9946648 x26: ffff8001ec271068
         x25: 0000000000000000 x24: ffff8001ea3580a8
         x23: ffff8001f95ba010 x22: ffff80018e83ba88
         x21: ffff8001e548f000 x20: fffffffffffff000
         x19: 0000000000001000 x18: 00000000c00001fe
         x17: 0000000000000000 x16: 0000000000000000
         x15: ffff000015b70068 x14: 0000000000000005
         x13: 0003142cc1be1768 x12: 0000000000000001
         x11: ffff8001f6de9100 x10: 0000000000000009
         x9 : ffff000015b78000 x8 : 0000000000000000
         x7 : 0000000000000001 x6 : fffffffffffff000
         x5 : 0000000000000fff x4 : ffff00001065dbc8
         x3 : 000000000000000d x2 : 0000000000001000
         x1 : fffffffffffff000 x0 : 0000000000000000
         Call trace:
          __iommu_dma_unmap+0xb8/0xc0
          iommu_dma_unmap_sg+0x98/0xb8
          put_pages+0x5c/0xf0 [msm]
          msm_gem_free_work+0x10c/0x150 [msm]
          process_one_work+0x1e0/0x330
          worker_thread+0x40/0x438
          kthread+0x12c/0x130
          ret_from_fork+0x10/0x18
         ---[ end trace afc0dc5ab81a06bf ]---
      
      Not quite sure what triggered that, but we really shouldn't be abusing
      dma_{map,unmap}_sg() for cache maint.
      
      Cc: Stephen Boyd <sboyd@kernel.org>
      Tested-by: default avatarStephen Boyd <swboyd@chromium.org>
      Reviewed-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190630124735.27786-1-robdclark@gmail.comSigned-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c23e008
    • Taniya Das's avatar
      clk: qcom: rcg: Return failure for RCG update · aa586e25
      Taniya Das authored
      commit 21ea4b62 upstream.
      
      In case of update config failure, return -EBUSY, so that consumers could
      handle the failure gracefully.
      Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
      Link: https://lkml.kernel.org/r/1557339895-21952-2-git-send-email-tdas@codeaurora.orgSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa586e25
    • Qiujun Huang's avatar
      fbcon: fix null-ptr-deref in fbcon_switch · e9944eb6
      Qiujun Huang authored
      commit b139f8b0 upstream.
      
      Set logo_shown to FBCON_LOGO_CANSHOW when the vc was deallocated.
      
      syzkaller report: https://lkml.org/lkml/2020/3/27/403
      general protection fault, probably for non-canonical address
      0xdffffc000000006c: 0000 [#1] SMP KASAN
      KASAN: null-ptr-deref in range [0x0000000000000360-0x0000000000000367]
      RIP: 0010:fbcon_switch+0x28f/0x1740
      drivers/video/fbdev/core/fbcon.c:2260
      
      Call Trace:
      redraw_screen+0x2a8/0x770 drivers/tty/vt/vt.c:1008
      vc_do_resize+0xfe7/0x1360 drivers/tty/vt/vt.c:1295
      fbcon_init+0x1221/0x1ab0 drivers/video/fbdev/core/fbcon.c:1219
      visual_init+0x305/0x5c0 drivers/tty/vt/vt.c:1062
      do_bind_con_driver+0x536/0x890 drivers/tty/vt/vt.c:3542
      do_take_over_console+0x453/0x5b0 drivers/tty/vt/vt.c:4122
      do_fbcon_takeover+0x10b/0x210 drivers/video/fbdev/core/fbcon.c:588
      fbcon_fb_registered+0x26b/0x340 drivers/video/fbdev/core/fbcon.c:3259
      do_register_framebuffer drivers/video/fbdev/core/fbmem.c:1664 [inline]
      register_framebuffer+0x56e/0x980 drivers/video/fbdev/core/fbmem.c:1832
      dlfb_usb_probe.cold+0x1743/0x1ba3 drivers/video/fbdev/udlfb.c:1735
      usb_probe_interface+0x310/0x800 drivers/usb/core/driver.c:374
      
      accessing vc_cons[logo_shown].d->vc_top causes the bug.
      
      Reported-by: syzbot+732528bae351682f1f27@syzkaller.appspotmail.com
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200329085647.25133-1-hqjagain@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9944eb6
    • Avihai Horon's avatar
      RDMA/cm: Update num_paths in cma_resolve_iboe_route error flow · e2db80e0
      Avihai Horon authored
      commit 987914ab upstream.
      
      After a successful allocation of path_rec, num_paths is set to 1, but any
      error after such allocation will leave num_paths uncleared.
      
      This causes to de-referencing a NULL pointer later on. Hence, num_paths
      needs to be set back to 0 if such an error occurs.
      
      The following crash from syzkaller revealed it.
      
        kasan: CONFIG_KASAN_INLINE enabled
        kasan: GPF could be caused by NULL-ptr deref or user memory access
        general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
        CPU: 0 PID: 357 Comm: syz-executor060 Not tainted 4.18.0+ #311
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
        rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014
        RIP: 0010:ib_copy_path_rec_to_user+0x94/0x3e0
        Code: f1 f1 f1 f1 c7 40 0c 00 00 f4 f4 65 48 8b 04 25 28 00 00 00 48 89
        45 c8 31 c0 e8 d7 60 24 ff 48 8d 7b 4c 48 89 f8 48 c1 e8 03 <42> 0f b6
        14 30 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85
        RSP: 0018:ffff88006586f980 EFLAGS: 00010207
        RAX: 0000000000000009 RBX: 0000000000000000 RCX: 1ffff1000d5fe475
        RDX: ffff8800621e17c0 RSI: ffffffff820d45f9 RDI: 000000000000004c
        RBP: ffff88006586fa50 R08: ffffed000cb0df73 R09: ffffed000cb0df72
        R10: ffff88006586fa70 R11: ffffed000cb0df73 R12: 1ffff1000cb0df30
        R13: ffff88006586fae8 R14: dffffc0000000000 R15: ffff88006aff2200
        FS: 00000000016fc880(0000) GS:ffff88006d000000(0000)
        knlGS:0000000000000000
        CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000020000040 CR3: 0000000063fec000 CR4: 00000000000006b0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
        ? ib_copy_path_rec_from_user+0xcc0/0xcc0
        ? __mutex_unlock_slowpath+0xfc/0x670
        ? wait_for_completion+0x3b0/0x3b0
        ? ucma_query_route+0x818/0xc60
        ucma_query_route+0x818/0xc60
        ? ucma_listen+0x1b0/0x1b0
        ? sched_clock_cpu+0x18/0x1d0
        ? sched_clock_cpu+0x18/0x1d0
        ? ucma_listen+0x1b0/0x1b0
        ? ucma_write+0x292/0x460
        ucma_write+0x292/0x460
        ? ucma_close_id+0x60/0x60
        ? sched_clock_cpu+0x18/0x1d0
        ? sched_clock_cpu+0x18/0x1d0
        __vfs_write+0xf7/0x620
        ? ucma_close_id+0x60/0x60
        ? kernel_read+0x110/0x110
        ? time_hardirqs_on+0x19/0x580
        ? lock_acquire+0x18b/0x3a0
        ? finish_task_switch+0xf3/0x5d0
        ? _raw_spin_unlock_irq+0x29/0x40
        ? _raw_spin_unlock_irq+0x29/0x40
        ? finish_task_switch+0x1be/0x5d0
        ? __switch_to_asm+0x34/0x70
        ? __switch_to_asm+0x40/0x70
        ? security_file_permission+0x172/0x1e0
        vfs_write+0x192/0x460
        ksys_write+0xc6/0x1a0
        ? __ia32_sys_read+0xb0/0xb0
        ? entry_SYSCALL_64_after_hwframe+0x3e/0xbe
        ? do_syscall_64+0x1d/0x470
        do_syscall_64+0x9e/0x470
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: 3c86aa70 ("RDMA/cm: Add RDMA CM support for IBoE devices")
      Link: https://lore.kernel.org/r/20200318101741.47211-1-leon@kernel.orgSigned-off-by: default avatarAvihai Horon <avihaih@mellanox.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2db80e0
    • Qiujun Huang's avatar
      Bluetooth: RFCOMM: fix ODEBUG bug in rfcomm_dev_ioctl · 78a4ad28
      Qiujun Huang authored
      commit 71811cac upstream.
      
      Needn't call 'rfcomm_dlc_put' here, because 'rfcomm_dlc_exists' didn't
      increase dlc->refcnt.
      
      Reported-by: syzbot+4496e82090657320efc6@syzkaller.appspotmail.com
      Signed-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
      Suggested-by: default avatarHillf Danton <hdanton@sina.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      78a4ad28
    • Jason Gunthorpe's avatar
      RDMA/cma: Teach lockdep about the order of rtnl and lock · ee433d1c
      Jason Gunthorpe authored
      commit 32ac9e43 upstream.
      
      This lock ordering only happens when bonding is enabled and a certain
      bonding related event fires. However, since it can happen this is a global
      restriction on lock ordering.
      
      Teach lockdep about the order directly and unconditionally so bugs here
      are found quickly.
      
      See https://syzkaller.appspot.com/bug?extid=55de90ab5f44172b0c90
      
      Link: https://lore.kernel.org/r/20200227203651.GA27185@ziepe.caSigned-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee433d1c
    • Jason Gunthorpe's avatar
      RDMA/ucma: Put a lock around every call to the rdma_cm layer · abc4ea7f
      Jason Gunthorpe authored
      commit 7c119107 upstream.
      
      The rdma_cm must be used single threaded.
      
      This appears to be a bug in the design, as it does have lots of locking
      that seems like it should allow concurrency. However, when it is all said
      and done every single place that uses the cma_exch() scheme is broken, and
      all the unlocked reads from the ucma of the cm_id data are wrong too.
      
      syzkaller has been finding endless bugs related to this.
      
      Fixing this in any elegant way is some enormous amount of work. Take a
      very big hammer and put a mutex around everything to do with the
      ucma_context at the top of every syscall.
      
      Fixes: 75216638 ("RDMA/cma: Export rdma cm interface to userspace")
      Link: https://lore.kernel.org/r/20200218210432.GA31966@ziepe.ca
      Reported-by: syzbot+adb15cf8c2798e4e0db4@syzkaller.appspotmail.com
      Reported-by: syzbot+e5579222b6a3edd96522@syzkaller.appspotmail.com
      Reported-by: syzbot+4b628fcc748474003457@syzkaller.appspotmail.com
      Reported-by: syzbot+29ee8f76017ce6cf03da@syzkaller.appspotmail.com
      Reported-by: syzbot+6956235342b7317ec564@syzkaller.appspotmail.com
      Reported-by: syzbot+b358909d8d01556b790b@syzkaller.appspotmail.com
      Reported-by: syzbot+6b46b135602a3f3ac99e@syzkaller.appspotmail.com
      Reported-by: syzbot+8458d13b13562abf6b77@syzkaller.appspotmail.com
      Reported-by: syzbot+bd034f3fdc0402e942ed@syzkaller.appspotmail.com
      Reported-by: syzbot+c92378b32760a4eef756@syzkaller.appspotmail.com
      Reported-by: syzbot+68b44a1597636e0b342c@syzkaller.appspotmail.com
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      abc4ea7f
    • Ilya Dryomov's avatar
      ceph: canonicalize server path in place · 4eeddc62
      Ilya Dryomov authored
      commit b27a939e upstream.
      
      syzbot reported that 4fbc0c71 ("ceph: remove the extra slashes in
      the server path") had caused a regression where an allocation could be
      done under a spinlock -- compare_mount_options() is called by sget_fc()
      with sb_lock held.
      
      We don't really need the supplied server path, so canonicalize it
      in place and compare it directly.  To make this work, the leading
      slash is kept around and the logic in ceph_real_mount() to skip it
      is restored.  CEPH_MSG_CLIENT_SESSION now reports the same (i.e.
      canonicalized) path, with the leading slash of course.
      
      Fixes: 4fbc0c71 ("ceph: remove the extra slashes in the server path")
      Reported-by: syzbot+98704a51af8e3d9425a9@syzkaller.appspotmail.com
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarLuis Henriques <lhenriques@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4eeddc62
    • Xiubo Li's avatar
      ceph: remove the extra slashes in the server path · 42034365
      Xiubo Li authored
      commit 4fbc0c71 upstream.
      
      It's possible to pass the mount helper a server path that has more
      than one contiguous slash character. For example:
      
        $ mount -t ceph 192.168.195.165:40176:/// /mnt/cephfs/
      
      In the MDS server side the extra slashes of the server path will be
      treated as snap dir, and then we can get the following debug logs:
      
        ceph:  mount opening path //
        ceph:  open_root_inode opening '//'
        ceph:  fill_trace 0000000059b8a3bc is_dentry 0 is_target 1
        ceph:  alloc_inode 00000000dc4ca00b
        ceph:  get_inode created new inode 00000000dc4ca00b 1.ffffffffffffffff ino 1
        ceph:  get_inode on 1=1.ffffffffffffffff got 00000000dc4ca00b
      
      And then when creating any new file or directory under the mount
      point, we can hit the following BUG_ON in ceph_fill_trace():
      
        BUG_ON(ceph_snap(dir) != dvino.snap);
      
      Have the client ignore the extra slashes in the server path when
      mounting. This will also canonicalize the path, so that identical mounts
      can be consilidated.
      
      1) "//mydir1///mydir//"
      2) "/mydir1/mydir"
      3) "/mydir1/mydir/"
      
      Regardless of the internal treatment of these paths, the kernel still
      stores the original string including the leading '/' for presentation
      to userland.
      
      URL: https://tracker.ceph.com/issues/42771Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarLuis Henriques <lhenriques@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42034365
    • Kaike Wan's avatar
      IB/hfi1: Fix memory leaks in sysfs registration and unregistration · d0346003
      Kaike Wan authored
      commit 5c15abc4 upstream.
      
      When the hfi1 driver is unloaded, kmemleak will report the following
      issue:
      
      unreferenced object 0xffff8888461a4c08 (size 8):
      comm "kworker/0:0", pid 5, jiffies 4298601264 (age 2047.134s)
      hex dump (first 8 bytes):
      73 64 6d 61 30 00 ff ff sdma0...
      backtrace:
      [<00000000311a6ef5>] kvasprintf+0x62/0xd0
      [<00000000ade94d9f>] kobject_set_name_vargs+0x1c/0x90
      [<0000000060657dbb>] kobject_init_and_add+0x5d/0xb0
      [<00000000346fe72b>] 0xffffffffa0c5ecba
      [<000000006cfc5819>] 0xffffffffa0c866b9
      [<0000000031c65580>] 0xffffffffa0c38e87
      [<00000000e9739b3f>] local_pci_probe+0x41/0x80
      [<000000006c69911d>] work_for_cpu_fn+0x16/0x20
      [<00000000601267b5>] process_one_work+0x171/0x380
      [<0000000049a0eefa>] worker_thread+0x1d1/0x3f0
      [<00000000909cf2b9>] kthread+0xf8/0x130
      [<0000000058f5f874>] ret_from_fork+0x35/0x40
      
      This patch fixes the issue by:
      
      - Releasing dd->per_sdma[i].kobject in hfi1_unregister_sysfs().
        - This will fix the memory leak.
      
      - Calling kobject_put() to unwind operations only for those entries in
         dd->per_sdma[] whose operations have succeeded (including the current
         one that has just failed) in hfi1_verbs_register_sysfs().
      
      Cc: <stable@vger.kernel.org>
      Fixes: 0cb2aa69 ("IB/hfi1: Add sysfs interface for affinity setup")
      Link: https://lore.kernel.org/r/20200326163807.21129.27371.stgit@awfm-01.aw.intel.comReviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarKaike Wan <kaike.wan@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0346003