Skip to content
  1. Nov 05, 2017
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · f0a32ee4
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "Fixes for interrupt controller emulation in ARM/ARM64 and x86, plus a
        one-liner x86 KVM guest fix"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: x86: Update APICv on APIC reset
        KVM: VMX: Do not fully reset PI descriptor on vCPU reset
        kvm: Return -ENODEV from update_persistent_clock
        KVM: arm/arm64: vgic-its: Check GITS_BASER Valid bit before saving tables
        KVM: arm/arm64: vgic-its: Check CBASER/BASER validity before enabling the ITS
        KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table returned value
        KVM: arm/arm64: vgic-its: Fix return value for device table restore
        arm/arm64: kvm: Disable branch profiling in HYP code
        arm/arm64: kvm: Move initialization completion message
        arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort
        KVM: arm64: its: Fix missing dynamic allocation check in scan_its_table
      f0a32ee4
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · b1878b85
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "Only two patches came in over the last two weeks: Uniphier USB support
        needs additional clocks enabled (on both 32-bit and 64-bit ARM), and a
        Marvell MVEBU stability issue has been fixed"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        ARM: dts: mvebu: pl310-cache disable double-linefill
        arm64: dts: uniphier: add STDMAC clock to EHCI nodes
        ARM: dts: uniphier: add STDMAC clock to EHCI nodes
      b1878b85
    • Linus Torvalds's avatar
      Merge tag 'mips_fixes_4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips · dab30d55
      Linus Torvalds authored
      Pull MIPS fixes from James Hogan:
       "A selection of important MIPS fixes for 4.14, and some MAINTAINERS /
        email address updates:
      
        Maintainership updates:
         - imgtec.com -> mips.com email addresses (this trivially updates
           comments in quite a few files, as well as MAINTAINERS)
         - Pistachio SoC maintainership update
      
        Fixes:
         - NI 169445 build (new platform in 4.14)
         - EVA regression (4.14)
         - SMP-CPS build & preemption regressions (4.14)
         - SMP/hotplug deadlock & race (deadlock reintroduced 4.13)
         - ebpf_jit error return (4.13)
         - SMP-CMP build regressions (4.11 and 4.14)
         - bad UASM microMIPS encoding (3.16)
         - CM definitions (3.15)"
      
      [ I had taken the email address updates separately, because I didn't
        expect James to send a pull request, so those got applied twice.   - Linus]
      
      * tag 'mips_fixes_4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips:
        MIPS: Update email address for Marcin Nowakowski
        MIPS: smp-cmp: Fix vpe_id build error
        MAINTAINERS: Update Pistachio platform maintainers
        MIPS: smp-cmp: Use right include for task_struct
        MIPS: Update Goldfish RTC driver maintainer email address
        MIPS: Update RINT emulation maintainer email address
        MIPS: CPS: Fix use of current_cpu_data in preemptible code
        MIPS: SMP: Fix deadlock & online race
        MIPS: bpf: Fix a typo in build_one_insn()
        MIPS: microMIPS: Fix incorrect mask in insn_table_MM
        MIPS: Fix CM region target definitions
        MIPS: generic: Fix compilation error from include asm/mips-cpc.h
        MIPS: Fix exception entry when CONFIG_EVA enabled
        MIPS: generic: Fix NI 169445 its build
        Update MIPS email addresses
      dab30d55
  2. Nov 04, 2017
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · e50f82f8
      Linus Torvalds authored
      Pull input fixes from Dmitry Torokhov:
       "Just a couple of fixups to the sparse-keymap module and the Microchip
        AR1021 touchscreen driver"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: sparse-keymap - send sync event for KE_SW/KE_VSW
        Input: ar1021_i2c - set INPUT_PROP_DIRECT
      e50f82f8
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · d4c2e9fc
      Linus Torvalds authored
      Pull clk fix from Stephen Boyd:
       "One fix for USB clks on Uniphier PXs3 SoCs"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: uniphier: fix clock data for PXs3
      d4c2e9fc
    • Stefan Brüns's avatar
      Input: sparse-keymap - send sync event for KE_SW/KE_VSW · 6f29c244
      Stefan Brüns authored
      
      
      Sync events are sent by sparse_keymap_report_entry for normal KEY_*
      events, and are generated by several drivers after generating
      SW_* events, so sparse_keymap_report_entry should do the same.
      
      Without the sync, events are accumulated in the kernel.
      
      Currently, no driver uses sparse-keymap for SW_* events, but
      it is required for the intel-vbtn platform driver to generate
      SW_TABLET_MODE events.
      
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      6f29c244
    • Martin Kepplinger's avatar
      Input: ar1021_i2c - set INPUT_PROP_DIRECT · 53f0b7f0
      Martin Kepplinger authored
      
      
      If INPUT_PROP_DIRECT is set, userspace doesn't have to fall back to old
      ways of identifying touchscreen devices. Let's add it.
      
      Signed-off-by: default avatarMartin Kepplinger <martink@posteo.de>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      53f0b7f0
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile · 81ca2cae
      Linus Torvalds authored
      Pull arch/tile fixes from Chris Metcalf:
       "Two one-line bug fixes"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
        arch/tile: Implement ->set_state_oneshot_stopped()
        tile: pass machine size to sparse
      81ca2cae
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 01073ac1
      Linus Torvalds authored
      Pull SCSI fix from James Bottomley:
       "One minor fix in the error leg of the qla2xxx driver (it oopses the
        system if we get an error trying to start the internal kernel thread).
      
        The fix is minor because the problem isn't often encountered in the
        field (although it can be induced by inserting the module in a low
        memory environment)"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: qla2xxx: Fix oops in qla2x00_probe_one error path
      01073ac1
    • Chris Metcalf's avatar
      arch/tile: Implement ->set_state_oneshot_stopped() · 777a45b4
      Chris Metcalf authored
      set_state_oneshot_stopped() is called by the clkevt core, when the
      next event is required at an expiry time of 'KTIME_MAX'. This normally
      happens with NO_HZ_{IDLE|FULL} in both LOWRES/HIGHRES modes.
      
      This patch makes the clockevent device to stop on such an event, to
      avoid spurious interrupts, as explained by: commit 8fff52fd
      
      
      ("clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state").
      
      Signed-off-by: default avatarChris Metcalf <cmetcalf@mellanox.com>
      777a45b4
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.14-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 866ba84e
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Some more powerpc fixes for 4.14.
      
        This is bigger than I like to send at rc7, but that's at least partly
        because I didn't send any fixes last week. If it wasn't for the IMC
        driver, which is new and getting heavy testing, the diffstat would
        look a bit better. I've also added ftrace on big endian to my test
        suite, so we shouldn't break that again in future.
      
         - A fix to the handling of misaligned paste instructions (P9 only),
           where a change to a #define has caused the check for the
           instruction to always fail.
      
         - The preempt handling was unbalanced in the radix THP flush (P9
           only). Though we don't generally use preempt we want to keep it
           working as much as possible.
      
         - Two fixes for IMC (P9 only), one when booting with restricted
           number of CPUs and one in the error handling when initialisation
           fails due to firmware etc.
      
         - A revert to fix function_graph on big endian machines, and then a
           rework of the reverted patch to fix kprobes blacklist handling on
           big endian machines.
      
        Thanks to: Anju T Sudhakar, Guilherme G. Piccoli, Madhavan Srinivasan,
        Naveen N. Rao, Nicholas Piggin, Paul Mackerras"
      
      * tag 'powerpc-4.14-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/perf: Fix core-imc hotplug callback failure during imc initialization
        powerpc/kprobes: Dereference function pointers only if the address does not belong to kernel text
        Revert "powerpc64/elfv1: Only dereference function descriptor for non-text symbols"
        powerpc/64s/radix: Fix preempt imbalance in TLB flush
        powerpc: Fix check for copy/paste instructions in alignment handler
        powerpc/perf: Fix IMC allocation routine
      866ba84e
    • Linus Torvalds's avatar
      Merge tag 'mmc-v4.14-rc4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 3f46540e
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
       "Fix dw_mmc request timeout issues"
      
      * tag 'mmc-v4.14-rc4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: dw_mmc: Fix the DTO timeout calculation
        mmc: dw_mmc: Add locking to the CTO timer
        mmc: dw_mmc: Fix the CTO timeout calculation
        mmc: dw_mmc: cancel the CTO timer after a voltage switch
      3f46540e
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.14-rc8' of git://people.freedesktop.org/~airlied/linux · e65a139d
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
      
       - one nouveau regression fix
      
       - some amdgpu fixes for stable to fix hangs on some harvested Polaris
         GPUs
      
       - a set of KASAN and regression fixes for i915, their CI system seems
         to be working pretty well now.
      
      * tag 'drm-fixes-for-v4.14-rc8' of git://people.freedesktop.org/~airlied/linux:
        drm/amdgpu: allow harvesting check for Polaris VCE
        drm/amdgpu: return -ENOENT from uvd 6.0 early init for harvesting
        drm/i915: Check incoming alignment for unfenced buffers (on i915gm)
        drm/nouveau/kms/nv50: use the correct state for base channel notifier setup
        drm/i915: Hold rcu_read_lock when iterating over the radixtree (vma idr)
        drm/i915: Hold rcu_read_lock when iterating over the radixtree (objects)
        drm/i915/edp: read edp display control registers unconditionally
        drm/i915: Do not rely on wm preservation for ILK watermarks
        drm/i915: Cancel the modeset retry work during modeset cleanup
      e65a139d
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 7ba3ebff
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "Hopefully this is the last batch of networking fixes for 4.14
      
        Fingers crossed...
      
         1) Fix stmmac to use the proper sized OF property read, from Bhadram
            Varka.
      
         2) Fix use after free in net scheduler tc action code, from Cong
            Wang.
      
         3) Fix SKB control block mangling in tcp_make_synack().
      
         4) Use proper locking in fib_dump_info(), from Florian Westphal.
      
         5) Fix IPG encodings in systemport driver, from Florian Fainelli.
      
         6) Fix division by zero in NV TCP congestion control module, from
            Konstantin Khlebnikov.
      
         7) Fix use after free in nf_reject_ipv4, from Tejaswi Tanikella"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
        net: systemport: Correct IPG length settings
        tcp: do not mangle skb->cb[] in tcp_make_synack()
        fib: fib_dump_info can no longer use __in_dev_get_rtnl
        stmmac: use of_property_read_u32 instead of read_u8
        net_sched: hold netns refcnt for each action
        net_sched: acquire RTNL in tc_action_net_exit()
        net: vrf: correct FRA_L3MDEV encode type
        tcp_nv: fix division by zero in tcpnv_acked()
        netfilter: nf_reject_ipv4: Fix use-after-free in send_reset
        netfilter: nft_set_hash: disable fast_ops for 2-len keys
      7ba3ebff
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · f0395d5b
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "7 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm, swap: fix race between swap count continuation operations
        mm/huge_memory.c: deposit page table when copying a PMD migration entry
        initramfs: fix initramfs rebuilds w/ compression after disabling
        fs/hugetlbfs/inode.c: fix hwpoison reserve accounting
        ocfs2: fstrim: Fix start offset of first cluster group during fstrim
        mm, /proc/pid/pagemap: fix soft dirty marking for PMD migration entry
        userfaultfd: hugetlbfs: prevent UFFDIO_COPY to fill beyond the end of i_size
      f0395d5b
    • Paul Burton's avatar
      Update MIPS email addresses · fb615d61
      Paul Burton authored
      
      
      MIPS will soon not be a part of Imagination Technologies, and as such
      many @imgtec.com email addresses will no longer be valid. This patch
      updates the addresses for those who:
      
       - Have 10 or more patches in mainline authored using an @imgtec.com
         email address, or any patches dated within the past year.
      
       - Are still with Imagination but leaving as part of the MIPS business
         unit, as determined from an internal email address list.
      
       - Haven't already updated their email address (ie. JamesH) or expressed
         a desire to be excluded (ie. Maciej).
      
       - Acked v2 or earlier of this patch, which leaves Deng-Cheng, Matt &
         myself.
      
      New addresses are of the form firstname.lastname@mips.com, and all
      verified against an internal email address list.  An entry is added to
      .mailmap for each person such that get_maintainer.pl will report the new
      addresses rather than @imgtec.com addresses which will soon be dead.
      
      Instances of the affected addresses throughout the tree are then
      mechanically replaced with the new @mips.com address.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
      Acked-by: default avatarDengcheng Zhu <dengcheng.zhu@mips.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Acked-by: default avatarMatt Redfearn <matt.redfearn@mips.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fb615d61
  3. Nov 03, 2017
    • Rafael J. Wysocki's avatar
      x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo · 941f5f0f
      Rafael J. Wysocki authored
      Commit 890da9cf (Revert "x86: do not use cpufreq_quick_get() for
      /proc/cpuinfo "cpu MHz"") is not sufficient to restore the previous
      behavior of "cpu MHz" in /proc/cpuinfo on x86 due to some changes
      made after the commit it has reverted.
      
      To address this, make the code in question use arch_freq_get_on_cpu()
      which also is used by cpufreq for reporting the current frequency of
      CPUs and since that function doesn't really depend on cpufreq in any
      way, drop the CONFIG_CPU_FREQ dependency for the object file
      containing it.
      
      Also refactor arch_freq_get_on_cpu() somewhat to avoid IPIs and
      return cached values right away if it is called very often over a
      short time (to prevent user space from triggering IPI storms through
      it).
      
      Fixes: 890da9cf (Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz"")
      Cc: stable@kernel.org   # 4.13 - together with 890da9cf
      
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      941f5f0f
    • Huang Ying's avatar
      mm, swap: fix race between swap count continuation operations · 2628bd6f
      Huang Ying authored
      One page may store a set of entries of the sis->swap_map
      (swap_info_struct->swap_map) in multiple swap clusters.
      
      If some of the entries has sis->swap_map[offset] > SWAP_MAP_MAX,
      multiple pages will be used to store the set of entries of the
      sis->swap_map.  And the pages are linked with page->lru.  This is called
      swap count continuation.  To access the pages which store the set of
      entries of the sis->swap_map simultaneously, previously, sis->lock is
      used.  But to improve the scalability of __swap_duplicate(), swap
      cluster lock may be used in swap_count_continued() now.  This may race
      with add_swap_count_continuation() which operates on a nearby swap
      cluster, in which the sis->swap_map entries are stored in the same page.
      
      The race can cause wrong swap count in practice, thus cause unfreeable
      swap entries or software lockup, etc.
      
      To fix the race, a new spin lock called cont_lock is added to struct
      swap_info_struct to protect the swap count continuation page list.  This
      is a lock at the swap device level, so the scalability isn't very well.
      But it is still much better than the original sis->lock, because it is
      only acquired/released when swap count continuation is used.  Which is
      considered rare in practice.  If it turns out that the scalability
      becomes an issue for some workloads, we can split the lock into some
      more fine grained locks.
      
      Link: http://lkml.kernel.org/r/20171017081320.28133-1-ying.huang@intel.com
      Fixes: 235b6217
      
       ("mm/swap: add cluster lock")
      Signed-off-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Shaohua Li <shli@kernel.org>
      Cc: Tim Chen <tim.c.chen@intel.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Aaron Lu <aaron.lu@intel.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: <stable@vger.kernel.org>	[4.11+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2628bd6f
    • Zi Yan's avatar
      mm/huge_memory.c: deposit page table when copying a PMD migration entry · dd8a67f9
      Zi Yan authored
      We need to deposit pre-allocated PTE page table when a PMD migration
      entry is copied in copy_huge_pmd().  Otherwise, we will leak the
      pre-allocated page and cause a NULL pointer dereference later in
      zap_huge_pmd().
      
      The missing counters during PMD migration entry copy process are added
      as well.
      
      The bug report is here: https://lkml.org/lkml/2017/10/29/214
      
      Link: http://lkml.kernel.org/r/20171030144636.4836-1-zi.yan@sent.com
      Fixes: 84c3fc4e
      
       ("mm: thp: check pmd migration entry in common path")
      Signed-off-by: default avatarZi Yan <zi.yan@cs.rutgers.edu>
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dd8a67f9
    • Florian Fainelli's avatar
      initramfs: fix initramfs rebuilds w/ compression after disabling · e08b1877
      Florian Fainelli authored
      This is a follow-up to commit 57ddfdaa ("initramfs: fix disabling of
      initramfs (and its compression)").  This particular commit fixed the use
      case where we build the kernel with an initramfs with no compression,
      and then we build the kernel with no initramfs.
      
      Now this still left us with the same case as described here:
      
        http://lkml.kernel.org/r/20170521033337.6197-1-f.fainelli@gmail.com
      
      not working with initramfs compression.  This can be seen by the
      following steps/timestamps:
      
        https://www.spinics.net/lists/kernel/msg2598153.html
      
      .initramfs_data.cpio.gz.cmd is correct:
      
        cmd_usr/initramfs_data.cpio.gz := /bin/bash
        ./scripts/gen_initramfs_list.sh -o usr/initramfs_data.cpio.gz  -u 1000 -g 1000  /home/fainelli/work/uclinux-rootfs/romfs /home/fainelli/work/uclinux-rootfs/misc/initramfs.dev
      
      and was generated the first time we did generate the gzip initramfs, so
      the command has not changed, nor its arguments, so we just don't call
      it, no initramfs cpio is re-generated as a consequence.
      
      The fix for this problem is just to properly keep track of the
      .initramfs_cpio_data.d file by suffixing it with the compression
      extension.  This takes care of properly tracking dependencies such that
      the initramfs get (re)generated any time files are added/deleted etc.
      
      Link: http://lkml.kernel.org/r/20170930033936.6722-1-f.fainelli@gmail.com
      Fixes: db2aa7fd ("initramfs: allow again choice of the embedded initramfs compression algorithm")
      Fixes: 9e3596b0
      
       ("kbuild: initramfs cleanup, set target from Kconfig")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Cc: "Francisco Blas Izquierdo Riera (klondike)" <klondike@xiscosoft.net>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e08b1877
    • Mike Kravetz's avatar
      fs/hugetlbfs/inode.c: fix hwpoison reserve accounting · ab615a5b
      Mike Kravetz authored
      Calling madvise(MADV_HWPOISON) on a hugetlbfs page will result in bad
      (negative) reserved huge page counts.  This may not happen immediately,
      but may happen later when the underlying file is removed or filesystem
      unmounted.  For example:
      
        AnonHugePages:         0 kB
        ShmemHugePages:        0 kB
        HugePages_Total:       1
        HugePages_Free:        0
        HugePages_Rsvd:    18446744073709551615
        HugePages_Surp:        0
        Hugepagesize:       2048 kB
      
      In routine hugetlbfs_error_remove_page(), hugetlb_fix_reserve_counts is
      called after remove_huge_page.  hugetlb_fix_reserve_counts is designed
      to only be called/used only if a failure is returned from
      hugetlb_unreserve_pages.  Therefore, call hugetlb_unreserve_pages as
      required and only call hugetlb_fix_reserve_counts in the unlikely event
      that hugetlb_unreserve_pages returns an error.
      
      Link: http://lkml.kernel.org/r/20171019230007.17043-2-mike.kravetz@oracle.com
      Fixes: 78bb9203
      
       ("mm: hwpoison: dissolve in-use hugepage in unrecoverable memory error")
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Acked-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Anshuman Khandual <khandual@linux.vnet.ibm.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>
      ab615a5b
    • Ashish Samant's avatar
      ocfs2: fstrim: Fix start offset of first cluster group during fstrim · 105ddc93
      Ashish Samant authored
      
      
      The first cluster group descriptor is not stored at the start of the
      group but at an offset from the start.  We need to take this into
      account while doing fstrim on the first cluster group.  Otherwise we
      will wrongly start fstrim a few blocks after the desired start block and
      the range can cross over into the next cluster group and zero out the
      group descriptor there.  This can cause filesytem corruption that cannot
      be fixed by fsck.
      
      Link: http://lkml.kernel.org/r/1507835579-7308-1-git-send-email-ashish.samant@oracle.com
      Signed-off-by: default avatarAshish Samant <ashish.samant@oracle.com>
      Reviewed-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Reviewed-by: default avatarJoseph Qi <jiangqi903@gmail.com>
      Cc: Mark Fasheh <mfasheh@versity.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      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>
      105ddc93
    • Huang Ying's avatar
      mm, /proc/pid/pagemap: fix soft dirty marking for PMD migration entry · b83d7e43
      Huang Ying authored
      When the pagetable is walked in the implementation of /proc/<pid>/pagemap,
      pmd_soft_dirty() is used for both the PMD huge page map and the PMD
      migration entries.  That is wrong, pmd_swp_soft_dirty() should be used
      for the PMD migration entries instead because the different page table
      entry flag is used.
      
      As a result, /proc/pid/pagemap may report incorrect soft dirty information
      for PMD migration entries.
      
      Link: http://lkml.kernel.org/r/20171017081818.31795-1-ying.huang@intel.com
      Fixes: 84c3fc4e
      
       ("mm: thp: check pmd migration entry in common path")
      Signed-off-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: "Jérôme Glisse" <jglisse@redhat.com>
      Cc: Daniel Colascione <dancol@google.com>
      Cc: Zi Yan <zi.yan@cs.rutgers.edu>
      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>
      b83d7e43
    • Andrea Arcangeli's avatar
      userfaultfd: hugetlbfs: prevent UFFDIO_COPY to fill beyond the end of i_size · 1e392147
      Andrea Arcangeli authored
      
      
      This oops:
      
        kernel BUG at fs/hugetlbfs/inode.c:484!
        RIP: remove_inode_hugepages+0x3d0/0x410
        Call Trace:
          hugetlbfs_setattr+0xd9/0x130
          notify_change+0x292/0x410
          do_truncate+0x65/0xa0
          do_sys_ftruncate.constprop.3+0x11a/0x180
          SyS_ftruncate+0xe/0x10
          tracesys+0xd9/0xde
      
      was caused by the lack of i_size check in hugetlb_mcopy_atomic_pte.
      
      mmap() can still succeed beyond the end of the i_size after vmtruncate
      zapped vmas in those ranges, but the faults must not succeed, and that
      includes UFFDIO_COPY.
      
      We could differentiate the retval to userland to represent a SIGBUS like
      a page fault would do (vs SIGSEGV), but it doesn't seem very useful and
      we'd need to pick a random retval as there's no meaningful syscall
      retval that would differentiate from SIGSEGV and SIGBUS, there's just
      -EFAULT.
      
      Link: http://lkml.kernel.org/r/20171016223914.2421-2-aarcange@redhat.com
      Signed-off-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.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>
      1e392147
    • Florian Fainelli's avatar
      net: systemport: Correct IPG length settings · 93824c80
      Florian Fainelli authored
      Due to a documentation mistake, the IPG length was set to 0x12 while it
      should have been 12 (decimal). This would affect short packet (64B
      typically) performance since the IPG was bigger than necessary.
      
      Fixes: 44a4524c
      
       ("net: systemport: Add support for SYSTEMPORT Lite")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93824c80
    • Eric Dumazet's avatar
      tcp: do not mangle skb->cb[] in tcp_make_synack() · 3b117750
      Eric Dumazet authored
      Christoph Paasch sent a patch to address the following issue :
      
      tcp_make_synack() is leaving some TCP private info in skb->cb[],
      then send the packet by other means than tcp_transmit_skb()
      
      tcp_transmit_skb() makes sure to clear skb->cb[] to not confuse
      IPv4/IPV6 stacks, but we have no such cleanup for SYNACK.
      
      tcp_make_synack() should not use tcp_init_nondata_skb() :
      
      tcp_init_nondata_skb() really should be limited to skbs put in write/rtx
      queues (the ones that are only sent via tcp_transmit_skb())
      
      This patch fixes the issue and should even save few cpu cycles ;)
      
      Fixes: 971f10ec
      
       ("tcp: better TCP_SKB_CB layout to reduce cache line misses")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarChristoph Paasch <cpaasch@apple.com>
      Reviewed-by: default avatarChristoph Paasch <cpaasch@apple.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b117750
    • Florian Westphal's avatar
      fib: fib_dump_info can no longer use __in_dev_get_rtnl · 25dd169a
      Florian Westphal authored
      syzbot reported yet another regression added with DOIT_UNLOCKED.
      When nexthop is marked as dead, fib_dump_info uses __in_dev_get_rtnl():
      
      ./include/linux/inetdevice.h:230 suspicious rcu_dereference_protected() usage!
      rcu_scheduler_active = 2, debug_locks = 1
      1 lock held by syz-executor2/23859:
       #0:  (rcu_read_lock){....}, at: [<ffffffff840283f0>]
      inet_rtm_getroute+0xaa0/0x2d70 net/ipv4/route.c:2738
      [..]
        lockdep_rcu_suspicious+0x123/0x170 kernel/locking/lockdep.c:4665
        __in_dev_get_rtnl include/linux/inetdevice.h:230 [inline]
        fib_dump_info+0x1136/0x13d0 net/ipv4/fib_semantics.c:1377
        inet_rtm_getroute+0xf97/0x2d70 net/ipv4/route.c:2785
      ..
      
      This isn't safe anymore, callers either hold RTNL mutex or rcu read lock,
      so these spots must use rcu_dereference_rtnl() or plain rcu_derefence()
      (plus unconditional rcu read lock).
      
      This does the latter.
      
      Fixes: 394f51ab
      
       ("ipv4: route: set ipv4 RTM_GETROUTE to not use rtnl")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      25dd169a
    • Bhadram Varka's avatar
      stmmac: use of_property_read_u32 instead of read_u8 · e73b49eb
      Bhadram Varka authored
      
      
      Numbers in DT are stored in “cells” which are 32-bits
      in size. of_property_read_u8 does not work properly
      because of endianness problem.
      
      This causes it to always return 0 with little-endian
      architectures.
      
      Fix it by using of_property_read_u32() OF API.
      
      Signed-off-by: default avatarBhadram Varka <vbhadram@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e73b49eb
    • David S. Miller's avatar
      Merge branch 'net-sched-use-after-free' · 2f2b1ae2
      David S. Miller authored
      
      
      Cong Wang says:
      
      ====================
      net_sched: fix a use-after-free for tc actions
      
      This patchset fixes a use-after-free reported by Lucas
      and closes potential races too.
      
      Please see each patch for details.
      ====================
      
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2f2b1ae2
    • Cong Wang's avatar
      net_sched: hold netns refcnt for each action · ceffcc5e
      Cong Wang authored
      TC actions have been destroyed asynchronously for a long time,
      previously in a RCU callback and now in a workqueue. If we
      don't hold a refcnt for its netns, we could use the per netns
      data structure, struct tcf_idrinfo, after it has been freed by
      netns workqueue.
      
      Hold refcnt to ensure netns destroy happens after all actions
      are gone.
      
      Fixes: ddf97ccd
      
       ("net_sched: add network namespace support for tc actions")
      Reported-by: default avatarLucas Bates <lucasb@mojatatu.com>
      Tested-by: default avatarLucas Bates <lucasb@mojatatu.com>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ceffcc5e
    • Cong Wang's avatar
      net_sched: acquire RTNL in tc_action_net_exit() · a159d3c4
      Cong Wang authored
      I forgot to acquire RTNL in tc_action_net_exit()
      which leads that action ops->cleanup() is not always
      called with RTNL. This usually is not a big deal because
      this function is called after all netns refcnt are gone,
      but given RTNL protects more than just actions, add it
      for safety and consistency.
      
      Also add an assertion to catch other potential bugs.
      
      Fixes: ddf97ccd
      
       ("net_sched: add network namespace support for tc actions")
      Reported-by: default avatarLucas Bates <lucasb@mojatatu.com>
      Tested-by: default avatarLucas Bates <lucasb@mojatatu.com>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a159d3c4
    • Madhavan Srinivasan's avatar
      powerpc/perf: Fix core-imc hotplug callback failure during imc initialization · 7ecb37f6
      Madhavan Srinivasan authored
      Call trace observed during boot:
      
        nest_capp0_imc performance monitor hardware support registered
        nest_capp1_imc performance monitor hardware support registered
        core_imc memory allocation for cpu 56 failed
        Unable to handle kernel paging request for data at address 0xffa400010
        Faulting instruction address: 0xc000000000bf3294
        0:mon> e
        cpu 0x0: Vector: 300 (Data Access) at [c000000ff38ff8d0]
            pc: c000000000bf3294: mutex_lock+0x34/0x90
            lr: c000000000bf3288: mutex_lock+0x28/0x90
            sp: c000000ff38ffb50
           msr: 9000000002009033
           dar: ffa400010
         dsisr: 80000
          current = 0xc000000ff383de00
          paca    = 0xc000000007ae0000	 softe: 0	 irq_happened: 0x01
            pid   = 13, comm = cpuhp/0
        Linux version 4.11.0-39.el7a.ppc64le (mockbuild@ppc-058.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Oct 3 07:42:44 EDT 2017
        0:mon> t
        [c000000ff38ffb80] c0000000002ddfac perf_pmu_migrate_context+0xac/0x470
        [c000000ff38ffc40] c00000000011385c ppc_core_imc_cpu_offline+0x1ac/0x1e0
        [c000000ff38ffc90] c000000000125758 cpuhp_invoke_callback+0x198/0x5d0
        [c000000ff38ffd00] c00000000012782c cpuhp_thread_fun+0x8c/0x3d0
        [c000000ff38ffd60] c0000000001678d0 smpboot_thread_fn+0x290/0x2a0
        [c000000ff38ffdc0] c00000000015ee78 kthread+0x168/0x1b0
        [c000000ff38ffe30] c00000000000b368 ret_from_kernel_thread+0x5c/0x74
      
      While registering the cpuhoplug callbacks for core-imc, if we fails
      in the cpuhotplug online path for any random core (either because opal call to
      initialize the core-imc counters fails or because memory allocation fails for
      that core), ppc_core_imc_cpu_offline() will get invoked for other cpus who
      successfully returned from cpuhotplug online path.
      
      But in the ppc_core_imc_cpu_offline() path we are trying to migrate the event
      context, when core-imc counters are not even initialized. Thus creating the
      above stack dump.
      
      Add a check to see if core-imc counters are enabled or not in the cpuhotplug
      offline path before migrating the context to handle this failing scenario.
      
      Fixes: 885dcd70
      
       ("powerpc/perf: Add nest IMC PMU support")
      Signed-off-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Signed-off-by: default avatarAnju T Sudhakar <anju@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      7ecb37f6
    • Linus Torvalds's avatar
      Kbuild: don't pass "-C" to preprocessor when processing linker scripts · 5cb0512c
      Linus Torvalds authored
      
      
      For some odd historical reason, we preprocessed the linker scripts with
      "-C", which keeps comments around.  That makes no sense, since the
      comments are not meaningful for the build anyway.
      
      And it actually breaks things, since linker scripts can't have C++ style
      "//" comments in them, so keeping comments after preprocessing now
      limits us in odd and surprising ways in our header files for no good
      reason.
      
      The -C option goes back to pre-git and pre-bitkeeper times, but seems to
      have been historically used (along with "-traditional") for some
      odd-ball architectures (ia64, MIPS and SH).  It probably didn't matter
      back then either, but might possibly have been used to minimize the
      difference between the original file and the pre-processed result.
      
      The reason for this may be lost in time, but let's not perpetuate it
      only because we can't remember why we did this crazy thing.
      
      This was triggered by the recent addition of SPDX lines to the source
      tree, where people apparently were confused about why header files
      couldn't use the C++ comment format.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5cb0512c
    • Linus Torvalds's avatar
      Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz"" · 890da9cf
      Linus Torvalds authored
      This reverts commit 51204e06
      
      .
      
      There wasn't really any good reason for it, and people are complaining
      (rightly) that it broke existing practice.
      
      Cc: Len Brown <len.brown@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      890da9cf
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 6daa0839
      Linus Torvalds authored
      Pull arm64 fix from Catalin Marinas:
       "Check addr_limit in arm64 __dump_instr()"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: ensure __dump_instr() checks addr_limit
      6daa0839
    • Mark Rutland's avatar
      arm64: ensure __dump_instr() checks addr_limit · 7a7003b1
      Mark Rutland authored
      It's possible for a user to deliberately trigger __dump_instr with a
      chosen kernel address.
      
      Let's avoid problems resulting from this by using get_user() rather than
      __get_user(), ensuring that we don't erroneously access kernel memory.
      
      Where we use __dump_instr() on kernel text, we already switch to
      KERNEL_DS, so this shouldn't adversely affect those cases.
      
      Fixes: 60ffc30d
      
       ("arm64: Exception handling")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      7a7003b1
    • Paolo Bonzini's avatar
      Merge tag 'kvm-arm-fixes-for-v4.14' of... · b33c8732
      Paolo Bonzini authored
      Merge tag 'kvm-arm-fixes-for-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master
      
      KVM/ARM Fixes for v4.14
      
       - Fixes a number of issues with saving/restoring the ITS
       - Fixes a bug in KVM/ARM when branch profiling is enabled in Hyp mode
       - Fixes an emulation bug for 32-bit guests when injecting aborts
        - Fixes a failure to check if a kmalloc succeeds in the ITS emulation
      b33c8732
    • Jan H. Schönherr's avatar
      KVM: x86: Update APICv on APIC reset · 4191db26
      Jan H. Schönherr authored
      
      
      In kvm_apic_set_state() we update the hardware virtualized APIC after
      the full APIC state has been overwritten. Do the same, when the full
      APIC state has been reset in kvm_lapic_reset().
      
      This updates some hardware state that was previously forgotten, as
      far as I can tell. Also, this allows removing some APIC-related reset
      code from vmx_vcpu_reset().
      
      Signed-off-by: default avatarJan H. Schönherr <jschoenh@amazon.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      4191db26
    • Jan H. Schönherr's avatar
      KVM: VMX: Do not fully reset PI descriptor on vCPU reset · a4888486
      Jan H. Schönherr authored
      
      
      Parts of the posted interrupt descriptor configure host behavior,
      such as the notification vector and destination. Overwriting them
      with zero as done during vCPU reset breaks posted interrupts.
      KVM (re-)writes these fields on certain occasions and belatedly fixes
      the situation in many cases. However, if you have a guest configured
      with "idle=poll", for example, the fields might stay zero forever.
      
      Do not reset the full descriptor in vmx_vcpu_reset(). Instead,
      reset only the outstanding notifications and leave everything
      else untouched.
      
      Signed-off-by: default avatarJan H. Schönherr <jschoenh@amazon.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a4888486
    • Jason Gunthorpe's avatar
      kvm: Return -ENODEV from update_persistent_clock · 00875520
      Jason Gunthorpe authored
      
      
      kvm does not support setting the RTC, so the correct result is -ENODEV.
      Returning -1 will cause sync_cmos_clock to keep trying to set the RTC
      every second.
      
      Signed-off-by: default avatarJason Gunthorpe <jgg@ziepe.ca>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      00875520