Skip to content
  1. Oct 14, 2017
    • Johannes Weiner's avatar
      tty: fall back to N_NULL if switching to N_TTY fails during hangup · e65c62b1
      Johannes Weiner authored
      We have seen NULL-pointer dereference crashes in tty->disc_data when the
      N_TTY fallback driver failed to open during hangup.  The immediate cause
      of this open to fail has been addressed in the preceding patch to
      vmalloc(), but this code could be more robust.
      
      As Alan pointed out in commit 8a8dabf2
      
       ("tty: handle the case where
      we cannot restore a line discipline"), the N_TTY driver, historically
      the safe fallback that could never fail, can indeed fail, but the
      surrounding code is not prepared to handle this.  To avoid crashes he
      added a new N_NULL driver to take N_TTY's place as the last resort.
      
      Hook that fallback up to the hangup path.  Update tty_ldisc_reinit() to
      reflect the reality that n_tty_open can indeed fail.
      
      Link: http://lkml.kernel.org/r/20171004185959.GC2136@cmpxchg.org
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Alan Cox <alan@llwyncelyn.cymru>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e65c62b1
    • Johannes Weiner's avatar
      Revert "vmalloc: back off when the current task is killed" · b8c8a338
      Johannes Weiner authored
      This reverts commits 5d17a73a ("vmalloc: back off when the current
      task is killed") and 171012f5 ("mm: don't warn when vmalloc() fails
      due to a fatal signal").
      
      Commit 5d17a73a ("vmalloc: back off when the current task is
      killed") made all vmalloc allocations from a signal-killed task fail.
      We have seen crashes in the tty driver from this, where a killed task
      exiting tries to switch back to N_TTY, fails n_tty_open because of the
      vmalloc failing, and later crashes when dereferencing tty->disc_data.
      
      Arguably, relying on a vmalloc() call to succeed in order to properly
      exit a task is not the most robust way of doing things.  There will be a
      follow-up patch to the tty code to fall back to the N_NULL ldisc.
      
      But the justification to make that vmalloc() call fail like this isn't
      convincing, either.  The patch mentions an OOM victim exhausting the
      memory reserves and thus deadlocking the machine.  But the OOM killer is
      only one, improbable source of fatal signals.  It doesn't make sense to
      fail allocations preemptively with plenty of memory in most cases.
      
      The patch doesn't mention real-life instances where vmalloc sites would
      exhaust memory, which makes it sound more like a theoretical issue to
      begin with.  But just in case, the OOM access to memory reserves has
      been restricted on the allocator side in cd04ae1e ("mm, oom: do not
      rely on TIF_MEMDIE for memory reserves access"), which should take care
      of any theoretical concerns on that front.
      
      Revert this patch, and the follow-up that suppresses the allocation
      warnings when we fail the allocations due to a signal.
      
      Link: http://lkml.kernel.org/r/20171004185906.GB2136@cmpxchg.org
      Fixes:  171012f5
      
       ("mm: don't warn when vmalloc() fails due to a fatal signal")
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Alan Cox <alan@llwyncelyn.cymru>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b8c8a338
    • Boris Brezillon's avatar
      mm/cma.c: take __GFP_NOWARN into account in cma_alloc() · ef465014
      Boris Brezillon authored
      
      
      cma_alloc() unconditionally prints an INFO message when the CMA
      allocation fails.  Make this message conditional on the non-presence of
      __GFP_NOWARN in gfp_mask.
      
      This patch aims at removing INFO messages that are displayed when the
      VC4 driver tries to allocate buffer objects.  From the driver
      perspective an allocation failure is acceptable, and the driver can
      possibly do something to make following allocation succeed (like
      flushing the VC4 internal cache).
      
      Link: http://lkml.kernel.org/r/20171004125447.15195-1-boris.brezillon@free-electrons.com
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
      Acked-by: default avatarLaura Abbott <labbott@redhat.com>
      Cc: Jaewon Kim <jaewon31.kim@samsung.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ef465014
    • Guenter Roeck's avatar
      scripts/kallsyms.c: ignore symbol type 'n' · 51962a9d
      Guenter Roeck authored
      
      
      gcc on aarch64 may emit synbols of type 'n' if the kernel is built with
      '-frecord-gcc-switches'.  In most cases, those symbols are reported with
      nm as
      
      	000000000000000e n $d
      
      and with objdump as
      
      	0000000000000000 l    d  .GCC.command.line	0000000000000000 .GCC.command.line
      	000000000000000e l       .GCC.command.line	0000000000000000 $d
      
      Those symbols are detected in is_arm_mapping_symbol() and ignored.
      However, if "--prefix-symbols=<prefix>" is configured as well, the
      situation is different.  For example, in efi/libstub, arm64 images are
      built with
      
      	'--prefix-alloc-sections=.init --prefix-symbols=__efistub_'.
      
      In combination with '-frecord-gcc-switches', the symbols are now reported
      by nm as:
      
      	000000000000000e n __efistub_$d
      and by objdump as:
      	0000000000000000 l    d  .GCC.command.line	0000000000000000 .GCC.command.line
      	000000000000000e l       .GCC.command.line	0000000000000000 __efistub_$d
      
      Those symbols are no longer ignored and included in the base address
      calculation.  This results in a base address of 000000000000000e, which
      in turn causes kallsyms to abort with
      
          kallsyms failure:
      	relative symbol value 0xffffff900800a000 out of range in relative mode
      
      The problem is seen in little endian arm64 builds with CONFIG_EFI
      enabled and with '-frecord-gcc-switches' set in KCFLAGS.
      
      Explicitly ignore symbols of type 'n' since those are clearly debug
      symbols.
      
      Link: http://lkml.kernel.org/r/1507136063-3139-1-git-send-email-linux@roeck-us.net
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      51962a9d
    • Andrea Arcangeli's avatar
      userfaultfd: selftest: exercise -EEXIST only in background transfer · 7ddd8faf
      Andrea Arcangeli authored
      
      
      I was stress testing some backports and with high load, after some time,
      the latest version of the selftest showed some false positive in
      connection with the uffdio_copy_retry.  This seems to fix it while still
      exercising -EEXIST in the background transfer once in a while.
      
      The fork child will quit after the last UFFDIO_COPY is run, so a
      repeated UFFDIO_COPY may not return -EEXIST.  This change restricts the
      -EEXIST stress to the background transfer where the memory can't go away
      from under it.
      
      Also updated uffdio_zeropage, so the interface is consistent.
      
      Link: http://lkml.kernel.org/r/20171004171541.1495-2-aarcange@redhat.com
      Signed-off-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Cc: Pavel Emelyanov <xemul@virtuozzo.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7ddd8faf
    • Zhen Lei's avatar
      mm: only display online cpus of the numa node · 064f0e93
      Zhen Lei authored
      
      
      When I execute numactl -H (which reads /sys/devices/system/node/nodeX/cpumap
      and displays cpumask_of_node for each node), I get different result
      on X86 and arm64.  For each numa node, the former only displayed online
      CPUs, and the latter displayed all possible CPUs.  Unfortunately, both
      Linux documentation and numactl manual have not described it clear.
      
      I sent a mail to ask for help, and Michal Hocko replied that he
      preferred to print online cpus because it doesn't really make much sense
      to bind anything on offline nodes.
      
      Will said:
       "I suspect the vast majority (if not all) code that reads this file was
        developed for x86, so having the same behaviour for arm64 sounds like
        something we should do ASAP before people try to special case with
        things like #ifdef __aarch64__. I'd rather have this in 4.14 if
        possible."
      
      Link: http://lkml.kernel.org/r/1506678805-15392-2-git-send-email-thunder.leizhen@huawei.com
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Tianhong Ding <dingtianhong@huawei.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Libin <huawei.libin@huawei.com>
      Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      064f0e93
    • Zi Yan's avatar
      mm: remove unnecessary WARN_ONCE in page_vma_mapped_walk(). · af0db981
      Zi Yan authored
      A non present pmd entry can appear after pmd_lock is taken in
      page_vma_mapped_walk(), even if THP migration is not enabled.  The
      WARN_ONCE is unnecessary.
      
      Link: http://lkml.kernel.org/r/20171003142606.12324-1-zi.yan@sent.com
      Fixes: 616b8371
      
       ("mm: thp: enable thp migration in generic path")
      Signed-off-by: default avatarZi Yan <zi.yan@cs.rutgers.edu>
      Reported-by: default avatarAbdul Haleem <abdhalee@linux.vnet.ibm.com>
      Tested-by: default avatarAbdul Haleem <abdhalee@linux.vnet.ibm.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      af0db981
    • Andrey Ryabinin's avatar
      mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter · de55c8b2
      Andrey Ryabinin authored
      Commit 3a321d2a ("mm: change the call sites of numa statistics
      items") separated NUMA counters from zone counters, but the
      NUMA_INTERLEAVE_HIT call site wasn't updated to use the new interface.
      So alloc_page_interleave() actually increments NR_ZONE_INACTIVE_FILE
      instead of NUMA_INTERLEAVE_HIT.
      
      Fix this by using __inc_numa_state() interface to increment
      NUMA_INTERLEAVE_HIT.
      
      Link: http://lkml.kernel.org/r/20171003191003.8573-1-aryabinin@virtuozzo.com
      Fixes: 3a321d2a
      
       ("mm: change the call sites of numa statistics items")
      Signed-off-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Acked-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Cc: Kemi Wang <kemi.wang@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      de55c8b2
    • Arnd Bergmann's avatar
      include/linux/of.h: provide of_n_{addr,size}_cells wrappers for !CONFIG_OF · 8a1ac5dc
      Arnd Bergmann authored
      The pci-rcar driver is enabled for compile tests, and this has shown that
      the driver cannot build without CONFIG_OF, following the inclusion of
      commit f8f2fe73 ("PCI: rcar: Use new OF interrupt mapping when possible"):
      
        drivers/pci/host/pcie-rcar.c: In function 'pci_dma_range_parser_init':
        drivers/pci/host/pcie-rcar.c:1039:2: error: implicit declaration of function 'of_n_addr_cells' [-Werror=implicit-function-declaration]
          parser->pna = of_n_addr_cells(node);
          ^
      
      As pointed out by Ben Dooks and Geert Uytterhoeven, this is actually
      supposed to build fine, which we can achieve if we make the declaration
      of of_irq_parse_and_map_pci conditional on CONFIG_OF and provide an
      empty inline function otherwise, as we do for a lot of other of
      interfaces.
      
      This lets us build the rcar_pci driver again without CONFIG_OF for build
      testing.  All platforms using this driver select OF, so this doesn't
      change anything for the users.
      
      [akpm@linux-foundation.org: be consistent with surrounding code]
      Link: http://lkml.kernel.org/r/20170911200805.3363318-1-arnd@arndb.de
      Fixes: c25da477
      
       ("PCI: rcar: Add Renesas R-Car PCIe driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Acked-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Magnus Damm <damm@opensource.se>
      Cc: Ben Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8a1ac5dc
    • Yang Shi's avatar
      mm/madvise.c: add description for MADV_WIPEONFORK and MADV_KEEPONFORK · c02c3009
      Yang Shi authored
      
      
      mm/madvise.c has a brief description about all MADV_ flags.  Add a
      description for the newly added MADV_WIPEONFORK and MADV_KEEPONFORK.
      
      Although man page has the similar information, but it'd better to keep
      the consistent with other flags.
      
      Link: http://lkml.kernel.org/r/1506117328-88228-1-git-send-email-yang.s@alibaba-inc.com
      Signed-off-by: default avatarYang Shi <yang.s@alibaba-inc.com>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c02c3009
    • Randy Dunlap's avatar
      lib/Kconfig.debug: kernel hacking menu: runtime testing: keep tests together · cc3fa840
      Randy Dunlap authored
      
      
      Expand the "Runtime testing" menu by including more entries inside it
      instead of after it.  This is just Kconfig symbol movement.
      
      This causes the (arch-independent) Runtime tests to be presented
      (listed) all in one place instead of in multiple places.
      
      Link: http://lkml.kernel.org/r/c194e5c4-2042-bf94-a2d8-7aa13756e257@infradead.org
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cc3fa840
    • Mark Hairgrove's avatar
      mm/migrate: fix indexing bug (off by one) and avoid out of bound access · e20d103b
      Mark Hairgrove authored
      Index was incremented before last use and thus the second array could
      dereference to an invalid address (not mentioning the fact that it did
      not properly clear the entry we intended to clear).
      
      Link: http://lkml.kernel.org/r/1506973525-16491-1-git-send-email-jglisse@redhat.com
      Fixes: 8315ada7
      
       ("mm/migrate: allow migrate_vma() to alloc new page on empty entry")
      Signed-off-by: default avatarMark Hairgrove <mhairgrove@nvidia.com>
      Signed-off-by: default avatarJérôme Glisse <jglisse@redhat.com>
      Cc: Reza Arbab <arbab@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e20d103b
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 997301a8
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
      
       - keep an important data structure in the Exynos driver around after
         kernel-init to fix a kernel-oops
      
       - keep SWIOTLB enabled when SME is active in the AMD IOMMU driver
      
       - add a missing IOTLB sync to the AMD IOMMU driver
      
      * tag 'iommu-fixes-v4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/amd: Finish TLB flush in amd_iommu_unmap()
        iommu/exynos: Remove initconst attribute to avoid potential kernel oops
        iommu/amd: Do not disable SWIOTLB if SME is active
      997301a8
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 0c080cee
      Linus Torvalds authored
      Pull DeviceTree fixes from Rob Herring:
      
       - Fix memory leak in error case of of_console_check
      
       - Increase number of reserved memory regions to 32. 16 was not enough
         on some Power systems.
      
       - Fix OF node refcounting for of_fwnode_graph_get_port_parent
      
      * tag 'devicetree-fixes-for-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        device property: preserve usecount for node passed to of_fwnode_graph_get_port_parent()
        drivers: of: increase MAX_RESERVED_REGIONS to 32
        of: do not leak console options
      0c080cee
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.14-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · e18e8844
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "A fix for a bad bug (written by me) in our livepatch handler. Removal
        of an over-zealous lockdep_assert_cpus_held() in our topology code. A
        fix to the recently added emulation of cntlz[wd]. And three small
        fixes to the recently added IMC PMU driver.
      
        Thanks to: Anju T Sudhakar, Balbir Singh, Kamalesh Babulal, Naveen N.
        Rao, Sandipan Das, Santosh Sivaraj, Thiago Jung Bauermann"
      
      * tag 'powerpc-4.14-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/perf: Fix IMC initialization crash
        powerpc/perf: Add ___GFP_NOWARN flag to alloc_pages_node()
        powerpc/perf: Fix for core/nest imc call trace on cpuhotplug
        powerpc: Don't call lockdep_assert_cpus_held() from arch_update_cpu_topology()
        powerpc/lib/sstep: Fix count leading zeros instructions
        powerpc/livepatch: Fix livepatch stack access
      e18e8844
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.14c-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 3be5f884
      Linus Torvalds authored
      Pull xen fixlet from Juergen Gross:
       "A minor fix correcting the cpu hotplug name for Xen guests"
      
      * tag 'for-linus-4.14c-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/vcpu: Use a unified name about cpu hotplug state for pv and pvhvm
      3be5f884
  2. Oct 13, 2017
    • Joerg Roedel's avatar
      iommu/amd: Finish TLB flush in amd_iommu_unmap() · ce76353f
      Joerg Roedel authored
      The function only sends the flush command to the IOMMU(s),
      but does not wait for its completion when it returns. Fix
      that.
      
      Fixes: 601367d7
      
       ('x86/amd-iommu: Remove iommu_flush_domain function')
      Cc: stable@vger.kernel.org # >= 2.6.33
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      ce76353f
    • Anju T Sudhakar's avatar
      powerpc/perf: Fix IMC initialization crash · 0d8ba162
      Anju T Sudhakar authored
      
      
      Panic observed with latest firmware, and upstream kernel:
      
       NIP init_imc_pmu+0x8c/0xcf0
       LR  init_imc_pmu+0x2f8/0xcf0
       Call Trace:
         init_imc_pmu+0x2c8/0xcf0 (unreliable)
         opal_imc_counters_probe+0x300/0x400
         platform_drv_probe+0x64/0x110
         driver_probe_device+0x3d8/0x580
         __driver_attach+0x14c/0x1a0
         bus_for_each_dev+0x8c/0xf0
         driver_attach+0x34/0x50
         bus_add_driver+0x298/0x350
         driver_register+0x9c/0x180
         __platform_driver_register+0x5c/0x70
         opal_imc_driver_init+0x2c/0x40
         do_one_initcall+0x64/0x1d0
         kernel_init_freeable+0x280/0x374
         kernel_init+0x24/0x160
         ret_from_kernel_thread+0x5c/0x74
      
      While registering nest imc at init, cpu-hotplug callback
      nest_pmu_cpumask_init() makes an OPAL call to stop the engine. And if
      the OPAL call fails, imc_common_cpuhp_mem_free() is invoked to cleanup
      memory and cpuhotplug setup.
      
      But when cleaning up the attribute group, we are dereferencing the
      attribute element array without checking whether the backing element
      is not NULL. This causes the kernel panic.
      
      Add a check for the backing element prior to dereferencing the
      attribute element, to handle the failing case gracefully.
      
      Signed-off-by: default avatarAnju T Sudhakar <anju@linux.vnet.ibm.com>
      Reported-by: default avatarPridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
      [mpe: Trim change log]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      0d8ba162
    • Linus Torvalds's avatar
      Merge tag 'devprop-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 3d788276
      Linus Torvalds authored
      Pull device properties framework fixes from Rafael Wysocki:
       "These fix an issue related to device removal introduced during the 4.9
        cycle and fix up new functionality added recently.
      
        Specifics:
      
         - Fix a device properties management issue, introduced during the 4.9
           cycle, that causes device properties associated with a parent
           device to go away on a removal of its child in some cases (Jarkko
           Nikula).
      
         - Fix inconsistencies in error codes returned by a new function
           helper in the device properties framework depending on the
           underlying low-level firmware interface, DT or ACPI, by making the
           meaning of error codes returned in the ACPI case agree with the
           meaning of DT error codes in analogous situations (Sakari Ailus)"
      
      * tag 'devprop-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: properties: Fix __acpi_node_get_property_reference() return codes
        ACPI: properties: Align return codes of __acpi_node_get_property_reference()
        device property: Track owner device of device property
      3d788276
    • Linus Torvalds's avatar
      Merge tag 'xfs-4.14-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 8ff0b97c
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
      
       - Fix a stale kernel memory exposure when logging inodes.
      
       - Fix some build problems with CONFIG_XFS_RT=n
      
       - Don't change inode mode if the acl write fails, leaving the file
         totally inaccessible.
      
       - Fix a dangling pointer problem when removing an attr fork under
         memory pressure.
      
       - Don't crash while trying to invalidate a null buffer associated with
         a corrupt metadata pointer.
      
      * tag 'xfs-4.14-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: handle error if xfs_btree_get_bufs fails
        xfs: reinit btree pointer on attr tree inactivation walk
        xfs: Fix bool initialization/comparison
        xfs: don't change inode mode if ACL update fails
        xfs: move more RT specific code under CONFIG_XFS_RT
        xfs: Don't log uninitialised fields in inode structures
      8ff0b97c
    • NeilBrown's avatar
      scripts: fix faddr2line to work on last symbol · 2aab9c3c
      NeilBrown authored
      
      
      If faddr2line is given a function name which is the last one listed by
      "nm -n", it will fail because it never finds the next symbol.
      
      So teach the awk script to catch that possibility, and use 'size' to
      provide the end point of the last function.
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2aab9c3c
    • Linus Torvalds's avatar
      Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · 3206e7d5
      Linus Torvalds authored
      Pull quota fix from Jan Kara:
       "A fix for a regression in handling of quota grace times and warnings"
      
      * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        quota: Generate warnings for DQUOT_SPACE_NOFAIL allocations
      3206e7d5
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · cbaff876
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "Another latent bug related to PCID, an out-of-bounds access, and a
        submaintainer change being finally made official"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        MAINTAINERS: Add Paul Mackerras as maintainer for KVM/powerpc
        KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit
        KVM: MMU: always terminate page walks at level 1
        KVM: nVMX: update last_nonleaf_level when initializing nested EPT
      cbaff876
    • Niklas Söderlund's avatar
      device property: preserve usecount for node passed to of_fwnode_graph_get_port_parent() · 3314c6bd
      Niklas Söderlund authored
      Using CONFIG_OF_DYNAMIC=y uncovered an imbalance in the usecount of the
      node being passed to of_fwnode_graph_get_port_parent(). Preserve the
      usecount by using of_get_parent() instead of of_get_next_parent() which
      don't decrement the usecount of the node passed to it.
      
      Fixes: 3b27d00e
      
       ("device property: Move fwnode graph ops to firmware specific locations")
      Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      3314c6bd
    • Stewart Smith's avatar
      drivers: of: increase MAX_RESERVED_REGIONS to 32 · 22f8cc6e
      Stewart Smith authored
      There are two types of memory reservations firmware can ask the kernel
      to make in the device tree: static and dynamic.
      See Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
      
      If you have greater than 16 entries in /reserved-memory (as we do on
      POWER9 systems) you would get this scary looking error message:
       [    0.000000] OF: reserved mem: not enough space all defined regions.
      
      This is harmless if all your reservations are static (which with OPAL on
      POWER9, they are).
      
      It is not harmless if you have any dynamic reservations after the 16th.
      
      In the first pass over the fdt to find reservations, the child nodes of
      /reserved-memory are added to a static array in of_reserved_mem.c so that
      memory can be reserved in a 2nd pass. The array has 16 entries. This is why,
      on my dual socket POWER9 system, I get that error 4 times with 20 static
      reservations.
      
      We don't have a problem on ppc though, as in arch/powerpc/kernel/prom.c
      we look at the new style /reserved-ranges property to do reservations,
      and this logic was introduced in 0962e800
      
       (well before any powernv
      system shipped).
      
      A Google search shows up no occurances of that exact error message, so we're
      probably safe in that no machine that people use has memory not being reserved
      when it should be.
      
      The simple fix is to bump the length of the array to 32 which "should be
      enough for everyone(TM)". The simple fix of not recording static allocations
      in the array would cause problems for devices with "memory-region" properties.
      A more future-proof fix is likely possible, although more invasive and this
      simple fix is perfectly suitable in the meantime while a more future-proof
      fix is developed.
      
      Signed-off-by: default avatarStewart Smith <stewart@linux.vnet.ibm.com>
      Tested-by: default avatarMauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      22f8cc6e
    • Sergey Senozhatsky's avatar
      of: do not leak console options · db179e0d
      Sergey Senozhatsky authored
      
      
      Do not strdup() console options. It seems that the only reason for
      it to be strdup()-ed was a compilation warning: printk, UART and
      console drivers, for some reason, expect char pointer instead of
      const char pointer. So we can just pass `of_stdout_options', but
      need to cast it to char pointer. A better fix would be to change
      printk, console drivers and UART to accept const char `options';
      but that will take time - there are lots of drivers to update.
      
      The patch also fixes a possible memory leak: add_preferred_console()
      can fail, but we don't kfree() options.
      
      Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      db179e0d
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 73a752cc
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
      
       - fix crashes in skcipher/shash from zero-length input.
      
       - fix softirq GFP_KERNEL allocation in shash_setkey_unaligned.
      
       - error path bug fix in xts create function.
      
       - fix compiler warning regressions in axis and stm32
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: shash - Fix zero-length shash ahash digest crash
        crypto: skcipher - Fix crash on zero-length input
        crypto: shash - Fix a sleep-in-atomic bug in shash_setkey_unaligned
        crypto: xts - Fix an error handling path in 'create()'
        crypto: stm32 - Try to fix hash padding
        crypto: axis - hide an unused variable
      73a752cc
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching · 0de50ea7
      Linus Torvalds authored
      Pull livepatching fix from Jiri Kosina:
      
       - bugfix for handling of coming modules (incorrect handling of failure)
         from Joe Lawrence
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
        livepatch: unpatch all klp_objects if klp_module_coming fails
      0de50ea7
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid · be7484ac
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - fix for potential out-of-bounds memory access (found by fuzzing,
         likely requires specially crafted device to trigger) by Jaejoong Kim
      
       - two new device IDs for elecom driver from Alex Manoussakis
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
        HID: hid-elecom: extend to fix descriptor for HUGE trackball
        HID: usbhid: fix out-of-bounds bug
      be7484ac
    • Linus Torvalds's avatar
      Merge tag 'sound-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 7702f476
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "It's been a busy week for defending the attacks from fuzzer people.
      
        This contains various USB-audio driver fixes and sequencer core fixes
        spotted by syzkaller and other fuzzer, as well as one quirk for a
        Plantronics USB audio device"
      
      * tag 'sound-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: caiaq: Fix stray URB at probe error path
        ALSA: seq: Fix use-after-free at creating a port
        ALSA: usb-audio: Kill stray URB at exiting
        ALSA: line6: Fix leftover URB at error-path during probe
        ALSA: line6: Fix NULL dereference at podhd_disconnect()
        ALSA: line6: Fix missing initialization before error path
        ALSA: seq: Fix copy_from_user() call inside lock
        ALSA: usb-audio: Add sample rate quirk for Plantronics P610
      7702f476
  3. Oct 12, 2017
    • Linus Torvalds's avatar
      Merge branch 'waitid-fix' · 467251c6
      Linus Torvalds authored
      Merge waitid() fix from Kees Cook.
      
      I'd have hoped that the unsafe_{get|put}_user() naming would have
      avoided these kinds of stupid bugs, but no such luck.
      
      * waitid-fix:
        waitid(): Add missing access_ok() checks
      467251c6
    • Anju T Sudhakar's avatar
      powerpc/perf: Add ___GFP_NOWARN flag to alloc_pages_node() · cd4f2b30
      Anju T Sudhakar authored
      
      
      Stack trace output during a stress test:
       [    4.310049] Freeing initrd memory: 22592K
      [    4.310646] rtas_flash: no firmware flash support
      [    4.313341] cpuhp/64: page allocation failure: order:0, mode:0x14480c0(GFP_KERNEL|__GFP_ZERO|__GFP_THISNODE), nodemask=(null)
      [    4.313465] cpuhp/64 cpuset=/ mems_allowed=0
      [    4.313521] CPU: 64 PID: 392 Comm: cpuhp/64 Not tainted 4.11.0-39.el7a.ppc64le #1
      [    4.313588] Call Trace:
      [    4.313622] [c000000f1fb1b8e0] [c000000000c09388] dump_stack+0xb0/0xf0 (unreliable)
      [    4.313694] [c000000f1fb1b920] [c00000000030ef6c] warn_alloc+0x12c/0x1c0
      [    4.313753] [c000000f1fb1b9c0] [c00000000030ff68] __alloc_pages_nodemask+0xea8/0x1000
      [    4.313823] [c000000f1fb1bbb0] [c000000000113a8c] core_imc_mem_init+0xbc/0x1c0
      [    4.313892] [c000000f1fb1bc00] [c000000000113cdc] ppc_core_imc_cpu_online+0x14c/0x170
      [    4.313962] [c000000f1fb1bc90] [c000000000125758] cpuhp_invoke_callback+0x198/0x5d0
      [    4.314031] [c000000f1fb1bd00] [c00000000012782c] cpuhp_thread_fun+0x8c/0x3d0
      [    4.314101] [c000000f1fb1bd60] [c0000000001678d0] smpboot_thread_fn+0x290/0x2a0
      [    4.314169] [c000000f1fb1bdc0] [c00000000015ee78] kthread+0x168/0x1b0
      [    4.314229] [c000000f1fb1be30] [c00000000000b368] ret_from_kernel_thread+0x5c/0x74
      [    4.314313] Mem-Info:
      [    4.314356] active_anon:0 inactive_anon:0 isolated_anon:0
      
      core_imc_mem_init() at system boot use alloc_pages_node() to get memory
      and alloc_pages_node() throws this stack dump when tried to allocate
      memory from a node which has no memory behind it. Add a ___GFP_NOWARN
      flag in allocation request as a fix.
      
      Signed-off-by: default avatarAnju T Sudhakar <anju@linux.vnet.ibm.com>
      Reported-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Reported-by: default avatarVenkat R.B <venkatb3@in.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      cd4f2b30
    • Anju T Sudhakar's avatar
      powerpc/perf: Fix for core/nest imc call trace on cpuhotplug · 0d923820
      Anju T Sudhakar authored
      
      
      Nest/core pmu units are enabled only when it is used. A reference count is
      maintained for the events which uses the nest/core pmu units. Currently in
      *_imc_counters_release function a WARN() is used for notification of any
      underflow of ref count.
      
      The case where event ref count hit a negative value is, when perf session is
      started, followed by offlining of all cpus in a given core.
      i.e. in cpuhotplug offline path ppc_core_imc_cpu_offline() function set the
      ref->count to zero, if the current cpu which is about to offline is the last
      cpu in a given core and make an OPAL call to disable the engine in that core.
      And on perf session termination, perf->destroy (core_imc_counters_release) will
      first decrement the ref->count for this core and based on the ref->count value
      an opal call is made to disable the core-imc engine.
      Now, since cpuhotplug path already clears the ref->count for core and disabled
      the engine, perf->destroy() decrementing again at event termination make it
      negative which in turn fires the WARN_ON. The same happens for nest units.
      
      Add a check to see if the reference count is alreday zero, before decrementing
      the count, so that the ref count will not hit a negative value.
      
      Signed-off-by: default avatarAnju T Sudhakar <anju@linux.vnet.ibm.com>
      Reviewed-by: default avatarSantosh Sivaraj <santosh@fossix.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      0d923820
    • Thomas Huth's avatar
      MAINTAINERS: Add Paul Mackerras as maintainer for KVM/powerpc · 8a60aea6
      Thomas Huth authored
      
      
      Paul is handling almost all of the powerpc related KVM patches nowadays,
      so he should be mentioned in the MAINTAINERS file accordingly.
      
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      8a60aea6
    • Haozhong Zhang's avatar
      KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit · 8eb3f87d
      Haozhong Zhang authored
      When KVM emulates an exit from L2 to L1, it loads L1 CR4 into the
      guest CR4. Before this CR4 loading, the guest CR4 refers to L2
      CR4. Because these two CR4's are in different levels of guest, we
      should vmx_set_cr4() rather than kvm_set_cr4() here. The latter, which
      is used to handle guest writes to its CR4, checks the guest change to
      CR4 and may fail if the change is invalid.
      
      The failure may cause trouble. Consider we start
        a L1 guest with non-zero L1 PCID in use,
           (i.e. L1 CR4.PCIDE == 1 && L1 CR3.PCID != 0)
      and
        a L2 guest with L2 PCID disabled,
           (i.e. L2 CR4.PCIDE == 0)
      and following events may happen:
      
      1. If kvm_set_cr4() is used in load_vmcs12_host_state() to load L1 CR4
         into guest CR4 (in VMCS01) for L2 to L1 exit, it will fail because
         of PCID check. As a result, the guest CR4 recorded in L0 KVM (i.e.
         vcpu->arch.cr4) is left to the value of L2 CR4.
      
      2. Later, if L1 attempts to change its CR4, e.g., clearing VMXE bit,
         kvm_set_cr4() in L0 KVM will think L1 also wants to enable PCID,
         because the wrong L2 CR4 is used by L0 KVM as L1 CR4. As L1
         CR3.PCID != 0, L0 KVM will inject GP to L1 guest.
      
      Fixes: 4704d0be
      
       ("KVM: nVMX: Exiting from L2 to L1")
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarHaozhong Zhang <haozhong.zhang@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      8eb3f87d
    • Marek Szyprowski's avatar
      iommu/exynos: Remove initconst attribute to avoid potential kernel oops · 9d25e3cc
      Marek Szyprowski authored
      Exynos SYSMMU registers standard platform device with sysmmu_of_match
      table, what means that this table is accessed every time a new platform
      device is registered in a system. This might happen also after the boot,
      so the table must not be attributed as initconst to avoid potential kernel
      oops caused by access to freed memory.
      
      Fixes: 6b21a5db
      
       ("iommu/exynos: Support for device tree")
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      9d25e3cc
    • Sakari Ailus's avatar
      ACPI: properties: Fix __acpi_node_get_property_reference() return codes · 51858a27
      Sakari Ailus authored
      
      
      Fix more return codes for device property: Align return codes of
      __acpi_node_get_property_reference().
      
      In particular, what was missed previously:
      
       -EPROTO could be returned in certain cases, now -EINVAL;
       -EINVAL was returned if the property was not found, now -ENOENT;
       -EINVAL was returned also if the index was higher than the number of
               entries in a package, now -ENOENT.
      
      Reported-by: default avatarHyungwoo Yang <hyungwoo.yang@intel.com>
      Fixes: 3e3119d3
      
       (device property: Introduce fwnode_property_get_reference_args)
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: default avatarHyungwoo Yang <hyungwoo.yang@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      51858a27
    • Sakari Ailus's avatar
      ACPI: properties: Align return codes of __acpi_node_get_property_reference() · c343bc2c
      Sakari Ailus authored
      acpi_fwnode_get_reference_args(), the function implementing ACPI
      support for fwnode_property_get_reference_args(), returns directly
      error codes from __acpi_node_get_property_reference(). The latter
      uses different error codes than the OF implementation. In particular,
      the OF implementation uses -ENOENT to indicate that the property is
      not found, a reference entry is empty and there are no more
      references.
      
      Document and align the error codes for property for
      fwnode_property_get_reference_args() so that they match with
      of_parse_phandle_with_args().
      
      Fixes: 3e3119d3
      
       (device property: Introduce fwnode_property_get_reference_args)
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c343bc2c
    • Linus Torvalds's avatar
      Merge tag 'rpmsg-v4.14-fixes' of git://github.com/andersson/remoteproc · ff5abbe7
      Linus Torvalds authored
      Pull rpmsg fixes from Bjorn Andersson:
       "This corrects two mistakes in the Qualcomm GLINK SMEM driver"
      
      * tag 'rpmsg-v4.14-fixes' of git://github.com/andersson/remoteproc:
        rpmsg: glink: Fix memory leak in qcom_glink_alloc_intent()
        rpmsg: glink: Unlock on error in qcom_glink_request_intent()
      ff5abbe7
    • Linus Torvalds's avatar
      Merge tag 'rproc-v4.14-fixes' of git://github.com/andersson/remoteproc · 9add7e3e
      Linus Torvalds authored
      Pull remoteproc fixes from Bjorn Andersson:
       "This fixes a couple of issues in the imx_rproc driver and corrects the
        Kconfig dependencies of the Qualcomm remoteproc drivers"
      
      * tag 'rproc-v4.14-fixes' of git://github.com/andersson/remoteproc:
        remoteproc: imx_rproc: fix return value check in imx_rproc_addr_init()
        remoteproc: qcom: fix RPMSG_QCOM_GLINK_SMEM dependencies
        remoteproc: imx_rproc: fix a couple off by one bugs
      9add7e3e