1. 29 Sep, 2015 27 commits
  2. 21 Sep, 2015 13 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.2.1 · f4ca8c1b
      Greg Kroah-Hartman authored
      f4ca8c1b
    • Caesar Wang's avatar
      ARM: rockchip: fix broken build · 896b4f15
      Caesar Wang authored
      commit cb8cc37f upstream.
      
      The following was seen in branch[0] build.
      
      arch/arm/mach-rockchip/platsmp.c:154:23: error:
          'rockchip_secondary_startup' undeclared (first use in this function)
      
      branch[0]:
      git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git
      v4.3-armsoc/soc
      
      The broken build is caused by the commit fe4407c0
      ("ARM: rockchip: fix the CPU soft reset").
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      
      The breakage was a result of it being wrongly merged in my branch with
      the cache invalidation rework from Russell 02b4e275
      ("ARM: v7 setup function should invalidate L1 cache").
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Willy Tarreau <w@1wt.eu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      896b4f15
    • Kees Cook's avatar
      fs: create and use seq_show_option for escaping · c5291202
      Kees Cook authored
      commit a068acf2 upstream.
      
      Many file systems that implement the show_options hook fail to correctly
      escape their output which could lead to unescaped characters (e.g.  new
      lines) leaking into /proc/mounts and /proc/[pid]/mountinfo files.  This
      could lead to confusion, spoofed entries (resulting in things like
      systemd issuing false d-bus "mount" notifications), and who knows what
      else.  This looks like it would only be the root user stepping on
      themselves, but it's possible weird things could happen in containers or
      in other situations with delegated mount privileges.
      
      Here's an example using overlay with setuid fusermount trusting the
      contents of /proc/mounts (via the /etc/mtab symlink).  Imagine the use
      of "sudo" is something more sneaky:
      
        $ BASE="ovl"
        $ MNT="$BASE/mnt"
        $ LOW="$BASE/lower"
        $ UP="$BASE/upper"
        $ WORK="$BASE/work/ 0 0
        none /proc fuse.pwn user_id=1000"
        $ mkdir -p "$LOW" "$UP" "$WORK"
        $ sudo mount -t overlay -o "lowerdir=$LOW,upperdir=$UP,workdir=$WORK" none /mnt
        $ cat /proc/mounts
        none /root/ovl/mnt overlay rw,relatime,lowerdir=ovl/lower,upperdir=ovl/upper,workdir=ovl/work/ 0 0
        none /proc fuse.pwn user_id=1000 0 0
        $ fusermount -u /proc
        $ cat /proc/mounts
        cat: /proc/mounts: No such file or directory
      
      This fixes the problem by adding new seq_show_option and
      seq_show_option_n helpers, and updating the vulnerable show_option
      handlers to use them as needed.  Some, like SELinux, need to be open
      coded due to unusual existing escape mechanisms.
      
      [akpm@linux-foundation.org: add lost chunk, per Kees]
      [keescook@chromium.org: seq_show_option should be using const parameters]
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Acked-by: default avatarJan Kara <jack@suse.com>
      Acked-by: default avatarPaul Moore <paul@paul-moore.com>
      Cc: J. R. Okajima <hooanon05g@gmail.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c5291202
    • Tang Chen's avatar
      memory-hotplug: add hot-added memory ranges to memblock before allocate node_data for a node. · 42c74434
      Tang Chen authored
      commit 7f36e3e5 upstream.
      
      Commit f9126ab9 ("memory-hotplug: fix wrong edge when hot add a new
      node") hot-added memory range to memblock, after creating pgdat for new
      node.
      
      But there is a problem:
      
        add_memory()
        |--> hotadd_new_pgdat()
             |--> free_area_init_node()
                  |--> get_pfn_range_for_nid()
                       |--> find start_pfn and end_pfn in memblock
        |--> ......
        |--> memblock_add_node(start, size, nid)    --------    Here, just too late.
      
      get_pfn_range_for_nid() will find that start_pfn and end_pfn are both 0.
      As a result, when adding memory, dmesg will give the following wrong
      message.
      
        Initmem setup node 5 [mem 0x0000000000000000-0xffffffffffffffff]
        On node 5 totalpages: 0
        Built 5 zonelists in Node order, mobility grouping on.  Total pages: 32588823
        Policy zone: Normal
        init_memory_mapping: [mem 0x60000000000-0x607ffffffff]
      
      The solution is simple, just add the memory range to memblock a little
      earlier, before hotadd_new_pgdat().
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarTang Chen <tangchen@cn.fujitsu.com>
      Cc: Xishi Qiu <qiuxishi@huawei.com>
      Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
      Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42c74434
    • Ryan Ding's avatar
      ocfs2: direct write will call ocfs2_rw_unlock() twice when doing aio+dio · 95125d51
      Ryan Ding authored
      commit aa1057b3 upstream.
      
      ocfs2_file_write_iter() is usng the wrong return value ('written').  This
      will cause ocfs2_rw_unlock() be called both in write_iter & end_io,
      triggering a BUG_ON.
      
      This issue was introduced by commit 7da839c4 ("ocfs2: use
      __generic_file_write_iter()").
      
      Orabug: 21612107
      Fixes: 7da839c4 ("ocfs2: use __generic_file_write_iter()")
      Signed-off-by: default avatarRyan Ding <ryan.ding@oracle.com>
      Reviewed-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      95125d51
    • Mikulas Patocka's avatar
      hpfs: update ctime and mtime on directory modification · 7548d27d
      Mikulas Patocka authored
      commit f49a26e7 upstream.
      
      Update ctime and mtime when a directory is modified. (though OS/2 doesn't
      update them anyway)
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7548d27d
    • Eric W. Biederman's avatar
      fs: Set the size of empty dirs to 0. · 5bd1456e
      Eric W. Biederman authored
      commit 4b75de86 upstream.
      
      Before the make_empty_dir_inode calls were introduce into proc, sysfs,
      and sysctl those directories when stated reported an i_size of 0.
      make_empty_dir_inode started reporting an i_size of 2.  At least one
      userspace application depended on stat returning i_size of 0.  So
      modify make_empty_dir_inode to cause an i_size of 0 to be reported for
      these directories.
      Reported-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5bd1456e
    • Joe Thornber's avatar
      dm cache: fix leaking of deferred bio prison cells · 38c7d777
      Joe Thornber authored
      commit 9153df74 upstream.
      
      There were two cases where dm_cell_visit_release() was being called,
      which removes the cell from the prison's rbtree, but the callers didn't
      also return the cell to the mempool.  Fix this by having them call
      free_prison_cell().
      
      This leak manifested as the 'kmalloc-96' slab growing until OOM.
      
      Fixes: 651f5fa2 ("dm cache: defer whole cells")
      Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      38c7d777
    • Mikulas Patocka's avatar
      dm stats: report precise_timestamps and histogram in @stats_list output · 8f019cb9
      Mikulas Patocka authored
      commit bd49784f upstream.
      
      If the user selected the precise_timestamps or histogram options, report
      it in the @stats_list message output.
      
      If the user didn't select these options, no extra tokens are reported,
      thus it is backward compatible with old software that doesn't know about
      precise timestamps and histogram.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # 4.2
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f019cb9
    • Grant Likely's avatar
      drivercore: Fix unregistration path of platform devices · 2d984207
      Grant Likely authored
      commit 7f5dcaf1 upstream.
      
      The unregister path of platform_device is broken. On registration, it
      will register all resources with either a parent already set, or
      type==IORESOURCE_{IO,MEM}. However, on unregister it will release
      everything with type==IORESOURCE_{IO,MEM}, but ignore the others. There
      are also cases where resources don't get registered in the first place,
      like with devices created by of_platform_populate()*.
      
      Fix the unregister path to be symmetrical with the register path by
      checking the parent pointer instead of the type field to decide which
      resources to unregister. This is safe because the upshot of the
      registration path algorithm is that registered resources have a parent
      pointer, and non-registered resources do not.
      
      * It can be argued that of_platform_populate() should be registering
        it's resources, and they argument has some merit. However, there are
        quite a few platforms that end up broken if we try to do that due to
        overlapping resources in the device tree. Until that is fixed, we need
        to solve the immediate problem.
      
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Cc: Wolfram Sang <wsa@the-dreams.de>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Tested-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
      Tested-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d984207
    • Jiang Liu's avatar
      ACPI, PCI: Penalize legacy IRQ used by ACPI SCI · 75fa68d1
      Jiang Liu authored
      commit 5d0ddfeb upstream.
      
      Nick Meier reported a regression with HyperV that "
        After rebooting the VM, the following messages are logged in syslog
        when trying to load the tulip driver:
          tulip: Linux Tulip drivers version 1.1.15 (Feb 27, 2007)
          tulip: 0000:00:0a.0: PCI INT A: failed to register GSI
          tulip: Cannot enable tulip board #0, aborting
          tulip: probe of 0000:00:0a.0 failed with error -16
        Errors occur in 3.19.0 kernel
        Works in 3.17 kernel.
      "
      
      According to the ACPI dump file posted by Nick at
      https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1440072
      
      The ACPI MADT table includes an interrupt source overridden entry for
      ACPI SCI:
      [236h 0566  1]                Subtable Type : 02 <Interrupt Source Override>
      [237h 0567  1]                       Length : 0A
      [238h 0568  1]                          Bus : 00
      [239h 0569  1]                       Source : 09
      [23Ah 0570  4]                    Interrupt : 00000009
      [23Eh 0574  2]        Flags (decoded below) : 000D
                                         Polarity : 1
                                     Trigger Mode : 3
      
      And in DSDT table, we have _PRT method to define PCI interrupts, which
      eventually goes to:
              Name (PRSA, ResourceTemplate ()
              {
                  IRQ (Level, ActiveLow, Shared, )
                      {3,4,5,7,9,10,11,12,14,15}
              })
              Name (PRSB, ResourceTemplate ()
              {
                  IRQ (Level, ActiveLow, Shared, )
                      {3,4,5,7,9,10,11,12,14,15}
              })
              Name (PRSC, ResourceTemplate ()
              {
                  IRQ (Level, ActiveLow, Shared, )
                      {3,4,5,7,9,10,11,12,14,15}
              })
              Name (PRSD, ResourceTemplate ()
              {
                  IRQ (Level, ActiveLow, Shared, )
                      {3,4,5,7,9,10,11,12,14,15}
              })
      
      According to the MADT and DSDT tables, IRQ 9 may be used for:
       1) ACPI SCI in level, high mode
       2) PCI legacy IRQ in level, low mode
      So there's a conflict in polarity setting for IRQ 9.
      
      Prior to commit cd68f6bd ("x86, irq, acpi: Get rid of special
      handling of GSI for ACPI SCI"), ACPI SCI is handled specially and
      there's no check for conflicts between ACPI SCI and PCI legagy IRQ.
      And it seems that the HyperV hypervisor doesn't make use of the
      polarity configuration in IOAPIC entry, so it just works.
      
      Commit cd68f6bd gets rid of the specially handling of ACPI SCI,
      and then the pin attribute checking code discloses the conflicts
      between ACPI SCI and PCI legacy IRQ on HyperV virtual machine,
      and rejects the request to assign IRQ9 to PCI devices.
      
      So penalize legacy IRQ used by ACPI SCI and mark it unusable if ACPI
      SCI attributes conflict with PCI IRQ attributes.
      
      Please refer to following links for more information:
      https://bugzilla.kernel.org/show_bug.cgi?id=101301
      https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1440072
      
      Fixes: cd68f6bd ("x86, irq, acpi: Get rid of special handling of GSI for ACPI SCI")
      Reported-and-tested-by: default avatarNick Meier <nmeier@microsoft.com>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75fa68d1
    • Heiko Stuebner's avatar
      ARM: dts: rockchip: fix rk3288 watchdog irq · 83065983
      Heiko Stuebner authored
      commit 1a1b698b upstream.
      
      The watchdog irq is actually SPI 79, which translates to the original
      111 in the manual where the SPI irqs start at 32.
      The current dw_wdt driver does not use the irq at all, so this issue
      never surfaced. Nevertheless fix this for a time we want to use the irq.
      
      Fixes: 2ab557b7 ("ARM: dts: rockchip: add core rk3288 dtsi")
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83065983
    • Caesar Wang's avatar
      ARM: rockchip: fix the CPU soft reset · b82505c8
      Caesar Wang authored
      commit fe4407c0 upstream.
      
      We need different orderings when turning a core on and turning a core
      off.  In one case we need to assert reset before turning power off.
      In ther other case we need to turn power on and the deassert reset.
      
      In general, the correct flow is:
      
      CPU off:
          reset_control_assert
          regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), BIT(pd))
          wait_for_power_domain_to_turn_off
      CPU on:
          regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), 0)
          wait_for_power_domain_to_turn_on
          reset_control_deassert
      
      This is needed for stressing CPU up/down, as per:
          cd /sys/devices/system/cpu/
          for i in $(seq 10000); do
              echo "================= $i ============"
              for j in $(seq 100); do
                  while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "000"" ]]
                      echo 0 > cpu1/online
                      echo 0 > cpu2/online
                      echo 0 > cpu3/online
                  done
                  while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "111" ]]; do
                      echo 1 > cpu1/online
                      echo 1 > cpu2/online
                      echo 1 > cpu3/online
                  done
              done
          done
      
      The following is reproducable log:
          [34466.186812] PM: noirq suspend of devices complete after 0.669 msecs
          [34466.186824] Disabling non-boot CPUs ...
          [34466.187509] CPU1: shutdown
          [34466.188672] CPU2: shutdown
          [34473.736627] Kernel panic - not syncing:Watchdog detected hard LOCKUP on cpu 0
          .......
      or others similar log:
          .......
          [ 4072.454453] CPU1: shutdown
          [ 4072.504436] CPU2: shutdown
          [ 4072.554426] CPU3: shutdown
          [ 4072.577827] CPU1: Booted secondary processor
          [ 4072.582611] CPU2: Booted secondary processor
          <hang>
      
          Tested by cpu up/down scripts, the results told us need delay more time
      before write the sram. The wait time is affected by many aspects
      (e.g: cpu frequency, bootrom frequency, sram frequency, bus speed, ...).
      
          Although the cpus other than cpu0 will write the sram, the speedy is
      no the same as cpu0, if the cpu0 early wake up, perhaps the other cpus
      can't startup. As we know, the cpu0 can wake up when the cpu1/2/3 write
      the 'sram+4/8' and send the sev.
          Anyway.....
          At the moment, 1ms delay will be happy work for cpu up/down scripts test.
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Reviewed-by: default avatarDoug Anderson <dianders@chromium.org>
      Reviewed-by: default avatarKever Yang <kever.yang@rock-chips.com>
      Fixes: 3ee851e2 ("ARM: rockchip: add basic smp support for rk3288")
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b82505c8