1. 17 Mar, 2020 5 commits
    • Jason Gunthorpe's avatar
      RDMA/cm: Simplify establishing a listen cm_id · 98f67156
      Jason Gunthorpe authored
      Any manipulation of cm_id->state must be done under the cm_id_priv->lock,
      the two routines that added listens did not follow this rule, because they
      never participate in any concurrent access around the state.
      
      However, since this exception makes the code hard to understand, simplify
      the flow so that it can be fully locked:
       - Move manipulation of listen_sharecount into cm_insert_listen() so it is
         trivially under the cm.lock without having to expose the cm.lock to the
         caller.
       - Push the cm.lock down into cm_insert_listen() and have the function
         increment the reference count before returning an existing pointer.
       - Split ib_cm_listen() into an cm_init_listen() and do not call
         ib_cm_listen() from ib_cm_insert_listen()
       - Make both ib_cm_listen() and ib_cm_insert_listen() directly call
         cm_insert_listen() under their cm_id_priv->lock which does both a
         collision detect and, if needed, the insert (atomically)
       - Enclose all state manipulation within the cm_id_priv->lock, notice this
         set can be done safely after cm_insert_listen() as no reader is allowed
         to read the state without holding the lock.
       - Do not set the listen cm_id in the xarray, as it is never correct to
         look it up. This makes the concurrency simpler to understand.
      
      Many needless error unwinds are removed in the process.
      
      Link: https://lore.kernel.org/r/20200310092545.251365-6-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      98f67156
    • Jason Gunthorpe's avatar
      RDMA/cm: Make the destroy_id flow more robust · 2305d686
      Jason Gunthorpe authored
      Too much of the destruction is very carefully sensitive to the state
      and various other things. Move more code to the unconditional path and
      add several WARN_ONs to check consistency.
      
      Link: https://lore.kernel.org/r/20200310092545.251365-5-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      2305d686
    • Jason Gunthorpe's avatar
      RDMA/cm: Remove a race freeing timewait_info · bede86a3
      Jason Gunthorpe authored
      When creating a cm_id during REQ the id immediately becomes visible to the
      other MAD handlers, and shortly after the state is moved to IB_CM_REQ_RCVD
      
      This allows cm_rej_handler() to run concurrently and free the work:
      
              CPU 0                                CPU1
       cm_req_handler()
        ib_create_cm_id()
        cm_match_req()
          id_priv->state = IB_CM_REQ_RCVD
                                             cm_rej_handler()
                                               cm_acquire_id()
                                               spin_lock(&id_priv->lock)
                                               switch (id_priv->state)
        					   case IB_CM_REQ_RCVD:
                                                  cm_reset_to_idle()
                                                   kfree(id_priv->timewait_info);
         goto destroy
        destroy:
          kfree(id_priv->timewait_info);
                                                   id_priv->timewait_info = NULL
      
      Causing a double free or worse.
      
      Do not free the timewait_info without also holding the
      id_priv->lock. Simplify this entire flow by making the free unconditional
      during cm_destroy_id() and removing the confusing special case error
      unwind during creation of the timewait_info.
      
      This also fixes a leak of the timewait if cm_destroy_id() is called in
      IB_CM_ESTABLISHED with an XRC TGT QP. The state machine will be left in
      ESTABLISHED while it needed to transition through IB_CM_TIMEWAIT to
      release the timewait pointer.
      
      Also fix a leak of the timewait_info if the caller mis-uses the API and
      does ib_send_cm_reqs().
      
      Fixes: a977049d ("[PATCH] IB: Add the kernel CM implementation")
      Link: https://lore.kernel.org/r/20200310092545.251365-4-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      bede86a3
    • Jason Gunthorpe's avatar
      RDMA/cm: Fix checking for allowed duplicate listens · ca21cb7f
      Jason Gunthorpe authored
      The test here typod the cm_id_priv to use, it used the one that was
      freshly allocated. By definition the allocated one has the matching
      cm_handler and zero context, so the condition was always true.
      
      Instead check that the existing listening ID is compatible with the
      proposed handler so that it can be shared, as was originally intended.
      
      Fixes: 067b171b ("IB/cm: Share listening CM IDs")
      Link: https://lore.kernel.org/r/20200310092545.251365-3-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      ca21cb7f
    • Jason Gunthorpe's avatar
      RDMA/cm: Fix ordering of xa_alloc_cyclic() in ib_create_cm_id() · e8dc4e88
      Jason Gunthorpe authored
      xa_alloc_cyclic() is a SMP release to be paired with some later acquire
      during xa_load() as part of cm_acquire_id().
      
      As such, xa_alloc_cyclic() must be done after the cm_id is fully
      initialized, in particular, it absolutely must be after the
      refcount_set(), otherwise the refcount_inc() in cm_acquire_id() may not
      see the set.
      
      As there are several cases where a reader will be able to use the
      id.local_id after cm_acquire_id in the IB_CM_IDLE state there needs to be
      an unfortunate split into a NULL allocate and a finalizing xa_store.
      
      Fixes: a977049d ("[PATCH] IB: Add the kernel CM implementation")
      Link: https://lore.kernel.org/r/20200310092545.251365-2-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      e8dc4e88
  2. 13 Mar, 2020 17 commits
  3. 10 Mar, 2020 9 commits
  4. 09 Mar, 2020 3 commits
    • Linus Torvalds's avatar
      Linux 5.6-rc5 · 2c523b34
      Linus Torvalds authored
      2c523b34
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 62790268
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "We've been accruing these for a couple of weeks, so the batch is a bit
        bigger than usual.
      
        Largest delta is due to a led-bl driver that is added -- there was a
        miscommunication before the merge window and the driver didn't make it
        in. Due to this, the platforms needing it regressed. At this point, it
        seemed easier to add the new driver than unwind the changes.
      
        Besides that, there are a handful of various fixes:
      
         - AMD tee memory leak fix
      
         - A handful of fixlets for i.MX SCU communication
      
         - A few maintainers woke up and realized DEBUG_FS had been missing
           for a while, so a few updates of that.
      
        ... and the usual collection of smaller fixes to various platforms"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (37 commits)
        ARM: socfpga_defconfig: Add back DEBUG_FS
        arm64: dts: socfpga: agilex: Fix gmac compatible
        ARM: bcm2835_defconfig: Explicitly restore CONFIG_DEBUG_FS
        arm64: dts: meson: fix gxm-khadas-vim2 wifi
        arm64: dts: meson-sm1-sei610: add missing interrupt-names
        ARM: meson: Drop unneeded select of COMMON_CLK
        ARM: dts: bcm2711: Add pcie0 alias
        ARM: dts: bcm283x: Add missing properties to the PWR LED
        tee: amdtee: fix memory leak in amdtee_open_session()
        ARM: OMAP2+: Fix compile if CONFIG_HAVE_ARM_SMCCC is not set
        arm: dts: dra76x: Fix mmc3 max-frequency
        ARM: dts: dra7: Add "dma-ranges" property to PCIe RC DT nodes
        bus: ti-sysc: Fix 1-wire reset quirk
        ARM: dts: r8a7779: Remove deprecated "renesas, rcar-sata" compatible value
        soc: imx-scu: Align imx sc msg structs to 4
        firmware: imx: Align imx_sc_msg_req_cpu_start to 4
        firmware: imx: scu-pd: Align imx sc msg structs to 4
        firmware: imx: misc: Align imx sc msg structs to 4
        firmware: imx: scu: Ensure sequential TX
        ARM: dts: imx7-colibri: Fix frequency for sd/mmc
        ...
      62790268
    • Linus Torvalds's avatar
      Merge tag 'edac_urgent-2020-03-08' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras · efe582a1
      Linus Torvalds authored
      Pull EDAC fix from Borislav Petkov:
       "Error reporting fix for synopsys_edac: do not overwrite partial
        decoded error message (Sherry Sun)"
      
      * tag 'edac_urgent-2020-03-08' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
        EDAC/synopsys: Do not print an error with back-to-back snprintf() calls
      efe582a1
  5. 08 Mar, 2020 5 commits
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 378fee2e
      Linus Torvalds authored
      Pull char/misc fixes from Greg KH:
       "Here are four small char/misc driver fixes for reported issues for
        5.6-rc5.
      
        These fixes are:
      
         - binder fix for a potential use-after-free problem found (took two
           tries to get it right)
      
         - interconnect core fix
      
         - altera-stapl driver fix
      
        All four of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'char-misc-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        binder: prevent UAF for binderfs devices II
        interconnect: Handle memory allocation errors
        altera-stapl: altera_get_note: prevent write beyond end of 'key'
        binder: prevent UAF for binderfs devices
      378fee2e
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · b34e5c13
      Linus Torvalds authored
      Pull driver core and debugfs fixes from Greg KH:
       "Here are four small driver core / debugfs patches for 5.6-rc3:
      
         - debugfs api cleanup now that all debugfs_create_regset32() callers
           have been fixed up. This was waiting until after the -rc1 merge as
           these fixes came in through different trees
      
         - driver core sync state fixes based on reports of minor issues found
           in the feature
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'driver-core-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        driver core: Skip unnecessary work when device doesn't have sync_state()
        driver core: Add dev_has_sync_state()
        driver core: Call sync_state() even if supplier has no consumers
        debugfs: remove return value of debugfs_create_regset32()
      b34e5c13
    • Linus Torvalds's avatar
      Merge tag 'tty-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · cc432aee
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are some small tty/serial fixes for 5.6-rc5
      
        Just some small serial driver fixes, and a vt core fixup, full details
        are:
      
         - vt fixes for issues found by syzbot
      
         - serdev fix for Apple boxes
      
         - fsl_lpuart serial driver fixes
      
         - MAINTAINER update for incorrect serial files
      
         - new device ids for 8250_exar driver
      
         - mvebu-uart fix
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'tty-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        tty: serial: fsl_lpuart: free IDs allocated by IDA
        Revert "tty: serial: fsl_lpuart: drop EARLYCON_DECLARE"
        serdev: Fix detection of UART devices on Apple machines.
        MAINTAINERS: Add missed files related to Synopsys DesignWare UART
        serial: 8250_exar: add support for ACCES cards
        tty:serial:mvebu-uart:fix a wrong return
        vt: selection, push sel_lock up
        vt: selection, push console lock down
      cc432aee
    • Linus Torvalds's avatar
      Merge tag 'usb-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · fd3f6cc9
      Linus Torvalds authored
      Pull USB/PHY fixes from Greg KH:
       "Here are some small USB and PHY driver fixes for reported issues for
        5.6-rc5.
      
        Included in here are:
      
         - phy driver fixes
      
         - new USB quirks
      
         - USB cdns3 gadget driver fixes
      
         - USB hub core fixes
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'usb-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: dwc3: gadget: Update chain bit correctly when using sg list
        usb: core: port: do error out if usb_autopm_get_interface() fails
        usb: core: hub: do error out if usb_autopm_get_interface() fails
        usb: core: hub: fix unhandled return by employing a void function
        usb: storage: Add quirk for Samsung Fit flash
        usb: quirks: add NO_LPM quirk for Logitech Screen Share
        usb: usb251xb: fix regulator probe and error handling
        phy: allwinner: Fix GENMASK misuse
        usb: cdns3: gadget: toggle cycle bit before reset endpoint
        usb: cdns3: gadget: link trb should point to next request
        phy: mapphone-mdm6600: Fix timeouts by adding wake-up handling
        phy: brcm-sata: Correct MDIO operations for 40nm platforms
        phy: ti: gmii-sel: do not fail in case of gmii
        phy: ti: gmii-sel: fix set of copy-paste errors
        phy: core: Fix phy_get() to not return error on link creation failure
        phy: mapphone-mdm6600: Fix write timeouts with shorter GPIO toggle interval
      fd3f6cc9
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 61a09258
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "Nothing particularly exciting, some small ODP regressions from the mmu
        notifier rework, another bunch of syzkaller fixes, and a bug fix for a
        botched syzkaller fix in the first rc pull request.
      
         - Fix busted syzkaller fix in 'get_new_pps' - this turned out to
           crash on certain HW configurations
      
         - Bug fixes for various missed things in error unwinds
      
         - Add a missing rcu_read_lock annotation in hfi/qib
      
         - Fix two ODP related regressions from the recent mmu notifier
           changes
      
         - Several more syzkaller bugs in siw, RDMA netlink, verbs and iwcm
      
         - Revert an old patch in CMA as it is now shown to not be allocating
           port numbers properly"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/iwcm: Fix iwcm work deallocation
        RDMA/siw: Fix failure handling during device creation
        RDMA/nldev: Fix crash when set a QP to a new counter but QPN is missing
        RDMA/odp: Ensure the mm is still alive before creating an implicit child
        RDMA/core: Fix protection fault in ib_mr_pool_destroy
        IB/mlx5: Fix implicit ODP race
        IB/hfi1, qib: Ensure RCU is locked when accessing list
        RDMA/core: Fix pkey and port assignment in get_new_pps
        RMDA/cm: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen()
        RDMA/rw: Fix error flow during RDMA context initialization
        RDMA/core: Fix use of logical OR in get_new_pps
        Revert "RDMA/cma: Simplify rdma_resolve_addr() error flow"
      61a09258
  6. 07 Mar, 2020 1 commit