11 Sep, 2019

2 commits


04 Sep, 2019

6 commits

  • A helper to find the backing page array based on a virtual address.
    This also ensures we do the same vm_flags check everywhere instead
    of slightly different or missing ones in a few places.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • Currently the generic dma remap allocator gets a vm_flags passed by
    the caller that is a little confusing. We just introduced a generic
    vmalloc-level flag to identify the dma coherent allocations, so use
    that everywhere and remove the now pointless argument.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • Remoteproc started using dma_declare_coherent_memory recently, which is
    a bad idea from drivers, and the maintainers agreed to fix that. But
    until that is fixed only allow building the driver built in so that we
    can remove the dma_declare_coherent_memory export and prevent other
    drivers from "accidentally" using it like remoteproc. Note that the
    driver would also leak the declared coherent memory on unload if it
    actually was built as a module at the moment.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Bjorn Andersson

    Christoph Hellwig
     
  • We can already use DMA_ATTR_WRITE_COMBINE or the _wc prefixed version,
    so remove the third way of doing things.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Laurent Pinchart
    Reviewed-by: Tomi Valkeinen

    Christoph Hellwig
     
  • parisc is the only architecture that sets ARCH_NO_COHERENT_DMA_MMAP
    when an MMU is enabled. AFAIK this is because parisc CPUs use VIVT
    caches, which means exporting normally cachable memory to userspace is
    relatively dangrous due to cache aliasing.

    But normally cachable memory is only allocated by dma_alloc_coherent
    on parisc when using the sba_iommu or ccio_iommu drivers, so just
    remove the .mmap implementation for them so that we don't have to set
    ARCH_NO_COHERENT_DMA_MMAP, which I plan to get rid of.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • While the default ->mmap and ->get_sgtable implementations work for the
    majority of our dma_map_ops impementations they are inherently safe
    for others that don't use the page allocator or CMA and/or use their
    own way of remapping not covered by the common code. So remove the
    defaults if these methods are not wired up, but instead wire up the
    default implementations for all safe instances.

    Fixes: e1c7e324539a ("dma-mapping: always provide the dma_map_ops based implementation")
    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     

03 Sep, 2019

2 commits


26 Aug, 2019

1 commit


25 Aug, 2019

5 commits

  • Pull dma-mapping fixes from Christoph Hellwig:
    "Two fixes for regressions in this merge window:

    - select the Kconfig symbols for the noncoherent dma arch helpers on
    arm if swiotlb is selected, not just for LPAE to not break then Xen
    build, that uses swiotlb indirectly through swiotlb-xen

    - fix the page allocator fallback in dma_alloc_contiguous if the CMA
    allocation fails"

    * tag 'dma-mapping-5.3-5' of git://git.infradead.org/users/hch/dma-mapping:
    dma-direct: fix zone selection after an unaddressable CMA allocation
    arm: select the dma-noncoherent symbols for all swiotlb builds

    Linus Torvalds
     
  • Pull GPIO fixes from Linus Walleij:
    "Here is a (hopefully last) set of GPIO fixes for the v5.3 kernel
    cycle. Two are pretty core:

    - Fix not reporting open drain/source lines to userspace as "input"

    - Fix a minor build error found in randconfigs

    - Fix a chip select quirk on the Freescale SPI

    - Fix the irqchip initialization semantic order to reflect what it
    was using the old API"

    * tag 'gpio-v5.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
    gpio: Fix irqchip initialization order
    gpio: of: fix Freescale SPI CS quirk handling
    gpio: Fix build error of function redefinition
    gpiolib: never report open-drain/source lines as 'input' to user-space

    Linus Torvalds
     
  • Pull Hyper-V fixes from Sasha Levin:

    - Fix for panics and network failures on PAE guests by Dexuan Cui.

    - Fix of a memory leak (and related cleanups) in the hyper-v keyboard
    driver by Dexuan Cui.

    - Code cleanups for hyper-v clocksource driver during the merge window
    by Dexuan Cui.

    - Fix for a false positive warning in the userspace hyper-v KVP store
    by Vitaly Kuznetsov.

    * tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
    Drivers: hv: vmbus: Fix virt_to_hvpfn() for X86_PAE
    Tools: hv: kvp: eliminate 'may be used uninitialized' warning
    Input: hyperv-keyboard: Use in-place iterator API in the channel callback
    Drivers: hv: vmbus: Remove the unused "tsc_page" from struct hv_context

    Linus Torvalds
     
  • Pull SCSI fixes from James Bottomley:
    "Four fixes, three for edge conditions which don't occur very often.
    The lpfc fix mitigates memory exhaustion for some high CPU systems"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: lpfc: Mitigate high memory pre-allocation by SCSI-MQ
    scsi: ufs: Fix NULL pointer dereference in ufshcd_config_vreg_hpm()
    scsi: target: tcmu: avoid use-after-free after command timeout
    scsi: qla2xxx: Fix gnl.l memory leak on adapter init failure

    Linus Torvalds
     
  • Pull more drm fixes from Dave Airlie:
    "Although the tree built for me fine on arm here, it appears either
    header cleanups in next or some kconfig combo it breaks, so this
    contains a fix to mediatek to include dma-mapping.h explicitly.

    There was also one nouveau fix that came in late that I was going to
    leave until next week, but since I was sending this I thought it may
    as well be in here:

    mediatek:
    - fix build in some cases

    nouveau:
    - fix hang with i2c and mst docks"

    * tag 'drm-fixes-2019-08-24' of git://anongit.freedesktop.org/drm/drm:
    drm/mediatek: include dma-mapping header
    drm/nouveau: Don't retry infinitely when receiving no data on i2c over AUX

    Linus Torvalds
     

24 Aug, 2019

6 commits

  • Although it builds fine here in my arm cross compile, it seems
    either via some other patches in -next or some Kconfig combination,
    this fails to build for everyone.

    Include linux/dma-mapping.h should fix it.

    Signed-off-by: Dave Airlie

    Dave Airlie
     
  • Pull rdma fixes from Doug Ledford:
    "No beating around the bush: this is a monster pull request for an -rc5
    kernel. Intel hit me with a series of fixes for TID processing.
    Mellanox hit me with a series for their UMR memory support.

    And we had one fix for siw that fixes the 32bit build warnings and
    because of the number of casts that had to be changed to properly
    silence the warnings, that one patch alone is a full 40% of the LOC of
    this entire pull request. Given that this is the initial release
    kernel for siw, I'm trying to fix anything in it that we can, so that
    adds to the impetus to take fixes for it like this one.

    I had to do a rebase early in the week. Jason had thought he put a
    patch on the rc queue that he needed to be there so he could base some
    work off of it, and it had actually not been placed there. So he asked
    me (on Tuesday) to fix that up before pushing my wip branch to the
    official rc branch. I did, and that's why the early patches look like
    they were all committed at the same time on Tuesday. That bunch had
    been in my queue prior.

    The various patches all pass my test for being legitimate fixes and
    not attempts to slide new features or development into a late rc.
    Well, they were all fixes with the exception of a couple clean up
    patches people wrote for making the fixes they also wrote better (like
    a cleanup patch to move UMR checking into a function so that the
    remaining UMR fix patches can reference that function), so I left
    those in place too.

    My apologies for the LOC count and the number of patches here, it's
    just how the cards fell this cycle.

    Summary:

    - Fix siw buffer mapping issue

    - Fix siw 32/64 casting issues

    - Fix a KASAN access issue in bnxt_re

    - Fix several memory leaks (hfi1, mlx4)

    - Fix a NULL deref in cma_cleanup

    - Fixes for UMR memory support in mlx5 (4 patch series)

    - Fix namespace check for restrack

    - Fixes for counter support

    - Fixes for hfi1 TID processing (5 patch series)

    - Fix potential NULL deref in siw

    - Fix memory page calculations in mlx5"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (21 commits)
    RDMA/siw: Fix 64/32bit pointer inconsistency
    RDMA/siw: Fix SGL mapping issues
    RDMA/bnxt_re: Fix stack-out-of-bounds in bnxt_qplib_rcfw_send_message
    infiniband: hfi1: fix memory leaks
    infiniband: hfi1: fix a memory leak bug
    IB/mlx4: Fix memory leaks
    RDMA/cma: fix null-ptr-deref Read in cma_cleanup
    IB/mlx5: Block MR WR if UMR is not possible
    IB/mlx5: Fix MR re-registration flow to use UMR properly
    IB/mlx5: Report and handle ODP support properly
    IB/mlx5: Consolidate use_umr checks into single function
    RDMA/restrack: Rewrite PID namespace check to be reliable
    RDMA/counters: Properly implement PID checks
    IB/core: Fix NULL pointer dereference when bind QP to counter
    IB/hfi1: Drop stale TID RDMA packets that cause TIDErr
    IB/hfi1: Add additional checks when handling TID RDMA WRITE DATA packet
    IB/hfi1: Add additional checks when handling TID RDMA READ RESP packet
    IB/hfi1: Unsafe PSN checking for TID RDMA READ Resp packet
    IB/hfi1: Drop stale TID RDMA packets
    RDMA/siw: Fix potential NULL de-ref
    ...

    Linus Torvalds
     
  • Pull block fixes from Jens Axboe:
    "Here's a set of fixes that should go into this release. This contains:

    - Three minor fixes for NVMe.

    - Three minor tweaks for the io_uring polling logic.

    - Officially mark Song as the MD maintainer, after he's been filling
    that role sucessfully for the last 6 months or so"

    * tag 'for-linus-20190823' of git://git.kernel.dk/linux-block:
    io_uring: add need_resched() check in inner poll loop
    md: update MAINTAINERS info
    io_uring: don't enter poll loop if we have CQEs pending
    nvme: Add quirk for LiteON CL1 devices running FW 22301111
    nvme: Fix cntlid validation when not using NVMEoF
    nvme-multipath: fix possible I/O hang when paths are updated
    io_uring: fix potential hang with polled IO

    Linus Torvalds
     
  • …device-mapper/linux-dm

    Pull device mapper fixes from Mike Snitzer:

    - Revert a DM bufio change from during the 5.3 merge window now that a
    proper fix has been made to the block loopback driver.

    - Fix DM kcopyd to wakeup so failed subjobs get completed.

    - Various fixes to DM zoned target to address error handling, and other
    small tweaks (SPDX license identifiers and fix typos).

    - Fix DM integrity range locking race by tracking whether journal has
    changed.

    - Fix DM dust target to detect reads of badblocks beyond the first 512b
    sector (applicable if blocksize is larger than 512b).

    - Fix DM persistent-data issue in both the DM btree and DM
    space-map-metadata interfaces.

    - Fix out of bounds memory access with certain DM table configurations.

    * tag 'for-5.3/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
    dm table: fix invalid memory accesses with too high sector number
    dm space map metadata: fix missing store of apply_bops() return value
    dm btree: fix order of block initialization in btree_split_beneath
    dm raid: add missing cleanup in raid_ctr()
    dm zoned: fix potential NULL dereference in dmz_do_reclaim()
    dm dust: use dust block size for badblocklist index
    dm integrity: fix a crash due to BUG_ON in __journal_read_write()
    dm zoned: fix a few typos
    dm zoned: add SPDX license identifiers
    dm zoned: properly handle backing device failure
    dm zoned: improve error handling in i/o map code
    dm zoned: improve error handling in reclaim
    dm kcopyd: always complete failed jobs
    Revert "dm bufio: fix deadlock with loop device"

    Linus Torvalds
     
  • Fixes improper casting between addresses and unsigned types.
    Changes siw_pbl_get_buffer() function to return appropriate
    dma_addr_t, and not u64.

    Also fixes debug prints. Now any potentially kernel private
    pointers are printed formatted as '%pK', to allow keeping that
    information secret.

    Fixes: d941bfe500be ("RDMA/siw: Change CQ flags from 64->32 bits")
    Fixes: b0fff7317bb4 ("rdma/siw: completion queue methods")
    Fixes: 8b6a361b8c48 ("rdma/siw: receive path")
    Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
    Fixes: f29dd55b0236 ("rdma/siw: queue pair methods")
    Fixes: 2251334dcac9 ("rdma/siw: application buffer management")
    Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
    Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
    Fixes: a531975279f3 ("rdma/siw: main include file")

    Reported-by: Geert Uytterhoeven
    Reported-by: Jason Gunthorpe
    Reported-by: Leon Romanovsky
    Signed-off-by: Bernard Metzler
    Link: https://lore.kernel.org/r/20190822173738.26817-1-bmt@zurich.ibm.com
    Signed-off-by: Doug Ledford

    Bernard Metzler
     
  • Pull drm fixes from Dave Airlie:
    "Live from the laundromat after my washing machine broke down, we have
    the 5.3-rc6 fixes. Changelog is in the tag below, but nothing too
    noteworthy in here:

    rcar-du:
    - LVDS dual-link mode fix

    mediatek:
    - of node refcount fix
    - prime buffer import fix
    - dma max seg fix

    komeda:
    - output polling fix
    - abfc format fix
    - memory-region DT fix

    amdgpu:
    - bpc display fix
    - ioctl memory leak fix
    - gfxoff fix
    - smu warnings fix

    i915:
    - HDMI mode readout fix"

    * tag 'drm-fixes-2019-08-23' of git://anongit.freedesktop.org/drm/drm:
    drm/amdgpu/powerplay: silence a warning in smu_v11_0_setup_pptable
    drm/amd/display: Calculate bpc based on max_requested_bpc
    drm/amdgpu: prevent memory leaks in AMDGPU_CS ioctl
    drm/amd/amdgpu: disable MMHUB PG for navi10
    drm/amd/powerplay: remove duplicate macro smu_get_uclk_dpm_states in amdgpu_smu.h
    drm/amd/powerplay: fix variable type errors in smu_v11_0_setup_pptable
    drm/amdgpu/gfx9: update pg_flags after determining if gfx off is possible
    drm/i915: Fix HW readout for crtc_clock in HDMI mode
    drm/mediatek: mtk_drm_drv.c: Add of_node_put() before goto
    drm: rcar_lvds: Fix dual link mode operations
    drm/mediatek: set DMA max segment size
    drm/mediatek: use correct device to import PRIME buffers
    drm/omap: ensure we have a valid dma_mask
    drm/komeda: Add support for 'memory-region' DT node property
    drm/komeda: Adds internal bpp computing for arm afbc only format YU08 YU10
    drm/komeda: Initialize and enable output polling on Komeda

    Linus Torvalds
     

23 Aug, 2019

12 commits

  • If the sector number is too high, dm_table_find_target() should return a
    pointer to a zeroed dm_target structure (the caller should test it with
    dm_target_is_valid).

    However, for some table sizes, the code in dm_table_find_target() that
    performs btree lookup will access out of bound memory structures.

    Fix this bug by testing the sector number at the beginning of
    dm_table_find_target(). Also, add an "inline" keyword to the function
    dm_table_get_size() because this is a hot path.

    Fixes: 512875bd9661 ("dm: table detect io beyond device")
    Cc: stable@vger.kernel.org
    Reported-by: Zhang Tao
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Mike Snitzer

    Mikulas Patocka
     
  • The new API for registering a gpio_irq_chip along with a
    gpio_chip has a different semantic ordering than the old
    API which added the irqchip explicitly after registering
    the gpio_chip.

    Move the calls to add the gpio_irq_chip *last* in the
    function, so that the different hooks setting up OF and
    ACPI and machine gpio_chips are called *before* we try
    to register the interrupts, preserving the elder semantic
    order.

    This cropped up in the PL061 driver which used to work
    fine with no special ACPI quirks, but started to misbehave
    using the new API.

    Fixes: e0d897289813 ("gpio: Implement tighter IRQ chip integration")
    Cc: Thierry Reding
    Cc: Grygorii Strashko
    Cc: Andy Shevchenko
    Reported-by: Wei Xu
    Tested-by: Wei Xu
    Reported-by: Andy Shevchenko
    Signed-off-by: Linus Walleij
    Link: https://lore.kernel.org/r/20190820080527.11796-1-linus.walleij@linaro.org

    Linus Walleij
     
  • Fixes i2c on DP with some docks.

    Signed-off-by: Dave Airlie
    From: Ben Skeggs
    Link: https://patchwork.freedesktop.org/patch/msgid/CACAvsv713t2_BQ44gVV7Lqic6Vwmhq0r4FB5v-t0kD1jzFrbmQ@mail.gmail.com

    Dave Airlie
     
  • While I had thought I had fixed this issue in:

    commit 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after
    ->fini()")

    It turns out that while I did fix the error messages I was seeing on my
    P50 when trying to access i2c busses with the GPU in runtime suspend, I
    accidentally had missed one important detail that was mentioned on the
    bug report this commit was supposed to fix: that the CPU would only lock
    up when trying to access i2c busses _on connected devices_ _while the
    GPU is not in runtime suspend_. Whoops. That definitely explains why I
    was not able to get my machine to hang with i2c bus interactions until
    now, as plugging my P50 into it's dock with an HDMI monitor connected
    allowed me to finally reproduce this locally.

    Now that I have managed to reproduce this issue properly, it looks like
    the problem is much simpler then it looks. It turns out that some
    connected devices, such as MST laptop docks, will actually ACK i2c reads
    even if no data was actually read:

    [ 275.063043] nouveau 0000:01:00.0: i2c: aux 000a: 1: 0000004c 1
    [ 275.063447] nouveau 0000:01:00.0: i2c: aux 000a: 00 01101000 10040000
    [ 275.063759] nouveau 0000:01:00.0: i2c: aux 000a: rd 00000001
    [ 275.064024] nouveau 0000:01:00.0: i2c: aux 000a: rd 00000000
    [ 275.064285] nouveau 0000:01:00.0: i2c: aux 000a: rd 00000000
    [ 275.064594] nouveau 0000:01:00.0: i2c: aux 000a: rd 00000000

    Because we don't handle the situation of i2c ack without any data, we
    end up entering an infinite loop in nvkm_i2c_aux_i2c_xfer() since the
    value of cnt always remains at 0. This finally properly explains how
    this could result in a CPU hang like the ones observed in the
    aforementioned commit.

    So, fix this by retrying transactions if no data is written or received,
    and give up and fail the transaction if we continue to not write or
    receive any data after 32 retries.

    Signed-off-by: Lyude Paul
    Cc: stable@vger.kernel.org
    Signed-off-by: Ben Skeggs

    Lyude Paul
     
  • I think gcc is confused as I don't see how size could be used
    unitialized, but go ahead and silence the warning.

    Signed-off-by: Alex Deucher
    Reviewed-by: Evan Quan
    Signed-off-by: Dave Airlie
    Link: https://patchwork.freedesktop.org/patch/msgid/20190822032527.1376-1-alexander.deucher@amd.com

    Alex Deucher
     
  • Fixes for v5.3-rc6:
    - dma fix for omap.
    - Make output polling work on komeda.
    - Fix bpp computing for AFBC formats in komeda.
    - Support the memory-region property in komeda.

    Signed-off-by: Dave Airlie

    From: Maarten Lankhorst
    Link: https://patchwork.freedesktop.org/patch/msgid/5f1fdfe3-814e-fad1-663c-7279217fc085@linux.intel.com

    Dave Airlie
     
  • drm/i915 fixes for v5.3-rc6:
    - fix hardware state readout for 10 bpc HDMI

    Signed-off-by: Dave Airlie
    From: Jani Nikula
    Link: https://patchwork.freedesktop.org/patch/msgid/87sgptd114.fsf@intel.com

    Dave Airlie
     
  • Pull PCI fixes from Bjorn Helgaas:

    - Reset both NVIDIA GPU and HDA in ThinkPad P50 quirk, which was broken
    by another quirk that enabled the HDA device (Lyude Paul)

    - Fix pciebus-howto.rst documentation filename typo (Bjorn Helgaas)

    * tag 'pci-v5.3-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
    Documentation PCI: Fix pciebus-howto.rst filename typo
    PCI: Reset both NVIDIA GPU and HDA in ThinkPad P50 workaround

    Linus Torvalds
     
  • In commit 6096d91af0b6 ("dm space map metadata: fix occasional leak
    of a metadata block on resize"), we refactor the commit logic to a new
    function 'apply_bops'. But when that logic was replaced in out() the
    return value was not stored. This may lead out() returning a wrong
    value to the caller.

    Fixes: 6096d91af0b6 ("dm space map metadata: fix occasional leak of a metadata block on resize")
    Cc: stable@vger.kernel.org
    Signed-off-by: ZhangXiaoxu
    Signed-off-by: Mike Snitzer

    ZhangXiaoxu
     
  • When btree_split_beneath() splits a node to two new children, it will
    allocate two blocks: left and right. If right block's allocation
    failed, the left block will be unlocked and marked dirty. If this
    happened, the left block'ss content is zero, because it wasn't
    initialized with the btree struct before the attempot to allocate the
    right block. Upon return, when flushing the left block to disk, the
    validator will fail when check this block. Then a BUG_ON is raised.

    Fix this by completely initializing the left block before allocating and
    initializing the right block.

    Fixes: 4dcb8b57df359 ("dm btree: fix leak of bufio-backed block in btree_split_beneath error path")
    Cc: stable@vger.kernel.org
    Signed-off-by: ZhangXiaoxu
    Signed-off-by: Mike Snitzer

    ZhangXiaoxu
     
  • …kernel/git/gustavoars/linux

    Pull more fallthrough fixes from Gustavo A. R. Silva:
    "Fix fall-through warnings on arm and mips for multiple configurations"

    * tag 'Wimplicit-fallthrough-5.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux:
    video: fbdev: acornfb: Mark expected switch fall-through
    scsi: libsas: sas_discover: Mark expected switch fall-through
    MIPS: Octeon: Mark expected switch fall-through
    power: supply: ab8500_charger: Mark expected switch fall-through
    watchdog: wdt285: Mark expected switch fall-through
    mtd: sa1100: Mark expected switch fall-through
    drm/sun4i: tcon: Mark expected switch fall-through
    drm/sun4i: sun6i_mipi_dsi: Mark expected switch fall-through
    ARM: riscpc: Mark expected switch fall-through
    dmaengine: fsldma: Mark expected switch fall-through

    Linus Torvalds
     
  • …cm/linux/kernel/git/chrome-platform/linux

    Pull chrome platform fix from Benson Leung:
    "Fix a kernel crash during suspend/resume of cros_ec_ishtp"

    * tag 'tag-chrome-platform-fixes-for-v5.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
    platform/chrome: cros_ec_ishtp: fix crash during suspend

    Linus Torvalds
     

22 Aug, 2019

6 commits

  • All user level and most in-kernel applications submit WQEs
    where the SG list entries are all of a single type.
    iSER in particular, however, will send us WQEs with mixed SG
    types: sge[0] = kernel buffer, sge[1] = PBL region.
    Check and set is_kva on each SG entry individually instead of
    assuming the first SGE type carries through to the last.
    This fixes iSER over siw.

    Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
    Reported-by: Krishnamraju Eraparaju
    Tested-by: Krishnamraju Eraparaju
    Signed-off-by: Bernard Metzler
    Link: https://lore.kernel.org/r/20190822150741.21871-1-bmt@zurich.ibm.com
    Signed-off-by: Doug Ledford

    Bernard Metzler
     
  • Driver copies FW commands to the HW queue as units of 16 bytes. Some
    of the command structures are not exact multiple of 16. So while copying
    the data from those structures, the stack out of bounds messages are
    reported by KASAN. The following error is reported.

    [ 1337.530155] ==================================================================
    [ 1337.530277] BUG: KASAN: stack-out-of-bounds in bnxt_qplib_rcfw_send_message+0x40a/0x850 [bnxt_re]
    [ 1337.530413] Read of size 16 at addr ffff888725477a48 by task rmmod/2785

    [ 1337.530540] CPU: 5 PID: 2785 Comm: rmmod Tainted: G OE 5.2.0-rc6+ #75
    [ 1337.530541] Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.0.4 08/28/2014
    [ 1337.530542] Call Trace:
    [ 1337.530548] dump_stack+0x5b/0x90
    [ 1337.530556] ? bnxt_qplib_rcfw_send_message+0x40a/0x850 [bnxt_re]
    [ 1337.530560] print_address_description+0x65/0x22e
    [ 1337.530568] ? bnxt_qplib_rcfw_send_message+0x40a/0x850 [bnxt_re]
    [ 1337.530575] ? bnxt_qplib_rcfw_send_message+0x40a/0x850 [bnxt_re]
    [ 1337.530577] __kasan_report.cold.3+0x37/0x77
    [ 1337.530581] ? _raw_write_trylock+0x10/0xe0
    [ 1337.530588] ? bnxt_qplib_rcfw_send_message+0x40a/0x850 [bnxt_re]
    [ 1337.530590] kasan_report+0xe/0x20
    [ 1337.530592] memcpy+0x1f/0x50
    [ 1337.530600] bnxt_qplib_rcfw_send_message+0x40a/0x850 [bnxt_re]
    [ 1337.530608] ? bnxt_qplib_creq_irq+0xa0/0xa0 [bnxt_re]
    [ 1337.530611] ? xas_create+0x3aa/0x5f0
    [ 1337.530613] ? xas_start+0x77/0x110
    [ 1337.530615] ? xas_clear_mark+0x34/0xd0
    [ 1337.530623] bnxt_qplib_free_mrw+0x104/0x1a0 [bnxt_re]
    [ 1337.530631] ? bnxt_qplib_destroy_ah+0x110/0x110 [bnxt_re]
    [ 1337.530633] ? bit_wait_io_timeout+0xc0/0xc0
    [ 1337.530641] bnxt_re_dealloc_mw+0x2c/0x60 [bnxt_re]
    [ 1337.530648] bnxt_re_destroy_fence_mr+0x77/0x1d0 [bnxt_re]
    [ 1337.530655] bnxt_re_dealloc_pd+0x25/0x60 [bnxt_re]
    [ 1337.530677] ib_dealloc_pd_user+0xbe/0xe0 [ib_core]
    [ 1337.530683] srpt_remove_one+0x5de/0x690 [ib_srpt]
    [ 1337.530689] ? __srpt_close_all_ch+0xc0/0xc0 [ib_srpt]
    [ 1337.530692] ? xa_load+0x87/0xe0
    ...
    [ 1337.530840] do_syscall_64+0x6d/0x1f0
    [ 1337.530843] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 1337.530845] RIP: 0033:0x7ff5b389035b
    [ 1337.530848] Code: 73 01 c3 48 8b 0d 2d 0b 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 3d 01 f0 ff ff 73 01 c3 48 8b 0d fd 0a 2c 00 f7 d8 64 89 01 48
    [ 1337.530849] RSP: 002b:00007fff83425c28 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
    [ 1337.530852] RAX: ffffffffffffffda RBX: 00005596443e6750 RCX: 00007ff5b389035b
    [ 1337.530853] RDX: 000000000000000a RSI: 0000000000000800 RDI: 00005596443e67b8
    [ 1337.530854] RBP: 0000000000000000 R08: 00007fff83424ba1 R09: 0000000000000000
    [ 1337.530856] R10: 00007ff5b3902960 R11: 0000000000000206 R12: 00007fff83425e50
    [ 1337.530857] R13: 00007fff8342673c R14: 00005596443e6260 R15: 00005596443e6750

    [ 1337.530885] The buggy address belongs to the page:
    [ 1337.530962] page:ffffea001c951dc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
    [ 1337.530964] flags: 0x57ffffc0000000()
    [ 1337.530967] raw: 0057ffffc0000000 0000000000000000 ffffffff1c950101 0000000000000000
    [ 1337.530970] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
    [ 1337.530970] page dumped because: kasan: bad access detected

    [ 1337.530996] Memory state around the buggy address:
    [ 1337.531072] ffff888725477900: 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 f2 f2 f2
    [ 1337.531180] ffff888725477980: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00
    [ 1337.531288] >ffff888725477a00: 00 f2 f2 f2 f2 f2 f2 00 00 00 f2 00 00 00 00 00
    [ 1337.531393] ^
    [ 1337.531478] ffff888725477a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [ 1337.531585] ffff888725477b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [ 1337.531691] ==================================================================

    Fix this by passing the exact size of each FW command to
    bnxt_qplib_rcfw_send_message as req->cmd_size. Before sending
    the command to HW, modify the req->cmd_size to number of 16 byte units.

    Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
    Signed-off-by: Selvin Xavier
    Link: https://lore.kernel.org/r/1566468170-489-1-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Doug Ledford

    Selvin Xavier
     
  • drm-fixes-5.3-2019-08-21:

    amdgpu:
    - Fix gfxoff logic on RV
    - Powerplay fixes
    - Fix a possible memory leak in CS ioctl
    - bpc fix for display

    Signed-off-by: Dave Airlie
    From: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/20190822021022.3356-1-alexander.deucher@amd.com

    Dave Airlie
     
  • Mediatek memory leak drm fix for Linux 5.3

    Signed-off-by: Dave Airlie

    From: CK Hu
    Link: https://patchwork.freedesktop.org/patch/msgid/1566264270.30493.4.camel@mtksdaap41

    Dave Airlie
     
  • R-Car LVDS encoder fix

    Signed-off-by: Dave Airlie

    From: Laurent Pinchart
    Link: https://patchwork.freedesktop.org/patch/msgid/20190816130115.GH5020@pendragon.ideasonboard.com

    Dave Airlie
     
  • [Why]
    The only place where state->max_bpc is updated on the connector is
    at the start of atomic check during drm_atomic_connector_check. It
    isn't updated when adding the connectors to the atomic state after
    the fact. It also doesn't necessarily reflect the right value when
    called in amdgpu during mode validation outside of atomic check.

    This can cause the wrong bpc to be used even if the max_requested_bpc
    is the correct value.

    [How]
    Don't rely on state->max_bpc reflecting the real bpc value and just
    do the min(...) based on display info bpc and max_requested_bpc.

    Fixes: 01933ba42d3d ("drm/amd/display: Use current connector state if NULL when checking bpc")
    Signed-off-by: Nicholas Kazlauskas
    Reviewed-by: Leo Li
    Signed-off-by: Alex Deucher

    Nicholas Kazlauskas