1. 06 May, 2018 1 commit
    • Linus Torvalds's avatar
      Merge tag 'usb-4.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 8e95cb33
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some USB driver fixes for 4.17-rc4.
      
        The majority of them are some USB gadget fixes that missed my last
        pull request. The "largest" patch in here is a fix for the old visor
        driver that syzbot found 6 months or so ago and I finally remembered
        to fix it.
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'usb-4.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        Revert "usb: host: ehci: Use dma_pool_zalloc()"
        usb: typec: tps6598x: handle block reads separately with plain-I2C adapters
        usb: typec: tcpm: Release the role mux when exiting
        USB: Accept bulk endpoints with 1024-byte maxpacket
        xhci: Fix use-after-free in xhci_free_virt_device
        USB: serial: visor: handle potential invalid device configuration
        USB: serial: option: adding support for ublox R410M
        usb: musb: trace: fix NULL pointer dereference in musb_g_tx()
        usb: musb: host: fix potential NULL pointer dereference
        usb: gadget: composite Allow for larger configuration descriptors
        usb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeue
        usb: dwc3: gadget: dwc3_gadget_del_and_unmap_request() can be static
        usb: dwc2: pci: Fix error return code in dwc2_pci_probe()
        usb: dwc2: WA for Full speed ISOC IN in DDMA mode.
        usb: dwc2: dwc2_vbus_supply_init: fix error check
        usb: gadget: f_phonet: fix pn_net_xmit()'s return type
      8e95cb33
  2. 05 May, 2018 13 commits
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v4.17' of... · c1c07416
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - remove state comment in modpost
      
       - extend MAINTAINERS entry to cover modpost and more makefiles
      
       - fix missed building of SANCOV gcc-plugin
      
       - replace left-over 'bison' with $(YACC)
      
       - display short log when generating parer of genksyms
      
      * tag 'kbuild-fixes-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        genksyms: fix typo in parse.tab.{c,h} generation rules
        kbuild: replace hardcoded bison in cmd_bison_h with $(YACC)
        gcc-plugins: fix build condition of SANCOV plugin
        MAINTAINERS: Update Kbuild entry with a few paths
        modpost: delete stale comment
      c1c07416
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 4a7a7729
      Linus Torvalds authored
      Pull clk fixes froom Stephen Boyd:
       "A handful of fixes for the stm32mp1 clk driver came in during the
        merge window for the driver that got merged in the merge window.
      
        Plus a warning fix for unused PM ops and a couple fixes for the meson
        clk driver clk names that went unnoticed with the regmap rework.
      
        There's also another fix in here for the mux rounding flag which
        wasn't doing what it said it did, but now it does"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: meson: meson8b: fix meson8b_cpu_clk parent clock name
        clk: meson: meson8b: fix meson8b_fclk_div3_div clock name
        clk: meson: drop meson_aoclk_gate_regmap_ops
        clk: meson: honor CLK_MUX_ROUND_CLOSEST in clk_regmap
        clk: honor CLK_MUX_ROUND_CLOSEST in generic clk mux
        clk: cs2000: mark resume function as __maybe_unused
        clk: stm32mp1: remove ck_apb_dbg clock
        clk: stm32mp1: set stgen_k clock as critical
        clk: stm32mp1: add missing tzc2 clock
        clk: stm32mp1: fix SAI3 & SAI4 clocks
        clk: stm32mp1: remove unused dfsdm_src[] const
        clk: stm32mp1: add missing static
      4a7a7729
    • Linus Torvalds's avatar
      Merge tag 'rproc-v4.17-1' of git://github.com/andersson/remoteproc · f9331473
      Linus Torvalds authored
      Pull remoteproc and rpmsg fixes from Bjorn Andersson:
      
       - fix screw-up when reversing boolean for rproc_stop()
      
       - add missing OF node refcounting dereferences
      
       - add missing MODULE_ALIAS in rpmsg_char
      
      * tag 'rproc-v4.17-1' of git://github.com/andersson/remoteproc:
        rpmsg: added MODULE_ALIAS for rpmsg_char
        remoteproc: qcom: Fix potential device node leaks
        remoteproc: fix crashed parameter logic on stop call
      f9331473
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.17-rc4' of git://people.freedesktop.org/~airlied/linux · c12fd0fe
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "vmwgfx, i915, vc4, vga dac fixes.
      
        This seems eerily quiet, so I expect it will explode next week or
        something.
      
        One i915 model firmware, two vmwgfx fixes, one vc4 fix and one bridge
        leak fix"
      
      * tag 'drm-fixes-for-v4.17-rc4' of git://people.freedesktop.org/~airlied/linux:
        drm/bridge: vga-dac: Fix edid memory leak
        drm/vc4: Make sure vc4_bo_{inc,dec}_usecnt() calls are balanced
        drm/i915/glk: Add MODULE_FIRMWARE for Geminilake
        drm/vmwgfx: Fix a buffer object leak
        drm/vmwgfx: Clean up fbdev modeset locking
      c12fd0fe
    • Linus Torvalds's avatar
      Merge tag 'trace-v4.17-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 4b293907
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "Some of the files in the tracing directory show file mode 0444 when
        they are writable by root. To fix the confusion, they should be 0644.
        Note, either case root can still write to them.
      
        Zhengyuan asked why I never applied that patch (the first one is from
        2014!). I simply forgot about it. /me lowers head in shame"
      
      * tag 'trace-v4.17-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Fix the file mode of stack tracer
        ftrace: Have set_graph_* files have normal file modes
      4b293907
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · eb4f959b
      Linus Torvalds authored
      Pull rdma fixes from Doug Ledford:
       "This is our first pull request of the rc cycle. It's not that it's
        been overly quiet, we were just waiting on a few things before sending
        this off.
      
        For instance, the 6 patch series from Intel for the hfi1 driver had
        actually been pulled in on Tuesday for a Wednesday pull request, only
        to have Jason notice something I missed, so we held off for some
        testing, and then on Thursday had to respin the series because the
        very first patch needed a minor fix (unnecessary cast is all).
      
        There is a sizable hns patch series in here, as well as a reasonably
        largish hfi1 patch series, then all of the lines of uapi updates are
        just the change to the new official Linux-OpenIB SPDX tag (a bunch of
        our files had what amounts to a BSD-2-Clause + MIT Warranty statement
        as their license as a result of the initial code submission years ago,
        and the SPDX folks decided it was unique enough to warrant a unique
        tag), then the typical mlx4 and mlx5 updates, and finally some cxgb4
        and core/cache/cma updates to round out the bunch.
      
        None of it was overly large by itself, but in the 2 1/2 weeks we've
        been collecting patches, it has added up :-/.
      
        As best I can tell, it's been through 0day (I got a notice about my
        last for-next push, but not for my for-rc push, but Jason seems to
        think that failure messages are prioritized and success messages not
        so much). It's also been through linux-next. And yes, we did notice in
        the context portion of the CMA query gid fix patch that there is a
        dubious BUG_ON() in the code, and have plans to audit our BUG_ON usage
        and remove it anywhere we can.
      
        Summary:
      
         - Various build fixes (USER_ACCESS=m and ADDR_TRANS turned off)
      
         - SPDX license tag cleanups (new tag Linux-OpenIB)
      
         - RoCE GID fixes related to default GIDs
      
         - Various fixes to: cxgb4, uverbs, cma, iwpm, rxe, hns (big batch),
           mlx4, mlx5, and hfi1 (medium batch)"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (52 commits)
        RDMA/cma: Do not query GID during QP state transition to RTR
        IB/mlx4: Fix integer overflow when calculating optimal MTT size
        IB/hfi1: Fix memory leak in exception path in get_irq_affinity()
        IB/{hfi1, rdmavt}: Fix memory leak in hfi1_alloc_devdata() upon failure
        IB/hfi1: Fix NULL pointer dereference when invalid num_vls is used
        IB/hfi1: Fix loss of BECN with AHG
        IB/hfi1 Use correct type for num_user_context
        IB/hfi1: Fix handling of FECN marked multicast packet
        IB/core: Make ib_mad_client_id atomic
        iw_cxgb4: Atomically flush per QP HW CQEs
        IB/uverbs: Fix kernel crash during MR deregistration flow
        IB/uverbs: Prevent reregistration of DM_MR to regular MR
        RDMA/mlx4: Add missed RSS hash inner header flag
        RDMA/hns: Fix a couple misspellings
        RDMA/hns: Submit bad wr
        RDMA/hns: Update assignment method for owner field of send wqe
        RDMA/hns: Adjust the order of cleanup hem table
        RDMA/hns: Only assign dqpn if IB_QP_PATH_DEST_QPN bit is set
        RDMA/hns: Remove some unnecessary attr_mask judgement
        RDMA/hns: Only assign mtu if IB_QP_PATH_MTU bit is set
        ...
      eb4f959b
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20180504' of git://git.kernel.dk/linux-block · 2f50037a
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A collection of fixes that should to into this release. This contains:
      
         - Set of bcache fixes from Coly, fixing regression in patches that
           went into this series.
      
         - Set of NVMe fixes by way of Keith.
      
         - Set of bdi related fixes, one from Jan and two from Tetsuo Handa,
           fixing various issues around device addition/removal.
      
         - Two block inflight fixes from Omar, fixing issues around the
           transition to using tags for blk-mq inflight accounting that we
           did a few releases ago"
      
      * tag 'for-linus-20180504' of git://git.kernel.dk/linux-block:
        bdi: Fix oops in wb_workfn()
        nvmet: switch loopback target state to connecting when resetting
        nvme/multipath: Fix multipath disabled naming collisions
        nvme/multipath: Disable runtime writable enabling parameter
        nvme: Set integrity flag for user passthrough commands
        nvme: fix potential memory leak in option parsing
        bdi: Fix use after free bug in debugfs_remove()
        bdi: wake up concurrent wb_shutdown() callers.
        bcache: use pr_info() to inform duplicated CACHE_SET_IO_DISABLE set
        bcache: set dc->io_disable to true in conditional_stop_bcache_device()
        bcache: add wait_for_kthread_stop() in bch_allocator_thread()
        bcache: count backing device I/O error for writeback I/O
        bcache: set CACHE_SET_IO_DISABLE in bch_cached_dev_error()
        bcache: store disk name in struct cache and struct cached_dev
        blk-mq: fix sysfs inflight counter
        blk-mq: count allocated but not started requests in iostats inflight
      2f50037a
    • Linus Torvalds's avatar
      Merge tag 'xfs-4.17-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 2e171ffc
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
       "I've got one more bug fix for xfs for 4.17-rc4, which caps the amount
        of data we try to handle in one dedupe request so that userspace can't
        livelock the kernel.
      
        This series has been run through a full xfstests run during the week
        and through a quick xfstests run against this morning's master, with
        no ajor failures reported.
      
        Summary:
      
        - Cap the maximum length of a deduplication request at MAX_RW_COUNT/2
          to avoid kernel livelock due to excessively large IO requests"
      
      * tag 'xfs-4.17-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: cap the length of deduplication requests
      2e171ffc
    • Linus Torvalds's avatar
      Merge tag 'for-4.17-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 4148d388
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "Two regression fixes and one fix for stable"
      
      * tag 'for-4.17-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        Btrfs: send, fix missing truncate for inode with prealloc extent past eof
        btrfs: Take trans lock before access running trans in check_delayed_ref
        btrfs: Fix wrong first_key parameter in replace_path
      4148d388
    • Mauro Rossi's avatar
      genksyms: fix typo in parse.tab.{c,h} generation rules · 0da7e432
      Mauro Rossi authored
      'quet' is replaced by 'quiet' in scripts/genksyms/Makefile
      Signed-off-by: default avatarMauro Rossi <issor.oruam@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      0da7e432
    • Masahiro Yamada's avatar
      kbuild: replace hardcoded bison in cmd_bison_h with $(YACC) · d59fbbd0
      Masahiro Yamada authored
      Commit 73a4f6db ("kbuild: add LEX and YACC variables") missed to
      update cmd_bison_h somehow.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      d59fbbd0
    • Masahiro Yamada's avatar
      gcc-plugins: fix build condition of SANCOV plugin · 642ef99b
      Masahiro Yamada authored
      Since commit d677a4d6 ("Makefile: support flag
      -fsanitizer-coverage=trace-cmp"), you miss to build the SANCOV
      plugin under some circumstances.
      
        CONFIG_KCOV=y
        CONFIG_KCOV_ENABLE_COMPARISONS=y
        Your compiler does not support -fsanitize-coverage=trace-pc
        Your compiler does not support -fsanitize-coverage=trace-cmp
      
      Under this condition, $(CFLAGS_KCOV) is not empty but contains a
      space, so the following ifeq-conditional is false.
      
          ifeq ($(CFLAGS_KCOV),)
      
      Then, scripts/Makefile.gcc-plugins misses to add sancov_plugin.so to
      gcc-plugin-y while the SANCOV plugin is necessary as an alternative
      means.
      
      Fixes: d677a4d6 ("Makefile: support flag -fsanitizer-coverage=trace-cmp")
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      642ef99b
    • Rasmus Villemoes's avatar
      MAINTAINERS: Update Kbuild entry with a few paths · 1cd4023b
      Rasmus Villemoes authored
      I managed to send some modpost patches to old addresses of both
      Masahiro and Michal, and omitted linux-kbuild from cc, because my
      tried and trusted scripts/get_maintainer wrapper failed me. Add the
      modpost directory to the MAINTAINERS entry, and while at it make the
      Makefile glob match scripts/Makefile itself, and add one matching the
      Kbuild.include file as well.
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      1cd4023b
  3. 04 May, 2018 14 commits
  4. 03 May, 2018 12 commits
    • Jan Kara's avatar
      bdi: Fix oops in wb_workfn() · b8b78495
      Jan Kara authored
      Syzbot has reported that it can hit a NULL pointer dereference in
      wb_workfn() due to wb->bdi->dev being NULL. This indicates that
      wb_workfn() was called for an already unregistered bdi which should not
      happen as wb_shutdown() called from bdi_unregister() should make sure
      all pending writeback works are completed before bdi is unregistered.
      Except that wb_workfn() itself can requeue the work with:
      
      	mod_delayed_work(bdi_wq, &wb->dwork, 0);
      
      and if this happens while wb_shutdown() is waiting in:
      
      	flush_delayed_work(&wb->dwork);
      
      the dwork can get executed after wb_shutdown() has finished and
      bdi_unregister() has cleared wb->bdi->dev.
      
      Make wb_workfn() use wakeup_wb() for requeueing the work which takes all
      the necessary precautions against racing with bdi unregistration.
      
      CC: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      CC: Tejun Heo <tj@kernel.org>
      Fixes: 839a8e86Reported-by: default avatarsyzbot <syzbot+9873874c735f2892e7e9@syzkaller.appspotmail.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      b8b78495
    • Parav Pandit's avatar
      RDMA/cma: Do not query GID during QP state transition to RTR · 9aa16921
      Parav Pandit authored
      When commit [1] was added, SGID was queried to derive the SMAC address.
      Then, later on during a refactor [2], SMAC was no longer needed. However,
      the now useless GID query remained.  Then during additional code changes
      later on, the GID query was being done in such a way that it caused iWARP
      queries to start breaking.  Remove the useless GID query and resolve the
      iWARP breakage at the same time.
      
      This is discussed in [3].
      
      [1] commit dd5f03be ("IB/core: Ethernet L2 attributes in verbs/cm structures")
      [2] commit 5c266b23 ("IB/cm: Remove the usage of smac and vid of qp_attr and cm_av")
      [3] https://www.spinics.net/lists/linux-rdma/msg63951.htmlSuggested-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      9aa16921
    • Jack Morgenstein's avatar
      IB/mlx4: Fix integer overflow when calculating optimal MTT size · b03bcde9
      Jack Morgenstein authored
      When the kernel was compiled using the UBSAN option,
      we saw the following stack trace:
      
      [ 1184.827917] UBSAN: Undefined behaviour in drivers/infiniband/hw/mlx4/mr.c:349:27
      [ 1184.828114] signed integer overflow:
      [ 1184.828247] -2147483648 - 1 cannot be represented in type 'int'
      
      The problem was caused by calling round_up in procedure
      mlx4_ib_umem_calc_optimal_mtt_size (on line 349, as noted in the stack
      trace) with the second parameter (1 << block_shift) (which is an int).
      The second parameter should have been (1ULL << block_shift) (which
      is an unsigned long long).
      
      (1 << block_shift) is treated by the compiler as an int (because 1 is
      an integer).
      
      Now, local variable block_shift is initialized to 31.
      If block_shift is 31, 1 << block_shift is 1 << 31 = 0x80000000=-214748368.
      This is the most negative int value.
      
      Inside the round_up macro, there is a cast applied to ((1 << 31) - 1).
      However, this cast is applied AFTER ((1 << 31) - 1) is calculated.
      Since (1 << 31) is treated as an int, we get the negative overflow
      identified by UBSAN in the process of calculating ((1 << 31) - 1).
      
      The fix is to change (1 << block_shift) to (1ULL << block_shift) on
      line 349.
      
      Fixes: 9901abf5 ("IB/mlx4: Use optimal numbers of MTT entries")
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      b03bcde9
    • Sebastian Sanchez's avatar
      IB/hfi1: Fix memory leak in exception path in get_irq_affinity() · 59482a14
      Sebastian Sanchez authored
      When IRQ affinity is set and the interrupt type is unknown, a cpu
      mask allocated within the function is never freed. Fix this memory
      leak by allocating memory within the scope where it is used.
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarSebastian Sanchez <sebastian.sanchez@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      59482a14
    • Sebastian Sanchez's avatar
      IB/{hfi1, rdmavt}: Fix memory leak in hfi1_alloc_devdata() upon failure · e9777ad4
      Sebastian Sanchez authored
      When allocating device data, if there's an allocation failure, the
      already allocated memory won't be freed such as per-cpu counters.
      
      Fix memory leaks in exception path by creating a common reentrant
      clean up function hfi1_clean_devdata() to be used at driver unload
      time and device data allocation failure.
      
      To accomplish this, free_platform_config() and clean_up_i2c() are
      changed to be reentrant to remove dependencies when they are called
      in different order. This helps avoid NULL pointer dereferences
      introduced by this patch if those two functions weren't reentrant.
      
      In addition, set dd->int_counter, dd->rcv_limit,
      dd->send_schedule and dd->tx_opstats to NULL after they're freed in
      hfi1_clean_devdata(), so that hfi1_clean_devdata() is fully reentrant.
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarSebastian Sanchez <sebastian.sanchez@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      e9777ad4
    • Sebastian Sanchez's avatar
      IB/hfi1: Fix NULL pointer dereference when invalid num_vls is used · 45d92457
      Sebastian Sanchez authored
      When an invalid num_vls is used as a module parameter, the code
      execution follows an exception path where the macro dd_dev_err()
      expects dd->pcidev->dev not to be NULL in hfi1_init_dd(). This
      causes a NULL pointer dereference.
      
      Fix hfi1_init_dd() by initializing dd->pcidev and dd->pcidev->dev
      earlier in the code. If a dd exists, then dd->pcidev and
      dd->pcidev->dev always exists.
      
      BUG: unable to handle kernel NULL pointer dereference
      at 00000000000000f0
      IP: __dev_printk+0x15/0x90
      Workqueue: events work_for_cpu_fn
      RIP: 0010:__dev_printk+0x15/0x90
      Call Trace:
       dev_err+0x6c/0x90
       ? hfi1_init_pportdata+0x38d/0x3f0 [hfi1]
       hfi1_init_dd+0xdd/0x2530 [hfi1]
       ? pci_conf1_read+0xb2/0xf0
       ? pci_read_config_word.part.9+0x64/0x80
       ? pci_conf1_write+0xb0/0xf0
       ? pcie_capability_clear_and_set_word+0x57/0x80
       init_one+0x141/0x490 [hfi1]
       local_pci_probe+0x3f/0xa0
       work_for_cpu_fn+0x10/0x20
       process_one_work+0x152/0x350
       worker_thread+0x1cf/0x3e0
       kthread+0xf5/0x130
       ? max_active_store+0x80/0x80
       ? kthread_bind+0x10/0x10
       ? do_syscall_64+0x6e/0x1a0
       ? SyS_exit_group+0x10/0x10
       ret_from_fork+0x35/0x40
      
      Cc: <stable@vger.kernel.org> # 4.9.x
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarSebastian Sanchez <sebastian.sanchez@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      45d92457
    • Mike Marciniszyn's avatar
      IB/hfi1: Fix loss of BECN with AHG · 0a0bcb04
      Mike Marciniszyn authored
      AHG may be armed to use the stored header, which by design is limited
      to edits in the PSN/A 32 bit word (bth2).
      
      When the code is trying to send a BECN, the use of the stored header
      will lose the BECN bit.
      
      Fix by avoiding AHG when getting ready to send a BECN. This is
      accomplished by always claiming the packet is not a middle packet which
      is an AHG precursor.  BECNs are not a normal case and this should not
      hurt AHG optimizations.
      
      Cc: <stable@vger.kernel.org> # 4.14.x
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      0a0bcb04
    • Michael J. Ruhl's avatar
      IB/hfi1 Use correct type for num_user_context · 5da9e742
      Michael J. Ruhl authored
      The module parameter num_user_context is defined as 'int' and
      defaults to -1.  The module_param_named() says that it is uint.
      
      Correct module_param_named() type information and update the modinfo
      text to reflect the default value.
      Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      5da9e742
    • Mike Marciniszyn's avatar
      IB/hfi1: Fix handling of FECN marked multicast packet · f59fb9e0
      Mike Marciniszyn authored
      The code for handling a marked UD packet unconditionally returns the
      dlid in the header of the FECN marked packet.  This is not correct
      for multicast packets where the DLID is in the multicast range.
      
      The subsequent attempt to send the CNP with the multicast lid will
      cause the chip to halt the ack send context because the source
      lid doesn't match the chip programming.   The send context will
      be halted and flush any other pending packets in the pio ring causing
      the CNP to not be sent.
      
      A part of investigating the fix, it was determined that the 16B work
      broke the FECN routine badly with inconsistent use of 16 bit and 32 bits
      types for lids and pkeys.  Since the port's source lid was correctly 32
      bits the type mixmatches need to be dealt with at the same time as
      fixing the CNP header issue.
      
      Fix these issues by:
      - Using the ports lid for as the SLID for responding to FECN marked UD
        packets
      - Insure pkey is always 16 bit in this and subordinate routines
      - Insure lids are 32 bits in this and subordinate routines
      
      Cc: <stable@vger.kernel.org> # 4.14.x
      Fixes: 88733e3b ("IB/hfi1: Add 16B UD support")
      Reviewed-by: default avatarDon Hiatt <don.hiatt@intel.com>
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      f59fb9e0
    • Eric Dumazet's avatar
      dccp: fix tasklet usage · a8d7aa17
      Eric Dumazet authored
      syzbot reported a crash in tasklet_action_common() caused by dccp.
      
      dccp needs to make sure socket wont disappear before tasklet handler
      has completed.
      
      This patch takes a reference on the socket when arming the tasklet,
      and moves the sock_put() from dccp_write_xmit_timer() to dccp_write_xmitlet()
      
      kernel BUG at kernel/softirq.c:514!
      invalid opcode: 0000 [#1] SMP KASAN
      Dumping ftrace buffer:
         (ftrace buffer empty)
      Modules linked in:
      CPU: 1 PID: 17 Comm: ksoftirqd/1 Not tainted 4.17.0-rc3+ #30
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:tasklet_action_common.isra.19+0x6db/0x700 kernel/softirq.c:515
      RSP: 0018:ffff8801d9b3faf8 EFLAGS: 00010246
      dccp_close: ABORT with 65423 bytes unread
      RAX: 1ffff1003b367f6b RBX: ffff8801daf1f3f0 RCX: 0000000000000000
      RDX: ffff8801cf895498 RSI: 0000000000000004 RDI: 0000000000000000
      RBP: ffff8801d9b3fc40 R08: ffffed0039f12a95 R09: ffffed0039f12a94
      dccp_close: ABORT with 65423 bytes unread
      R10: ffffed0039f12a94 R11: ffff8801cf8954a3 R12: 0000000000000000
      R13: ffff8801d9b3fc18 R14: dffffc0000000000 R15: ffff8801cf895490
      FS:  0000000000000000(0000) GS:ffff8801daf00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b2bc28000 CR3: 00000001a08a9000 CR4: 00000000001406e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       tasklet_action+0x1d/0x20 kernel/softirq.c:533
       __do_softirq+0x2e0/0xaf5 kernel/softirq.c:285
      dccp_close: ABORT with 65423 bytes unread
       run_ksoftirqd+0x86/0x100 kernel/softirq.c:646
       smpboot_thread_fn+0x417/0x870 kernel/smpboot.c:164
       kthread+0x345/0x410 kernel/kthread.c:238
       ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412
      Code: 48 8b 85 e8 fe ff ff 48 8b 95 f0 fe ff ff e9 94 fb ff ff 48 89 95 f0 fe ff ff e8 81 53 6e 00 48 8b 95 f0 fe ff ff e9 62 fb ff ff <0f> 0b 48 89 cf 48 89 8d e8 fe ff ff e8 64 53 6e 00 48 8b 8d e8
      RIP: tasklet_action_common.isra.19+0x6db/0x700 kernel/softirq.c:515 RSP: ffff8801d9b3faf8
      
      Fixes: dc841e30 ("dccp: Extend CCID packet dequeueing interface")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: Gerrit Renker <gerrit@erg.abdn.ac.uk>
      Cc: dccp@vger.kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a8d7aa17
    • David S. Miller's avatar
      Merge branch 'smc-fixes' · 31140b47
      David S. Miller authored
      Ursula Braun says:
      
      ====================
      net/smc: fixes 2018/05/03
      
      here are smc fixes for 2 problems:
       * receive buffers in SMC must be registered. If registration fails
         these buffers must not be kept within the link group for reuse.
         Patch 1 is a preparational patch; patch 2 contains the fix.
       * sendpage: do not hold the sock lock when calling kernel_sendpage()
                   or sock_no_sendpage()
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31140b47
    • Stefan Raspl's avatar
      smc: fix sendpage() call · bda27ff5
      Stefan Raspl authored
      The sendpage() call grabs the sock lock before calling the default
      implementation - which tries to grab it once again.
      Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
      Signed-off-by: Ursula Braun <ubraun@linux.ibm.com><
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bda27ff5