1. 11 Sep, 2017 11 commits
    • Akinobu Mita's avatar
      nvme-pci: use appropriate initial chunk size for HMB allocation · 30f92d62
      Akinobu Mita authored
      The initial chunk size for host memory buffer allocation is currently
      PAGE_SIZE << MAX_ORDER.  MAX_ORDER order allocation is usually failed
      without CONFIG_DMA_CMA.  So the HMB allocation is retried with chunk size
      PAGE_SIZE << (MAX_ORDER - 1) in general, but there is no problem if the
      retry allocation works correctly.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      [hch: rebased]
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
      Cc: stable@vger.kernel.org
      30f92d62
    • Christoph Hellwig's avatar
      nvme-pci: fix host memory buffer allocation fallback · 92dc6895
      Christoph Hellwig authored
      nvme_alloc_host_mem currently contains two loops that are interwinded,
      and the outer retry loop turns out to be broken.  Fix this by untangling
      the two.
      
      Based on a report an initial patch from Akinobu Mita.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reported-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Tested-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
      Cc: stable@vger.kernel.org
      92dc6895
    • Christoph Hellwig's avatar
      nvme: fix lightnvm check · 608cc4b1
      Christoph Hellwig authored
      nvme_nvm_ns_supported assumes every device is a pci_dev, which leads to
      reading an incorrect field, or possible even a dereference of unallocated
      memory for fabrics controllers.
      
      Fix this by introducing a quirk for lighnvm capable devices instead.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMatias Bjørling <mb@lightnvm.io>
      Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      608cc4b1
    • Mikulas Patocka's avatar
      block: fix integer overflow in __blkdev_sectors_to_bio_pages() · 09c2c359
      Mikulas Patocka authored
      Fix possible integer overflow in __blkdev_sectors_to_bio_pages if
      sector_t is 32-bit.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Fixes: 615d22a5 ("block: Fix __blkdev_issue_zeroout loop")
      Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      09c2c359
    • Scott Bauer's avatar
      block: sed-opal: Set MBRDone on S3 resume path if TPER is MBREnabled · dbec491b
      Scott Bauer authored
      Users who are booting off their Opal enabled drives are having
      issues when they have a shadow MBR set up after s3/resume cycle.
      When the Drive has a shadow MBR setup the MBRDone flag is set to
      false upon power loss (S3/S4/S5). When the MBRDone flag is false
      I/O to LBA 0 -> LBA_END_MBR are remapped to the shadow mbr
      of the drive. If the drive contains useful data in the 0 -> end_mbr
      range upon s3 resume the user can never get to that data as the
      drive will keep remapping it to the MBR. To fix this when we unlock
      on S3 resume, we need to tell the drive that we're done with the
      shadow mbr (even though we didnt use it) by setting true to MBRDone.
      This way the drive will stop the remapping and the user can access
      their data.
      
      Acked-by Jon Derrick: <jonathan.derrick@intel.com>
      Signed-off-by: default avatarScott Bauer <scott.bauer@intel.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      dbec491b
    • Greg Thelen's avatar
      block: tolerate tracing of NULL bio · f8e9ec16
      Greg Thelen authored
      __get_request() can call trace_block_getrq() with bio=NULL which causes
      block_get_rq::TP_fast_assign() to deref a NULL pointer and panic.
      
      Syzkaller fuzzer panics with
      linux-next (1d53d908b79d7870d89063062584eead4cf83448):
        kasan: GPF could be caused by NULL-ptr deref or user memory access
        general protection fault: 0000 [#1] SMP KASAN
        Modules linked in:
        CPU: 0 PID: 2983 Comm: syzkaller401111 Not tainted 4.13.0-rc7-next-20170901+ #13
        task: ffff8801cf1da000 task.stack: ffff8801ce440000
        RIP: 0010:perf_trace_block_get_rq+0x697/0x970 include/trace/events/block.h:384
        RSP: 0018:ffff8801ce4473f0 EFLAGS: 00010246
        RAX: ffff8801cf1da000 RBX: 1ffff10039c88e84 RCX: 1ffffd1ffff84d27
        RDX: dffffc0000000001 RSI: 1ffff1003b643e7a RDI: ffffe8ffffc26938
        RBP: ffff8801ce447530 R08: 1ffff1003b643e6c R09: ffffe8ffffc26964
        R10: 0000000000000002 R11: fffff91ffff84d2d R12: ffffe8ffffc1f890
        R13: ffffe8ffffc26930 R14: ffffffff85cad9e0 R15: 0000000000000000
        FS:  0000000002641880(0000) GS:ffff8801db200000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 000000000043e670 CR3: 00000001d1d7a000 CR4: 00000000001406f0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
          trace_block_getrq include/trace/events/block.h:423 [inline]
          __get_request block/blk-core.c:1283 [inline]
          get_request+0x1518/0x23b0 block/blk-core.c:1355
          blk_old_get_request block/blk-core.c:1402 [inline]
          blk_get_request+0x1d8/0x3c0 block/blk-core.c:1427
          sg_scsi_ioctl+0x117/0x750 block/scsi_ioctl.c:451
          sg_ioctl+0x192d/0x2ed0 drivers/scsi/sg.c:1070
          vfs_ioctl fs/ioctl.c:45 [inline]
          do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
          SYSC_ioctl fs/ioctl.c:700 [inline]
          SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
          entry_SYSCALL_64_fastpath+0x1f/0xbe
      
      block_get_rq::TP_fast_assign() has multiple redundant ->dev assignments.
      Only one of them is NULL tolerant.  Favor the NULL tolerant one.
      
      Fixes: 74d46992 ("block: replace bi_bdev with a gendisk pointer and partitions index")
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarGreg Thelen <gthelen@google.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      f8e9ec16
    • Linus Torvalds's avatar
      Revert "firmware: add sanity check on shutdown/suspend" · f007cad1
      Linus Torvalds authored
      This reverts commit 81f95076.
      
      It causes random failures of firmware loading at resume time (well,
      random for me, it seems to be more reliable for others) because the
      firmware disabling is not actually synchronous with any particular
      resume event, and at least the btusb driver that uses a workqueue to
      load the firmware at resume seems to occasionally hit the "firmware
      loading is disabled" logic because the firmware loader hasn't gotten the
      resume event yet.
      
      Some kind of sanity check for not trying to load firmware when it's not
      possible might be a good thing, but this commit was not it.
      
      Greg seems to have silently suffered the same issue, and pointed to the
      likely culprit, and Gabriel C verified the revert fixed it for him too.
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Pointed-at-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Tested-by: default avatarGabriel C <nix.or.die@gmail.com>
      Cc: Luis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f007cad1
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu · 64414e5f
      Linus Torvalds authored
      Pull m68knommu updates from Greg Ungerer:
       "Only two changes. One removes unused code, the other makes local clock
        code arguments consistent with generic clock code"
      
      * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
        m68knommu: remove dead code
        m68k: allow NULL clock for clk_get_rate
      64414e5f
    • Linus Torvalds's avatar
      Merge tag 'armsoc-devicetree' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · e90937e7
      Linus Torvalds authored
      Pull ARM/arm64 Devicetree updates from Olof Johansson:
       "As usual, device tree updates is the bulk of our material in this
        merge window. This time around, 559 patches affecting both 32- and
        64-bit platforms.
      
        Changes are too many to list individually, but some of the larger
        ones:
      
        New platform/SoC support:
      
         - Automotive:
           + Renesas R-Car D3 (R8A77995)
           + TI DT76x
           + MediaTek mt2712e
         - Communication-oriented:
           + Qualcomm IPQ8074
           + Broadcom Stingray
           + Marvell Armada 8080
         - Set top box:
           + Uniphier PXs3
      
        Besides some vendor reference boards for the SoC above, there are also
        several new boards/machines:
      
         - TI AM335x Moxa UC-8100-ME-T open platform
         - TI AM57xx Beaglebone X15 Rev C
         - Microchip/Atmel sama5d27 SoM1 EK
         - Broadcom Raspberry Pi Zero W
         - Gemini-based D-Link DIR-685 router
         - Freescale i.MX6:
           + Toradex Apalis module + Apalis and Ixora carrier boards
           + Engicam GEAM6UL Starter Kit
         - Freescale i.MX53-based Beckhoff CX9020 Embedded PC
         - Mediatek mt7623-based BananaPi R2
         - Several Allwinner-based single-board computers:
        + Cubietruck plus
        + Bananapi M3, M2M and M64
        + NanoPi A64
        + A64-OLinuXino
        + Pine64
         - Rockchip RK3328 Pine64/Rock64 board support
         - Rockchip RK3399 boards:
        + RK3399 Sapphire module on Excavator carrier (RK3399 reference design)
        + Theobroma Systems RK3399-Q7 SoM
         - ZTE ZX296718 PCBOX Board"
      
      * tag 'armsoc-devicetree' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (559 commits)
        ARM: dts: at91: at91sam9g45: add AC97
        arm64: dts: marvell: mcbin: enable more networking ports
        arm64: dts: marvell: add a reference to the sysctrl syscon in the ppv2 node
        arm64: dts: marvell: add TX interrupts for PPv2.2
        arm64: dts: uniphier: add PXs3 SoC support
        ARM: dts: uniphier: add pinctrl groups of ethernet phy mode
        ARM: dts: uniphier: fix size of sdctrl nodes
        ARM: dts: uniphier: add AIDET nodes
        arm64: dts: uniphier: fix size of sdctrl node
        arm64: dts: uniphier: add AIDET nodes
        Revert "ARM: dts: sun8i: h3: Enable dwmac-sun8i on the Beelink X2"
        arm64: dts: uniphier: add reset controller node of analog amplifier
        arm64: dts: marvell: add Device Tree files for Armada-8KP
        arm64: dts: rockchip: add Haikou baseboard with RK3399-Q7 SoM
        arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM
        dt-bindings: add rk3399-q7 SoM
        ARM: dts: rockchip: enable usb for rv1108-evb
        ARM: dts: rockchip: add usb nodes for rv1108 SoCs
        dt-bindings: update grf-binding for rv1108 SoCs
        ARM: dts: aspeed-g4: fix AHB window size of the SMC controllers
        ...
      e90937e7
    • Linus Torvalds's avatar
      Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · ae46654b
      Linus Torvalds authored
      Pull ARM SoC driver updates from Olof Johansson:
       "This branch contains platform-related driver updates for ARM and ARM64.
      
        Among them:
      
         - Reset driver updates:
           + New API for dealing with arrays of resets
           + Make unimplemented {de,}assert return success on shared resets
           + MSDKv1 driver
           + Removal of obsolete Gemini reset driver
           + Misc updates for sunxi and Uniphier
      
         - SoC drivers:
           + Platform SoC driver registration on Tegra
           + Shuffle of Qualcomm drivers into a submenu
           + Allwinner A64 support for SRAM
           + Renesas R-Car R3 support
           + Power domains for Rockchip RK3366
      
         - Misc updates and smaller fixes for TEE and memory driver
           subsystems"
      
      * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (54 commits)
        firmware: arm_scpi: fix endianness of dev_id in struct dev_pstate_set
        soc/tegra: fuse: Add missing semi-colon
        soc/tegra: Restrict SoC device registration to Tegra
        drivers: soc: sunxi: add support for A64 and its SRAM C
        drivers: soc: sunxi: add support for remapping func value to reg value
        drivers: soc: sunxi: fix error processing on base address when claiming
        dt-bindings: add binding for Allwinner A64 SRAM controller and SRAM C
        bus: sunxi-rsb: Enable by default for ARM64
        soc/tegra: Register SoC device
        firmware: tegra: set drvdata earlier
        memory: Convert to using %pOF instead of full_name
        soc: Convert to using %pOF instead of full_name
        bus: Convert to using %pOF instead of full_name
        firmware: Convert to using %pOF instead of full_name
        soc: mediatek: add SCPSYS power domain driver for MediaTek MT7622 SoC
        soc: mediatek: add header files required for MT7622 SCPSYS dt-binding
        soc: mediatek: reduce code duplication of scpsys_probe across all SoCs
        dt-bindings: soc: update the binding document for SCPSYS on MediaTek MT7622 SoC
        reset: uniphier: add analog amplifiers reset control
        reset: uniphier: add video input subsystem reset control
        ...
      ae46654b
    • Linus Torvalds's avatar
      Merge tag 'armsoc-platforms' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 7f1b9be1
      Linus Torvalds authored
      Pull ARM/arm64 SoC platform updates from Olof Johansson: "This branch
        contains platform updates for 32- and 64-bit ARM, including defconfig
        updates to enable new options, drivers and platforms. There are also a
        few fixes and cleanups for some existing vendors.
      
        Some of the things worth highlighting here are:
      
         - Enabling new crypt drivers on arm64 defconfig
      
         - QCOM IPQ8074 clocks and pinctrl drivers on arm64 defconfig
      
         - Debug support enabled for Renesas r8a7743
      
         - Various config updates for Renesas platforms (sound, USB, other
           drivers)
      
         - Platform support (including SMP) for TI dra762
      
         - OMAP cleanups: Move to use generic 8250 debug_ll, removal of stale
           DMA code"
      
      * tag 'armsoc-platforms' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (109 commits)
        ARM: multi_v7_defconfig: make eSDHC driver built-in
        arm64: defconfig: enable rockchip graphics
        MAINTAINERS: Update Cavium ThunderX2 entry
        ARM: config: aspeed: Add I2C, VUART, LPC Snoop
        ARM: configs: aspeed: Update Aspeed G4 with VMSPLIT_2G
        ARM: s3c24xx: Fix NAND ECC mode for mini2440 board
        ARM: davinci_all_defconfig: enable tinydrm and ST7586
        arm64: defconfig: Enable QCOM IPQ8074 clock and pinctrl
        ARM: defconfig: tegra: Enable ChipIdea UDC driver
        ARM: configs: Add Tegra I2S interfaces to multi_v7_defconfig
        ARM: tegra: Add Tegra I2S interfaces to defconfig
        ARM: tegra: Update default configuration for v4.13-rc1
        MAINTAINERS: update ARM/ZTE entry
        soc: versatile: remove unnecessary static in realview_soc_probe()
        ARM: Convert to using %pOF instead of full_name
        ARM: hisi: Fix typo in comment
        ARM: multi_v7_defconfig: add CONFIG_BRCMSTB_THERMAL
        arm64: defconfig: add CONFIG_BRCMSTB_THERMAL
        arm64: defconfig: add recently added crypto drivers as modules
        arm64: defconfig: enable CONFIG_UNIPHIER_WATCHDOG
        ...
      7f1b9be1
  2. 10 Sep, 2017 5 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next · d719518d
      Linus Torvalds authored
      Pull sparc updates from David Miller:
      
       1) Use register window state adjustment instructions when available,
          from Anthony Yznaga.
      
       2) Add VCC console concentrator driver, from Jag Raman.
      
       3) Add 16GB hugepage support, from Nitin Gupta.
      
       4) Support cpu 'poke' hypercall, from Vijay Kumar.
      
       5) Add M7/M8 optimized memcpy/memset/copy_{to,from}_user, from Babu
          Moger.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next: (33 commits)
        sparc64: Handle additional cases of no fault loads
        sparc64: speed up etrap/rtrap on NG2 and later processors
        sparc64: vcc: make ktermios const
        sparc: leon: grpci1: constify of_device_id
        sparc: leon: grpci2: constify of_device_id
        sparc64: vcc: Check for IS_ERR() instead of NULL
        sparc64: Cleanup hugepage table walk functions
        sparc64: Add 16GB hugepage support
        sparc64: Support huge PUD case in get_user_pages
        sparc64: vcc: Add install & cleanup TTY operations
        sparc64: vcc: Add break_ctl TTY operation
        sparc64: vcc: Add chars_in_buffer TTY operation
        sparc64: vcc: Add write & write_room TTY operations
        sparc64: vcc: Add hangup TTY operation
        sparc64: vcc: Add open & close TTY operations
        sparc64: vcc: Enable LDC event processing engine
        sparc64: vcc: Add RX & TX timer for delayed LDC operation
        sparc64: vcc: Create sysfs attribute group
        sparc64: vcc: Enable VCC port probe and removal
        sparc64: vcc: TTY driver initialization and cleanup
        ...
      d719518d
    • Geert Uytterhoeven's avatar
      m68k: Add braces to __pmd(x) initializer to kill compiler warning · 4c2b5e0f
      Geert Uytterhoeven authored
      With gcc 4.1.2:
      
          include/linux/swapops.h: In function ‘swp_entry_to_pmd’:
          include/linux/swapops.h:294: warning: missing braces around initializer
          include/linux/swapops.h:294: warning: (near initialization for ‘(anonymous).pmd’)
      
      Due to a GCC zero initializer bug (#53119), the standard "(pmd_t){ 0 }"
      initializer is not accepted by all GCC versions.
      In addition, on m68k pmd_t is an array instead of a single value, so we
      need "(pmd_t){ { 0 }, }" instead of "(pmd_t){ 0 }".
      
      Based on commit 9157259d ("mm: add pmd_t initializer __pmd() to
      work around a GCC bug.") for sparc32.
      
      Fixes: 616b8371 ("mm: thp: enable thp migration in generic path")
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4c2b5e0f
    • Andy Lutomirski's avatar
      x86/mm/64: Fix an incorrect warning with CONFIG_DEBUG_VM=y, !PCID · 7898f796
      Andy Lutomirski authored
      I've been staring at the word PCID too long.
      
      Fixes: f13c8e8c58ba ("x86/mm: Reinitialize TLB state on hotplug and resume")
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7898f796
    • Rob Gardner's avatar
      sparc64: Handle additional cases of no fault loads · b6fe1089
      Rob Gardner authored
      Load instructions using ASI_PNF or other no-fault ASIs should not
      cause a SIGSEGV or SIGBUS.
      
      A garden variety unmapped address follows the TSB miss path, and when
      no valid mapping is found in the process page tables, the miss handler
      checks to see if the access was via a no-fault ASI.  It then fixes up
      the target register with a zero, and skips the no-fault load
      instruction.
      
      But different paths are taken for data access exceptions and alignment
      traps, and these do not respect the no-fault ASI. We add checks in
      these paths for the no-fault ASI, and fix up the target register and
      TPC just like in the TSB miss case.
      Signed-off-by: default avatarRob Gardner <rob.gardner@oracle.com>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6fe1089
    • Anthony Yznaga's avatar
      sparc64: speed up etrap/rtrap on NG2 and later processors · a7159a87
      Anthony Yznaga authored
      For many sun4v processor types, reading or writing a privileged register
      has a latency of 40 to 70 cycles.  Use a combination of the low-latency
      allclean, otherw, normalw, and nop instructions in etrap and rtrap to
      replace 2 rdpr and 5 wrpr instructions and improve etrap/rtrap
      performance.  allclean, otherw, and normalw are available on NG2 and
      later processors.
      
      The average ticks to execute the flush windows trap ("ta 0x3") with and
      without this patch on select platforms:
      
       CPU            Not patched     Patched    % Latency Reduction
      
       NG2            1762            1558            -11.58
       NG4            3619            3204            -11.47
       M7             3015            2624            -12.97
       SPARC64-X      829             770              -7.12
      Signed-off-by: default avatarAnthony Yznaga <anthony.yznaga@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7159a87
  3. 09 Sep, 2017 24 commits
    • Linus Torvalds's avatar
      Merge tag 'iommu-updates-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 4dfc2788
      Linus Torvalds authored
      Pull IOMMU updates from Joerg Roedel:
       "Slightly more changes than usual this time:
      
         - KDump Kernel IOMMU take-over code for AMD IOMMU. The code now tries
           to preserve the mappings of the kernel so that master aborts for
           devices are avoided. Master aborts cause some devices to fail in
           the kdump kernel, so this code makes the dump more likely to
           succeed when AMD IOMMU is enabled.
      
         - common flush queue implementation for IOVA code users. The code is
           still optional, but AMD and Intel IOMMU drivers had their own
           implementation which is now unified.
      
         - finish support for iommu-groups. All drivers implement this feature
           now so that IOMMU core code can rely on it.
      
         - finish support for 'struct iommu_device' in iommu drivers. All
           drivers now use the interface.
      
         - new functions in the IOMMU-API for explicit IO/TLB flushing. This
           will help to reduce the number of IO/TLB flushes when IOMMU drivers
           support this interface.
      
         - support for mt2712 in the Mediatek IOMMU driver
      
         - new IOMMU driver for QCOM hardware
      
         - system PM support for ARM-SMMU
      
         - shutdown method for ARM-SMMU-v3
      
         - some constification patches
      
         - various other small improvements and fixes"
      
      * tag 'iommu-updates-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (87 commits)
        iommu/vt-d: Don't be too aggressive when clearing one context entry
        iommu: Introduce Interface for IOMMU TLB Flushing
        iommu/s390: Constify iommu_ops
        iommu/vt-d: Avoid calling virt_to_phys() on null pointer
        iommu/vt-d: IOMMU Page Request needs to check if address is canonical.
        arm/tegra: Call bus_set_iommu() after iommu_device_register()
        iommu/exynos: Constify iommu_ops
        iommu/ipmmu-vmsa: Make ipmmu_gather_ops const
        iommu/ipmmu-vmsa: Rereserving a free context before setting up a pagetable
        iommu/amd: Rename a few flush functions
        iommu/amd: Check if domain is NULL in get_domain() and return -EBUSY
        iommu/mediatek: Fix a build warning of BIT(32) in ARM
        iommu/mediatek: Fix a build fail of m4u_type
        iommu: qcom: annotate PM functions as __maybe_unused
        iommu/pamu: Fix PAMU boot crash
        memory: mtk-smi: Degrade SMI init to module_init
        iommu/mediatek: Enlarge the validate PA range for 4GB mode
        iommu/mediatek: Disable iommu clock when system suspend
        iommu/mediatek: Move pgtable allocation into domain_alloc
        iommu/mediatek: Merge 2 M4U HWs into one iommu domain
        ...
      4dfc2788
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20170904' of git://git.infradead.org/linux-mtd · a59e57da
      Linus Torvalds authored
      Pull MTD updates from Boris Brezillon:
       "General updates:
         - Constify pci_device_id in various drivers
         - Constify device_type
         - Remove pad control code from the Gemini driver
         - Use %pOF to print OF node full_name
         - Various fixes in the physmap_of driver
         - Remove unused vars in mtdswap
         - Check devm_kzalloc() return value in the spear_smi driver
         - Check clk_prepare_enable() return code in the st_spi_fsm driver
         - Create per MTD device debugfs enties
      
        NAND updates, from Boris Brezillon:
         - Fix memory leaks in the core
         - Remove unused NAND locking support
         - Rename nand.h into rawnand.h (preparing support for spi NANDs)
         - Use NAND_MAX_ID_LEN where appropriate
         - Fix support for 20nm Hynix chips
         - Fix support for Samsung and Hynix SLC NANDs
         - Various cleanup, improvements and fixes in the qcom driver
         - Fixes for bugs detected by various static code analysis tools
         - Fix mxc ooblayout definition
         - Add a new part_parsers to tmio and sharpsl platform data in order
           to define a custom list of partition parsers
         - Request the reset line in exclusive mode in the sunxi driver
         - Fix a build error in the orion-nand driver when compiled for ARMv4
         - Allow 64-bit mvebu platforms to select the PXA3XX driver
      
        SPI NOR updates, from Cyrille Pitchen and Marek Vasut:
         - add support to the JEDEC JESD216B specification (SFDP tables).
         - add support to the Intel Denverton SPI flash controller.
         - fix error recovery for Spansion/Cypress SPI NOR memories.
         - fix 4-byte address management for the Aspeed SPI controller.
         - add support to some Microchip SST26 memory parts
         - remove unneeded pinctrl header Write a message for tag:"
      
      * tag 'for-linus-20170904' of git://git.infradead.org/linux-mtd: (74 commits)
        mtd: nand: complain loudly when chip->bits_per_cell is not correctly initialized
        mtd: nand: make Samsung SLC NAND usable again
        mtd: nand: tmio: Register partitions using the parsers
        mfd: tmio: Add partition parsers platform data
        mtd: nand: sharpsl: Register partitions using the parsers
        mtd: nand: sharpsl: Add partition parsers platform data
        mtd: nand: qcom: Support for IPQ8074 QPIC NAND controller
        mtd: nand: qcom: support for IPQ4019 QPIC NAND controller
        dt-bindings: qcom_nandc: IPQ8074 QPIC NAND documentation
        dt-bindings: qcom_nandc: IPQ4019 QPIC NAND documentation
        dt-bindings: qcom_nandc: fix the ipq806x device tree example
        mtd: nand: qcom: support for different DEV_CMD register offsets
        mtd: nand: qcom: QPIC data descriptors handling
        mtd: nand: qcom: enable BAM or ADM mode
        mtd: nand: qcom: erased codeword detection configuration
        mtd: nand: qcom: support for read location registers
        mtd: nand: qcom: support for passing flags in DMA helper functions
        mtd: nand: qcom: add BAM DMA descriptor handling
        mtd: nand: qcom: allocate BAM transaction
        mtd: nand: qcom: DMA mapping support for register read buffer
        ...
      a59e57da
    • Linus Torvalds's avatar
      Merge tag 'for-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply · 0ce5c79f
      Linus Torvalds authored
      Pull power supply and reset changes from Sebastian Reichel:
       "New chip/feature support:
         - bq27xxx: support updating battery config from DT
         - bq24190: support loading battery charge info from DT
         - LTC2941: add LTC2942/LTC2944 support
         - max17042: add ACPI support
         - max1721x: new driver
      
        Misc:
         - Move bq27xxx w1 driver from w1 into power-supply subsystem
         - Introduce power_supply_set_input_current_limit_from_supplier
         - constify stuff
         - some minor fixes"
      
      * tag 'for-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (39 commits)
        power: supply: bq27xxx: enable writing capacity values for bq27421
        power: supply: bq24190_charger: Get input_current_limit from our supplier
        power: supply: bq24190_charger: Export 5V boost converter as regulator
        power: supply: bq24190_charger: Add power_supply_battery_info support
        power: supply: bq24190_charger: Add property system-minimum-microvolt
        power: supply: bq24190_charger: Enable devicetree config
        dt-bindings: power: supply: Add docs for TI BQ24190 battery charger
        power: supply: bq27xxx: Remove duplicate chip data arrays
        power: supply: bq27xxx: Enable data memory update for certain chips
        power: supply: bq27xxx: Add chip IDs for previously shadowed chips
        power: supply: bq27xxx: Create single chip data table
        power: supply: bq24190_charger: Add ti,bq24192i to devicetree table
        power: supply: bq24190_charger: Add input_current_limit property
        power: supply: Add power_supply_set_input_current_limit_from_supplier helper
        power: supply: max17042_battery: Fix compiler warning
        power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies()
        power: supply: make device_attribute const
        power: supply: max17042_battery: Fix ACPI interrupt issues
        power: supply: max17042_battery: Add support for ACPI enumeration
        power: supply: lp8788: Make several arrays static const * const
        ...
      0ce5c79f
    • Linus Torvalds's avatar
      Merge tag 'rpmsg-v4.14' of git://github.com/andersson/remoteproc · 7151202b
      Linus Torvalds authored
      Pull rpmsg updates from Bjorn Andersson:
       "This extends the Qualcomm GLINK implementation to support the
        additional features used for communicating with modem and DSP
        coprocessors in modern Qualcomm platforms.
      
        In addition to this there's support for placing virtio RPMSG buffers
        in non-System RAM"
      
      * tag 'rpmsg-v4.14' of git://github.com/andersson/remoteproc: (29 commits)
        rpmsg: glink: initialize ret to zero to ensure error status check is correct
        rpmsg: glink: fix null pointer dereference on a null intent
        dt-bindings: soc: qcom: Extend GLINK to cover SMEM
        remoteproc: qcom: adsp: Allow defining GLINK edge
        rpmsg: glink: Export symbols from common code
        rpmsg: glink: Release idr lock before returning on error
        rpmsg: glink: Handle remote rx done command
        rpmsg: glink: Request for intents when unavailable
        rpmsg: glink: Use the intents passed by remote
        rpmsg: glink: Receive and store the remote intent buffers
        rpmsg: glink: Add announce_create ops and preallocate intents
        rpmsg: glink: Add rx done command
        rpmsg: glink: Make RX FIFO peak accessor to take an offset
        rpmsg: glink: Use the local intents when receiving data
        rpmsg: glink: Add support for TX intents
        rpmsg: glink: Fix idr_lock from mutex to spinlock
        rpmsg: glink: Add support for transport version negotiation
        rpmsg: glink: Introduce glink smem based transport
        rpmsg: glink: Do a mbox_free_channel in remove
        rpmsg: glink: Return -EAGAIN when there is no FIFO space
        ...
      7151202b
    • Linus Torvalds's avatar
      Merge tag 'rproc-v4.14' of git://github.com/andersson/remoteproc · d7efc352
      Linus Torvalds authored
      Pull remoteproc updates from Bjorn Andersson:
       "This adds and improves remoteproc support for TI DA8xx/OMAP-L13x DSP,
        TI Keystone 66AK2G DSP and iMX6SX/7D Cortex M4 coprocessors. It
        introduces the Qualcomm restart notifier and a few fixes"
      
      * tag 'rproc-v4.14' of git://github.com/andersson/remoteproc:
        remoteproc: Introduce rproc handle accessor for children
        remoteproc: qcom: Make ssr_notifiers local
        remoteproc: Stop subdevices in reverse order
        remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver
        remoteproc: dt: Provide bindings for iMX6SX/7D Remote Processor Controller driver
        remoteproc: qcom: Use PTR_ERR_OR_ZERO
        remoteproc: st: explicitly request exclusive reset control
        remoteproc: qcom: explicitly request exclusive reset control
        remoteproc/keystone: explicitly request exclusive reset control
        remoteproc/keystone: Add support for Keystone 66AK2G SOCs
        remoteproc/davinci: Add device tree support for OMAP-L138 DSP
        dt-bindings: remoteproc: Add bindings for Davinci DSP processors
        remoteproc/davinci: Add support to parse internal memories
        remoteproc/davinci: Switch to platform_get_resource_byname()
        remoteproc: make device_type const
        soc: qcom: GLINK SSR notifier
        remoteproc: qcom: Add support for SSR notifications
        remoteproc: Merge __rproc_boot() with rproc_boot()
      d7efc352
    • Linus Torvalds's avatar
      Merge tag 'vfio-v4.14-rc1' of git://github.com/awilliam/linux-vfio · 8c1d70b2
      Linus Torvalds authored
      Pull VFIO updates from Alex Williamson:
      
       - Base MSI remapping on either IOMMU domain or IRQ domain support
         (Robin Murphy)
      
       - Prioritize hardware MSI regions over software defined regions (Robin
         Murphy)
      
       - Fix no-iommu reference counting (Eric Auger)
      
       - Stall removing last device from group for container cleanup (Alex
         Williamson)
      
       - Constify amba_id (Arvind Yadav)
      
      * tag 'vfio-v4.14-rc1' of git://github.com/awilliam/linux-vfio:
        vfio: platform: constify amba_id
        vfio: Stall vfio_del_group_dev() for container group detach
        vfio: fix noiommu vfio_iommu_group_get reference count
        vfio/type1: Give hardware MSI regions precedence
        vfio/type1: Cope with hardware MSI reserved regions
      8c1d70b2
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · d2d8f51e
      Linus Torvalds authored
      Pull i2c updates from Wolfram Sang:
      
       - new drivers for Spreadtrum I2C, Intel Cherry Trail Whiskey Cove SMBUS
      
       - quite some driver updates
      
       - cleanups for the i2c-mux subsystem
      
       - some subsystem-wide constification
      
       - further cleanup of include/linux/i2c
      
      * 'i2c/for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (50 commits)
        i2c: sprd: Fix undefined reference errors
        i2c: nomadik: constify amba_id
        i2c: versatile: Make i2c_algo_bit_data const
        i2c: busses: make i2c_adapter_quirks const
        i2c: busses: make i2c_adapter const
        i2c: busses: make i2c_algorithm const
        i2c: Add Spreadtrum I2C controller driver
        dt-bindings: i2c: Add Spreadtrum I2C controller documentation
        i2c-cht-wc: make cht_wc_i2c_adap_driver static
        MAINTAINERS: Add entry for drivers/i2c/busses/i2c-cht-wc.c
        i2c: aspeed: Retain delay/setup/hold values when configuring bus frequency
        dt-bindings: i2c: eeprom: Document vendor to be used and deprecated ones
        i2c: i801: Restore the presence state of P2SB PCI device after reading BAR
        MAINTAINERS: drop entry for Blackfin I2C and Sonic's email
        blackfin: merge the two TWI header files
        i2c: davinci: Preserve return value of devm_clk_get
        i2c: mediatek: Add i2c compatible for MediaTek MT7622
        dt-bindings: i2c: Add MediaTek MT7622 i2c binding
        dt-bindings: i2c: modify information formats
        i2c: mux: i2c-arb-gpio-challenge: allow compiling w/o OF support
        ...
      d2d8f51e
    • Linus Torvalds's avatar
      Merge tag 'nfsd-4.14' of git://linux-nfs.org/~bfields/linux · ad9a19d0
      Linus Torvalds authored
      Pull nfsd updates from Bruce Fields:
       "More RDMA work and some op-structure constification from Chuck Lever,
        and a small cleanup to our xdr encoding"
      
      * tag 'nfsd-4.14' of git://linux-nfs.org/~bfields/linux:
        svcrdma: Estimate Send Queue depth properly
        rdma core: Add rdma_rw_mr_payload()
        svcrdma: Limit RQ depth
        svcrdma: Populate tail iovec when receiving
        nfsd: Incoming xdr_bufs may have content in tail buffer
        svcrdma: Clean up svc_rdma_build_read_chunk()
        sunrpc: Const-ify struct sv_serv_ops
        nfsd: Const-ify NFSv4 encoding and decoding ops arrays
        sunrpc: Const-ify instances of struct svc_xprt_ops
        nfsd4: individual encoders no longer see error cases
        nfsd4: skip encoder in trivial error cases
        nfsd4: define ->op_release for compound ops
        nfsd4: opdesc will be useful outside nfs4proc.c
        nfsd4: move some nfsd4 op definitions to xdr4.h
      ad9a19d0
    • Linus Torvalds's avatar
      Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 66ba772e
      Linus Torvalds authored
      Pull btrfs updates from David Sterba:
       "The changes range through all types: cleanups, core chagnes, sanity
        checks, fixes, other user visible changes, detailed list below:
      
         - deprecated: user transaction ioctl
      
         - mount option ssd does not change allocation alignments
      
         - degraded read-write mount is allowed if all the raid profile
           constraints are met, now based on more accurate check
      
         - defrag: do not reset compression afterwards; the NOCOMPRESS flag
           can be now overriden by defrag
      
         - prep work for better extent reference tracking (related to the
           qgroup slowness with balance)
      
         - prep work for compression heuristics
      
         - memory allocation reductions (may help latencies on a loaded
           system)
      
         - better accounting for io waiting states
      
         - error handling improvements (removed BUGs)
      
         - added more sanity checks for shared refs
      
         - fix readdir vs pagefault deadlock under some circumstances
      
         - fix for 'no-hole' mode, certain combination of compressed and
           inline extents
      
         - send: fix emission of invalid clone operations
      
         - fixup file mode if setting acls fail
      
         - more fixes from fuzzing
      
         - oher cleanups"
      
      * 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (104 commits)
        btrfs: submit superblock io with REQ_META and REQ_PRIO
        btrfs: remove unnecessary memory barrier in btrfs_direct_IO
        btrfs: remove superfluous chunk_tree argument from btrfs_alloc_dev_extent
        btrfs: Remove chunk_objectid parameter of btrfs_alloc_dev_extent
        btrfs: pass fs_info to btrfs_del_root instead of tree_root
        Btrfs: add one more sanity check for shared ref type
        Btrfs: remove BUG_ON in __add_tree_block
        Btrfs: remove BUG() in add_data_reference
        Btrfs: remove BUG() in print_extent_item
        Btrfs: remove BUG() in btrfs_extent_inline_ref_size
        Btrfs: convert to use btrfs_get_extent_inline_ref_type
        Btrfs: add a helper to retrive extent inline ref type
        btrfs: scrub: simplify scrub worker initialization
        btrfs: scrub: clean up division in scrub_find_csum
        btrfs: scrub: clean up division in __scrub_mark_bitmap
        btrfs: scrub: use bool for flush_all_writes
        btrfs: preserve i_mode if __btrfs_set_acl() fails
        btrfs: Remove extraneous chunk_objectid variable
        btrfs: Remove chunk_objectid argument from btrfs_make_block_group
        btrfs: Remove extra parentheses from condition in copy_items()
        ...
      66ba772e
    • Linus Torvalds's avatar
      Merge branch 'for-4.14/block-postmerge' of git://git.kernel.dk/linux-block · 126e76ff
      Linus Torvalds authored
      Pull followup block layer updates from Jens Axboe:
       "I ended up splitting the main pull request for this series into two,
        mainly because of clashes between NVMe fixes that went into 4.13 after
        the for-4.14 branches were split off. This pull request is mostly
        NVMe, but not exclusively. In detail, it contains:
      
         - Two pull request for NVMe changes from Christoph. Nothing new on
           the feature front, basically just fixes all over the map for the
           core bits, transport, rdma, etc.
      
         - Series from Bart, cleaning up various bits in the BFQ scheduler.
      
         - Series of bcache fixes, which has been lingering for a release or
           two. Coly sent this in, but patches from various people in this
           area.
      
         - Set of patches for BFQ from Paolo himself, updating both
           documentation and fixing some corner cases in performance.
      
         - Series from Omar, attempting to now get the 4k loop support
           correct. Our confidence level is higher this time.
      
         - Series from Shaohua for loop as well, improving O_DIRECT
           performance and fixing a use-after-free"
      
      * 'for-4.14/block-postmerge' of git://git.kernel.dk/linux-block: (74 commits)
        bcache: initialize dirty stripes in flash_dev_run()
        loop: set physical block size to logical block size
        bcache: fix bch_hprint crash and improve output
        bcache: Update continue_at() documentation
        bcache: silence static checker warning
        bcache: fix for gc and write-back race
        bcache: increase the number of open buckets
        bcache: Correct return value for sysfs attach errors
        bcache: correct cache_dirty_target in __update_writeback_rate()
        bcache: gc does not work when triggering by manual command
        bcache: Don't reinvent the wheel but use existing llist API
        bcache: do not subtract sectors_to_gc for bypassed IO
        bcache: fix sequential large write IO bypass
        bcache: Fix leak of bdev reference
        block/loop: remove unused field
        block/loop: fix use after free
        bfq: Use icq_to_bic() consistently
        bfq: Suppress compiler warnings about comparisons
        bfq: Check kstrtoul() return value
        bfq: Declare local functions static
        ...
      126e76ff
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · fbd01410
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "The iwlwifi firmware compat fix is in here as well as some other
        stuff:
      
        1) Fix request socket leak introduced by BPF deadlock fix, from Eric
           Dumazet.
      
        2) Fix VLAN handling with TXQs in mac80211, from Johannes Berg.
      
        3) Missing __qdisc_drop conversions in prio and qfq schedulers, from
           Gao Feng.
      
        4) Use after free in netlink nlk groups handling, from Xin Long.
      
        5) Handle MTU update properly in ipv6 gre tunnels, from Xin Long.
      
        6) Fix leak of ipv6 fib tables on netns teardown, from Sabrina Dubroca
           with follow-on fix from Eric Dumazet.
      
        7) Need RCU and preemption disabled during generic XDP data patch,
           from John Fastabend"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (54 commits)
        bpf: make error reporting in bpf_warn_invalid_xdp_action more clear
        Revert "mdio_bus: Remove unneeded gpiod NULL check"
        bpf: devmap, use cond_resched instead of cpu_relax
        bpf: add support for sockmap detach programs
        net: rcu lock and preempt disable missing around generic xdp
        bpf: don't select potentially stale ri->map from buggy xdp progs
        net: tulip: Constify tulip_tbl
        net: ethernet: ti: netcp_core: no need in netif_napi_del
        davicom: Display proper debug level up to 6
        net: phy: sfp: rename dt properties to match the binding
        dt-binding: net: sfp binding documentation
        dt-bindings: add SFF vendor prefix
        dt-bindings: net: don't confuse with generic PHY property
        ip6_tunnel: fix setting hop_limit value for ipv6 tunnel
        ip_tunnel: fix setting ttl and tos value in collect_md mode
        ipv6: fix typo in fib6_net_exit()
        tcp: fix a request socket leak
        sctp: fix missing wake ups in some situations
        netfilter: xt_hashlimit: fix build error caused by 64bit division
        netfilter: xt_hashlimit: alloc hashtable with right size
        ...
      fbd01410
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · fbf4432f
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
      
       - most of the rest of MM
      
       - a small number of misc things
      
       - lib/ updates
      
       - checkpatch
      
       - autofs updates
      
       - ipc/ updates
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (126 commits)
        ipc: optimize semget/shmget/msgget for lots of keys
        ipc/sem: play nicer with large nsops allocations
        ipc/sem: drop sem_checkid helper
        ipc: convert kern_ipc_perm.refcount from atomic_t to refcount_t
        ipc: convert sem_undo_list.refcnt from atomic_t to refcount_t
        ipc: convert ipc_namespace.count from atomic_t to refcount_t
        kcov: support compat processes
        sh: defconfig: cleanup from old Kconfig options
        mn10300: defconfig: cleanup from old Kconfig options
        m32r: defconfig: cleanup from old Kconfig options
        drivers/pps: use surrounding "if PPS" to remove numerous dependency checks
        drivers/pps: aesthetic tweaks to PPS-related content
        cpumask: make cpumask_next() out-of-line
        kmod: move #ifdef CONFIG_MODULES wrapper to Makefile
        kmod: split off umh headers into its own file
        MAINTAINERS: clarify kmod is just a kernel module loader
        kmod: split out umh code into its own file
        test_kmod: flip INT checks to be consistent
        test_kmod: remove paranoid UINT_MAX check on uint range processing
        vfat: deduplicate hex2bin()
        ...
      fbf4432f
    • Linus Torvalds's avatar
      remove gperf left-overs from build system · c054be10
      Linus Torvalds authored
      I removed all the gperf use, but not the Makefile rules.  Sam Ravnborg
      says I get bonus points for cleaning this up.  I'll hold him to it.
      Requested-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c054be10
    • Daniel Borkmann's avatar
      bpf: make error reporting in bpf_warn_invalid_xdp_action more clear · 9beb8bed
      Daniel Borkmann authored
      Differ between illegal XDP action code and just driver
      unsupported one to provide better feedback when we throw
      a one-time warning here. Reason is that with 814abfab
      ("xdp: add bpf_redirect helper function") not all drivers
      support the new XDP return code yet and thus they will
      fall into their 'default' case when checking for return
      codes after program return, which then triggers a
      bpf_warn_invalid_xdp_action() stating that the return
      code is illegal, but from XDP perspective it's not.
      
      I decided not to place something like a XDP_ACT_MAX define
      into uapi i) given we don't have this either for all other
      program types, ii) future action codes could have further
      encoding there, which would render such define unsuitable
      and we wouldn't be able to rip it out again, and iii) we
      rarely add new action codes.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9beb8bed
    • Florian Fainelli's avatar
      Revert "mdio_bus: Remove unneeded gpiod NULL check" · a010a2f6
      Florian Fainelli authored
      This reverts commit 95b80bf3 ("mdio_bus:
      Remove unneeded gpiod NULL check"), this commit assumed that GPIOLIB
      checks for NULL descriptors, so it's safe to drop them, but it is not
      when CONFIG_GPIOLIB is disabled in the kernel. If we do call
      gpiod_set_value_cansleep() on a GPIO descriptor we will issue warnings
      coming from the inline stubs declared in include/linux/gpio/consumer.h.
      
      Fixes: 95b80bf3 ("mdio_bus: Remove unneeded gpiod NULL check")
      Reported-by: default avatarWoojung Huh <Woojung.Huh@microchip.com>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a010a2f6
    • David S. Miller's avatar
      Merge branch 'xdp-bpf-fixes' · a7bc5774
      David S. Miller authored
      John Fastabend says:
      
      ====================
      net: Fixes for XDP/BPF
      
      The following fixes, UAPI updates, and small improvement,
      
      i. XDP needs to be called inside RCU with preempt disabled.
      
      ii. Not strictly a bug fix but we have an attach command in the
      sockmap UAPI already to avoid having a single kernel released with
      only the attach and not the detach I'm pushing this into net branch.
      Its early in the RC cycle so I think this is OK (not ideal but better
      than supporting a UAPI with a missing detach forever).
      
      iii. Final patch replace cpu_relax with cond_resched in devmap.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7bc5774
    • John Fastabend's avatar
      bpf: devmap, use cond_resched instead of cpu_relax · 374fb014
      John Fastabend authored
      Be a bit more friendly about waiting for flush bits to complete.
      Replace the cpu_relax() with a cond_resched().
      Suggested-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      374fb014
    • John Fastabend's avatar
      bpf: add support for sockmap detach programs · 5a67da2a
      John Fastabend authored
      The bpf map sockmap supports adding programs via attach commands. This
      patch adds the detach command to keep the API symmetric and allow
      users to remove previously added programs. Otherwise the user would
      have to delete the map and re-add it to get in this state.
      
      This also adds a series of additional tests to capture detach operation
      and also attaching/detaching invalid prog types.
      
      API note: socks will run (or not run) programs depending on the state
      of the map at the time the sock is added. We do not for example walk
      the map and remove programs from previously attached socks.
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a67da2a
    • John Fastabend's avatar
      net: rcu lock and preempt disable missing around generic xdp · bbbe211c
      John Fastabend authored
      do_xdp_generic must be called inside rcu critical section with preempt
      disabled to ensure BPF programs are valid and per-cpu variables used
      for redirect operations are consistent. This patch ensures this is true
      and fixes the splat below.
      
      The netif_receive_skb_internal() code path is now broken into two rcu
      critical sections. I decided it was better to limit the preempt_enable/disable
      block to just the xdp static key portion and the fallout is more
      rcu_read_lock/unlock calls. Seems like the best option to me.
      
      [  607.596901] =============================
      [  607.596906] WARNING: suspicious RCU usage
      [  607.596912] 4.13.0-rc4+ #570 Not tainted
      [  607.596917] -----------------------------
      [  607.596923] net/core/dev.c:3948 suspicious rcu_dereference_check() usage!
      [  607.596927]
      [  607.596927] other info that might help us debug this:
      [  607.596927]
      [  607.596933]
      [  607.596933] rcu_scheduler_active = 2, debug_locks = 1
      [  607.596938] 2 locks held by pool/14624:
      [  607.596943]  #0:  (rcu_read_lock_bh){......}, at: [<ffffffff95445ffd>] ip_finish_output2+0x14d/0x890
      [  607.596973]  #1:  (rcu_read_lock_bh){......}, at: [<ffffffff953c8e3a>] __dev_queue_xmit+0x14a/0xfd0
      [  607.597000]
      [  607.597000] stack backtrace:
      [  607.597006] CPU: 5 PID: 14624 Comm: pool Not tainted 4.13.0-rc4+ #570
      [  607.597011] Hardware name: Dell Inc. Precision Tower 5810/0HHV7N, BIOS A17 03/01/2017
      [  607.597016] Call Trace:
      [  607.597027]  dump_stack+0x67/0x92
      [  607.597040]  lockdep_rcu_suspicious+0xdd/0x110
      [  607.597054]  do_xdp_generic+0x313/0xa50
      [  607.597068]  ? time_hardirqs_on+0x5b/0x150
      [  607.597076]  ? mark_held_locks+0x6b/0xc0
      [  607.597088]  ? netdev_pick_tx+0x150/0x150
      [  607.597117]  netif_rx_internal+0x205/0x3f0
      [  607.597127]  ? do_xdp_generic+0xa50/0xa50
      [  607.597144]  ? lock_downgrade+0x2b0/0x2b0
      [  607.597158]  ? __lock_is_held+0x93/0x100
      [  607.597187]  netif_rx+0x119/0x190
      [  607.597202]  loopback_xmit+0xfd/0x1b0
      [  607.597214]  dev_hard_start_xmit+0x127/0x4e0
      
      Fixes: d4455169 ("net: xdp: support xdp generic on virtual devices")
      Fixes: b5cdae32 ("net: Generic XDP")
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bbbe211c
    • Daniel Borkmann's avatar
      bpf: don't select potentially stale ri->map from buggy xdp progs · 109980b8
      Daniel Borkmann authored
      We can potentially run into a couple of issues with the XDP
      bpf_redirect_map() helper. The ri->map in the per CPU storage
      can become stale in several ways, mostly due to misuse, where
      we can then trigger a use after free on the map:
      
      i) prog A is calling bpf_redirect_map(), returning XDP_REDIRECT
      and running on a driver not supporting XDP_REDIRECT yet. The
      ri->map on that CPU becomes stale when the XDP program is unloaded
      on the driver, and a prog B loaded on a different driver which
      supports XDP_REDIRECT return code. prog B would have to omit
      calling to bpf_redirect_map() and just return XDP_REDIRECT, which
      would then access the freed map in xdp_do_redirect() since not
      cleared for that CPU.
      
      ii) prog A is calling bpf_redirect_map(), returning a code other
      than XDP_REDIRECT. prog A is then detached, which triggers release
      of the map. prog B is attached which, similarly as in i), would
      just return XDP_REDIRECT without having called bpf_redirect_map()
      and thus be accessing the freed map in xdp_do_redirect() since
      not cleared for that CPU.
      
      iii) prog A is attached to generic XDP, calling the bpf_redirect_map()
      helper and returning XDP_REDIRECT. xdp_do_generic_redirect() is
      currently not handling ri->map (will be fixed by Jesper), so it's
      not being reset. Later loading a e.g. native prog B which would,
      say, call bpf_xdp_redirect() and then returns XDP_REDIRECT would
      find in xdp_do_redirect() that a map was set and uses that causing
      use after free on map access.
      
      Fix thus needs to avoid accessing stale ri->map pointers, naive
      way would be to call a BPF function from drivers that just resets
      it to NULL for all XDP return codes but XDP_REDIRECT and including
      XDP_REDIRECT for drivers not supporting it yet (and let ri->map
      being handled in xdp_do_generic_redirect()). There is a less
      intrusive way w/o letting drivers call a reset for each BPF run.
      
      The verifier knows we're calling into bpf_xdp_redirect_map()
      helper, so it can do a small insn rewrite transparent to the prog
      itself in the sense that it fills R4 with a pointer to the own
      bpf_prog. We have that pointer at verification time anyway and
      R4 is allowed to be used as per calling convention we scratch
      R0 to R5 anyway, so they become inaccessible and program cannot
      read them prior to a write. Then, the helper would store the prog
      pointer in the current CPUs struct redirect_info. Later in
      xdp_do_*_redirect() we check whether the redirect_info's prog
      pointer is the same as passed xdp_prog pointer, and if that's
      the case then all good, since the prog holds a ref on the map
      anyway, so it is always valid at that point in time and must
      have a reference count of at least 1. If in the unlikely case
      they are not equal, it means we got a stale pointer, so we clear
      and bail out right there. Also do reset map and the owning prog
      in bpf_xdp_redirect(), so that bpf_xdp_redirect_map() and
      bpf_xdp_redirect() won't get mixed up, only the last call should
      take precedence. A tc bpf_redirect() doesn't use map anywhere
      yet, so no need to clear it there since never accessed in that
      layer.
      
      Note that in case the prog is released, and thus the map as
      well we're still under RCU read critical section at that time
      and have preemption disabled as well. Once we commit with the
      __dev_map_insert_ctx() from xdp_do_redirect_map() and set the
      map to ri->map_to_flush, we still wait for a xdp_do_flush_map()
      to finish in devmap dismantle time once flush_needed bit is set,
      so that is fine.
      
      Fixes: 97f91a7c ("bpf: add bpf_redirect_map helper routine")
      Reported-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      109980b8
    • Kees Cook's avatar
      net: tulip: Constify tulip_tbl · 9a486c9d
      Kees Cook authored
      It looks like all users of tulip_tbl are reads, so mark this table
      as read-only.
      
      $ git grep tulip_tbl  # edited to avoid line-wraps...
      interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ...
      interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs&~RxPollInt, ...
      interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ...
      interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs | TimerInt,
      pnic.c:      iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7);
      tulip.h:     extern struct tulip_chip_table tulip_tbl[];
      tulip_core.c:struct tulip_chip_table tulip_tbl[] = {
      tulip_core.c:iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR5);
      tulip_core.c:iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7);
      tulip_core.c:setup_timer(&tp->timer, tulip_tbl[tp->chip_id].media_timer,
      tulip_core.c:const char *chip_name = tulip_tbl[chip_idx].chip_name;
      tulip_core.c:if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size)
      tulip_core.c:ioaddr =  pci_iomap(..., tulip_tbl[chip_idx].io_size);
      tulip_core.c:tp->flags = tulip_tbl[chip_idx].flags;
      tulip_core.c:setup_timer(&tp->timer, tulip_tbl[tp->chip_id].media_timer,
      tulip_core.c:INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task);
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jarod Wilson <jarod@redhat.com>
      Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-parisc@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9a486c9d
    • Ivan Khoronzhuk's avatar
      net: ethernet: ti: netcp_core: no need in netif_napi_del · e333ac1f
      Ivan Khoronzhuk authored
      Don't remove rx_napi specifically just before free_netdev(),
      it's supposed to be done in it and is confusing w/o tx_napi deletion.
      Signed-off-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e333ac1f
    • Mathieu Malaterre's avatar
      davicom: Display proper debug level up to 6 · 0fdbedc7
      Mathieu Malaterre authored
      This will make it explicit some messages are of the form:
      dm9000_dbg(db, 5, ...
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0fdbedc7
    • Baruch Siach's avatar
      net: phy: sfp: rename dt properties to match the binding · 25ee0793
      Baruch Siach authored
      Make the Rx rate select control gpio property name match the documented
      binding. This would make the addition of 'rate-select1-gpios' for SFP+
      support more natural.
      
      Also, make the MOD-DEF0 gpio property name match the documentation.
      Signed-off-by: default avatarBaruch Siach <baruch@tkos.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      25ee0793