1. 18 Jul, 2014 40 commits
    • Krzysztof Kozlowski's avatar
      clk: s2mps11: Fix double free corruption during driver unbind · c2602aa9
      Krzysztof Kozlowski authored
      commit 2a96dfa4 upstream.
      
      After unbinding the driver memory was corrupted by double free of
      clk_lookup structure. This lead to OOPS when re-binding the driver
      again.
      
      The driver allocated memory for 'clk_lookup' with devm_kzalloc. During
      driver removal this memory was freed twice: once by clkdev_drop() and
      second by devm code.
      
      Kernel panic log:
      [   30.839284] Unable to handle kernel paging request at virtual address 5f343173
      [   30.846476] pgd = dee14000
      [   30.849165] [5f343173] *pgd=00000000
      [   30.852703] Internal error: Oops: 805 [#1] PREEMPT SMP ARM
      [   30.858166] Modules linked in:
      [   30.861208] CPU: 0 PID: 1 Comm: bash Not tainted 3.16.0-rc2-00239-g94bdf617b07e-dirty #40
      [   30.869364] task: df478000 ti: df480000 task.ti: df480000
      [   30.874752] PC is at clkdev_add+0x2c/0x38
      [   30.878738] LR is at clkdev_add+0x18/0x38
      [   30.882732] pc : [<c0350908>]    lr : [<c03508f4>]    psr: 60000013
      [   30.882732] sp : df481e78  ip : 00000001  fp : c0700ed8
      [   30.894187] r10: 0000000c  r9 : 00000000  r8 : c07b0e3c
      [   30.899396] r7 : 00000002  r6 : df45f9d0  r5 : df421390  r4 : c0700d6c
      [   30.905906] r3 : 5f343173  r2 : c0700d84  r1 : 60000013  r0 : c0700d6c
      [   30.912417] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      [   30.919534] Control: 10c53c7d  Table: 5ee1406a  DAC: 00000015
      [   30.925262] Process bash (pid: 1, stack limit = 0xdf480240)
      [   30.930817] Stack: (0xdf481e78 to 0xdf482000)
      [   30.935159] 1e60:                                                       00001000 df6de610
      [   30.943321] 1e80: df7f4558 c0355650 c05ec6ec c0700eb0 df6de600 df7f4510 dec9d69c 00000014
      [   30.951480] 1ea0: 00167b48 df6de610 c0700e30 c0713518 00000000 c0700e30 dec9d69c 00000006
      [   30.959639] 1ec0: 00167b48 c02c1b7c c02c1b64 df6de610 c07aff48 c02c0420 c06fb150 c047cc20
      [   30.967798] 1ee0: df6de610 df6de610 c0700e30 df6de644 c06fb150 0000000c dec9d690 c02bef90
      [   30.975957] 1f00: dec9c6c0 dece4c00 df481f80 dece4c00 0000000c c02be73c 0000000c c016ca8c
      [   30.984116] 1f20: c016ca48 00000000 00000000 c016c1f4 00000000 00000000 b6f18000 df481f80
      [   30.992276] 1f40: df7f66c0 0000000c df480000 df480000 b6f18000 c011094c df47839c 60000013
      [   31.000435] 1f60: 00000000 00000000 df7f66c0 df7f66c0 0000000c df480000 b6f18000 c0110dd4
      [   31.008594] 1f80: 00000000 00000000 0000000c b6ec05d8 0000000c b6f18000 00000004 c000f2a8
      [   31.016753] 1fa0: 00001000 c000f0e0 b6ec05d8 0000000c 00000001 b6f18000 0000000c 00000000
      [   31.024912] 1fc0: b6ec05d8 0000000c b6f18000 00000004 0000000c 00000001 00000000 00167b48
      [   31.033071] 1fe0: 00000000 bed83a80 b6e004f0 b6e5122c 60000010 00000001 ffffffff ffffffff
      [   31.041248] [<c0350908>] (clkdev_add) from [<c0355650>] (s2mps11_clk_probe+0x2b4/0x3b4)
      [   31.049223] [<c0355650>] (s2mps11_clk_probe) from [<c02c1b7c>] (platform_drv_probe+0x18/0x48)
      [   31.057728] [<c02c1b7c>] (platform_drv_probe) from [<c02c0420>] (driver_probe_device+0x13c/0x384)
      [   31.066579] [<c02c0420>] (driver_probe_device) from [<c02bef90>] (bind_store+0x88/0xd8)
      [   31.074564] [<c02bef90>] (bind_store) from [<c02be73c>] (drv_attr_store+0x20/0x2c)
      [   31.082118] [<c02be73c>] (drv_attr_store) from [<c016ca8c>] (sysfs_kf_write+0x44/0x48)
      [   31.090016] [<c016ca8c>] (sysfs_kf_write) from [<c016c1f4>] (kernfs_fop_write+0xc0/0x17c)
      [   31.098176] [<c016c1f4>] (kernfs_fop_write) from [<c011094c>] (vfs_write+0xa0/0x1c4)
      [   31.105899] [<c011094c>] (vfs_write) from [<c0110dd4>] (SyS_write+0x40/0x8c)
      [   31.112931] [<c0110dd4>] (SyS_write) from [<c000f0e0>] (ret_fast_syscall+0x0/0x3c)
      [   31.120481] Code: e2842018 e584501c e1a00004 e885000c (e5835000)
      [   31.126596] ---[ end trace efad45bfa3a61b05 ]---
      [   31.131181] Kernel panic - not syncing: Fatal exception
      [   31.136368] CPU1: stopping
      [   31.139054] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G      D       3.16.0-rc2-00239-g94bdf617b07e-dirty #40
      [   31.148697] [<c0016480>] (unwind_backtrace) from [<c0012950>] (show_stack+0x10/0x14)
      [   31.156419] [<c0012950>] (show_stack) from [<c0480db8>] (dump_stack+0x80/0xcc)
      [   31.163622] [<c0480db8>] (dump_stack) from [<c001499c>] (handle_IPI+0x130/0x15c)
      [   31.170998] [<c001499c>] (handle_IPI) from [<c000862c>] (gic_handle_irq+0x60/0x68)
      [   31.178549] [<c000862c>] (gic_handle_irq) from [<c0013480>] (__irq_svc+0x40/0x70)
      [   31.186009] Exception stack(0xdf4bdf88 to 0xdf4bdfd0)
      [   31.191046] df80:                   ffffffed 00000000 00000000 00000000 df4bc000 c06d042c
      [   31.199207] dfa0: 00000000 ffffffed c06d03c0 00000000 c070c288 00000000 00000000 df4bdfd0
      [   31.207363] dfc0: c0010324 c0010328 60000013 ffffffff
      [   31.212402] [<c0013480>] (__irq_svc) from [<c0010328>] (arch_cpu_idle+0x28/0x30)
      [   31.219783] [<c0010328>] (arch_cpu_idle) from [<c005f150>] (cpu_startup_entry+0x2c4/0x3f0)
      [   31.228027] [<c005f150>] (cpu_startup_entry) from [<400086c4>] (0x400086c4)
      [   31.234968] ---[ end Kernel panic - not syncing: Fatal exception
      
      Fixes: 7cc560de ("clk: s2mps11: Add support for s2mps11")
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Reviewed-by: default avatarYadwinder Singh Brar <yadi.brar@samsung.com>
      Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      c2602aa9
    • Thomas Gleixner's avatar
      clk: spear3xx: Use proper control register offset · dce080c4
      Thomas Gleixner authored
      commit 15ebb052 upstream.
      
      The control register is at offset 0x10, not 0x0. This is wreckaged
      since commit 5df33a62 (SPEAr: Switch to common clock framework).
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      dce080c4
    • Colin Cross's avatar
      arm64: implement TASK_SIZE_OF · ccca5d34
      Colin Cross authored
      commit fa2ec3ea upstream.
      
      include/linux/sched.h implements TASK_SIZE_OF as TASK_SIZE if it
      is not set by the architecture headers.  TASK_SIZE uses the
      current task to determine the size of the virtual address space.
      On a 64-bit kernel this will cause reading /proc/pid/pagemap of a
      64-bit process from a 32-bit process to return EOF when it reads
      past 0xffffffff.
      
      Implement TASK_SIZE_OF exactly the same as TASK_SIZE with
      test_tsk_thread_flag instead of test_thread_flag.
      Signed-off-by: default avatarColin Cross <ccross@android.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ccca5d34
    • Jussi Kivilinna's avatar
      crypto: sha512_ssse3 - fix byte count to bit count conversion · 49049cd0
      Jussi Kivilinna authored
      commit cfe82d4f upstream.
      
      Byte-to-bit-count computation is only partly converted to big-endian and is
      mixing in CPU-endian values. Problem was noticed by sparce with warning:
      
        CHECK   arch/x86/crypto/sha512_ssse3_glue.c
      arch/x86/crypto/sha512_ssse3_glue.c:144:19: warning: restricted __be64 degrades to integer
      arch/x86/crypto/sha512_ssse3_glue.c:144:17: warning: incorrect type in assignment (different base types)
      arch/x86/crypto/sha512_ssse3_glue.c:144:17:    expected restricted __be64 <noident>
      arch/x86/crypto/sha512_ssse3_glue.c:144:17:    got unsigned long long
      Signed-off-by: default avatarJussi Kivilinna <jussi.kivilinna@iki.fi>
      Acked-by: default avatarTim Chen <tim.c.chen@linux.intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      49049cd0
    • Prabhakar Lad's avatar
      cpufreq: Makefile: fix compilation for davinci platform · 52df57db
      Prabhakar Lad authored
      commit 5a90af67 upstream.
      
      Since commtit 8a7b1227 (cpufreq: davinci: move cpufreq driver to
      drivers/cpufreq) this added dependancy only for CONFIG_ARCH_DAVINCI_DA850
      where as davinci_cpufreq_init() call is used by all davinci platform.
      
      This patch fixes following build error:
      
      arch/arm/mach-davinci/built-in.o: In function `davinci_init_late':
      :(.init.text+0x928): undefined reference to `davinci_cpufreq_init'
      make: *** [vmlinux] Error 1
      
      Fixes: 8a7b1227 (cpufreq: davinci: move cpufreq driver to drivers/cpufreq)
      Signed-off-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      52df57db
    • Joel Stanley's avatar
      powerpc/perf: Clear MMCR2 when enabling PMU · 19528a53
      Joel Stanley authored
      commit b50a6c58 upstream.
      
      On POWER8 when switching to a KVM guest we set bits in MMCR2 to freeze
      the PMU counters. Aside from on boot they are then never reset,
      resulting in stuck perf counters for any user in the guest or host.
      
      We now set MMCR2 to 0 whenever enabling the PMU, which provides a sane
      state for perf to use the PMU counters under either the guest or the
      host.
      
      This was manifesting as a bug with ppc64_cpu --frequency:
      
          $ sudo ppc64_cpu --frequency
          WARNING: couldn't run on cpu 0
          WARNING: couldn't run on cpu 8
            ...
          WARNING: couldn't run on cpu 144
          WARNING: couldn't run on cpu 152
          min:    18446744073.710 GHz (cpu -1)
          max:    0.000 GHz (cpu -1)
          avg:    0.000 GHz
      
      The command uses a perf counter to measure CPU cycles over a fixed
      amount of time, in order to approximate the frequency of the machine.
      The counters were returning zero once a guest was started, regardless of
      weather it was still running or had been shut down.
      
      By dumping the value of MMCR2, it was observed that once a guest is
      running MMCR2 is set to 1s - which stops counters from running:
      
          $ sudo sh -c 'echo p > /proc/sysrq-trigger'
          CPU: 0 PMU registers, ppmu = POWER8 n_counters = 6
          PMC1:  5b635e38 PMC2: 00000000 PMC3: 00000000 PMC4: 00000000
          PMC5:  1bf5a646 PMC6: 5793d378 PMC7: deadbeef PMC8: deadbeef
          MMCR0: 0000000080000000 MMCR1: 000000001e000000 MMCRA: 0000040000000000
          MMCR2: fffffffffffffc00 EBBHR: 0000000000000000
          EBBRR: 0000000000000000 BESCR: 0000000000000000
          SIAR:  00000000000a51cc SDAR:  c00000000fc40000 SIER:  0000000001000000
      
      This is done unconditionally in book3s_hv_interrupts.S upon entering the
      guest, and the original value is only save/restored if the host has
      indicated it was using the PMU. This is okay, however the user of the
      PMU needs to ensure that it is in a defined state when it starts using
      it.
      
      Fixes: e05b9b9e ("powerpc/perf: Power8 PMU support")
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      19528a53
    • Joel Stanley's avatar
      powerpc/perf: Add PPMU_ARCH_207S define · 25744477
      Joel Stanley authored
      commit 4d9690dd upstream.
      
      Instead of separate bits for every POWER8 PMU feature, have a single one
      for v2.07 of the architecture.
      
      This saves us adding a MMCR2 define for a future patch.
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      25744477
    • Anton Blanchard's avatar
      powerpc/perf: Never program book3s PMCs with values >= 0x80000000 · a348a994
      Anton Blanchard authored
      commit f5602941 upstream.
      
      We are seeing a lot of PMU warnings on POWER8:
      
          Can't find PMC that caused IRQ
      
      Looking closer, the active PMC is 0 at this point and we took a PMU
      exception on the transition from negative to 0. Some versions of POWER8
      have an issue where they edge detect and not level detect PMC overflows.
      
      A number of places program the PMC with (0x80000000 - period_left),
      where period_left can be negative. We can either fix all of these or
      just ensure that period_left is always >= 1.
      
      This patch takes the second option.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      a348a994
    • Lv Zheng's avatar
      ACPI / EC: Fix race condition in ec_transaction_completed() · 8c1eb039
      Lv Zheng authored
      commit c0d65341 upstream.
      
      There is a race condition in ec_transaction_completed().
      
      When ec_transaction_completed() is called in the GPE handler, it could
      return true because of (ec->curr == NULL). Then the wake_up() invocation
      could complete the next command unexpectedly since there is no lock between
      the 2 invocations. With the previous cleanup, the IBF=0 waiter race need
      not be handled any more. It's now safe to return a flag from
      advance_condition() to indicate the requirement of wakeup, the flag is
      returned from a locked context.
      
      The ec_transaction_completed() is now only invoked by the ec_poll() where
      the ec->curr is ensured to be different from NULL.
      
      After cleaning up, the EVT_SCI=1 check should be moved out of the wakeup
      condition so that an EVT_SCI raised with (ec->curr == NULL) can trigger a
      QR_SC command.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911Reported-and-tested-by: default avatarGareth Williams <gareth@garethwilliams.me.uk>
      Reported-and-tested-by: default avatarHans de Goede <jwrdegoede@fedoraproject.org>
      Reported-by: default avatarBarton Xu <tank.xuhan@gmail.com>
      Tested-by: default avatarSteffen Weber <steffen.weber@gmail.com>
      Tested-by: default avatarArthur Chen <axchen@nvidia.com>
      Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      8c1eb039
    • Lv Zheng's avatar
      ACPI / EC: Remove duplicated ec_wait_ibf0() waiter · 208614e5
      Lv Zheng authored
      commit 9b80f0f7 upstream.
      
      After we've added the first command byte write into advance_transaction(),
      the IBF=0 waiter is duplicated with the command completion waiter
      implemented in the ec_poll() because:
         If IBF=1 blocked the first command byte write invoked in the task
         context ec_poll(), it would be kicked off upon IBF=0 interrupt or timed
         out and retried again in the task context.
      
      Remove this seperate and duplicate IBF=0 waiter.  By doing so we can
      reduce the overall number of times to access the EC_SC(R) status
      register.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911Reported-and-tested-by: default avatarGareth Williams <gareth@garethwilliams.me.uk>
      Reported-and-tested-by: default avatarHans de Goede <jwrdegoede@fedoraproject.org>
      Reported-by: default avatarBarton Xu <tank.xuhan@gmail.com>
      Tested-by: default avatarSteffen Weber <steffen.weber@gmail.com>
      Tested-by: default avatarArthur Chen <axchen@nvidia.com>
      Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      208614e5
    • Lv Zheng's avatar
      ACPI / EC: Add asynchronous command byte write support · 6fb7e70d
      Lv Zheng authored
      commit f92fca00 upstream.
      
      Move the first command byte write into advance_transaction() so that all
      EC register accesses that can affect the command processing state machine
      can happen in this asynchronous state machine advancement function.
      
      The advance_transaction() function then can be a complete implementation
      of an asyncrhonous transaction for a single command so that:
       1. The first command byte can be written in the interrupt context;
       2. The command completion waiter can also be used to wait the first command
          byte's timeout;
       3. In BURST mode, the follow-up command bytes can be written in the
          interrupt context directly, so that it doesn't need to return to the
          task context. Returning to the task context reduces the throughput of
          the BURST mode and in the worst cases where the system workload is very
          high, this leads to the hardware driven automatic BURST mode exit.
      
      In order not to increase memory consumption, convert 'done' into 'flags'
      to contain multiple indications:
       1. ACPI_EC_COMMAND_COMPLETE: converting from original 'done' condition,
          indicating the completion of the command transaction.
       2. ACPI_EC_COMMAND_POLL: indicating the availability of writing the first
          command byte. A new command can utilize this flag to compete for the
          right of accessing the underlying hardware. There is a follow-up bug
          fix that has utilized this new flag.
      
      The 2 flags are important because it also reflects a key concept of IO
      programs' design used in the system softwares. Normally an IO program
      running in the kernel should first be implemented in the asynchronous way.
      And the 2 flags are the most common way to implement its synchronous
      operations on top of the asynchronous operations:
      1. POLL: This flag can be used to block until the asynchronous operations
               can happen.
      2. COMPLETE: This flag can be used to block until the asynchronous
                   operations have completed.
      By constructing code cleanly in this way, many difficult problems can be
      solved smoothly.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911Reported-and-tested-by: default avatarGareth Williams <gareth@garethwilliams.me.uk>
      Reported-and-tested-by: default avatarHans de Goede <jwrdegoede@fedoraproject.org>
      Reported-by: default avatarBarton Xu <tank.xuhan@gmail.com>
      Tested-by: default avatarSteffen Weber <steffen.weber@gmail.com>
      Tested-by: default avatarArthur Chen <axchen@nvidia.com>
      Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      6fb7e70d
    • Lv Zheng's avatar
      ACPI / EC: Avoid race condition related to advance_transaction() · e9b3f9c5
      Lv Zheng authored
      commit 66b42b78 upstream.
      
      The advance_transaction() will be invoked from the IRQ context GPE handler
      and the task context ec_poll(). The handling of this function is locked so
      that the EC state machine are ensured to be advanced sequentially.
      
      But there is a problem. Before invoking advance_transaction(), EC_SC(R) is
      read. Then for advance_transaction(), there could be race condition around
      the lock from both contexts. The first one reading the register could fail
      this race and when it passes the stale register value to the state machine
      advancement code, the hardware condition is totally different from when
      the register is read. And the hardware accesses determined from the wrong
      hardware status can break the EC state machine. And there could be cases
      that the functionalities of the platform firmware are seriously affected.
      For example:
       1. When 2 EC_DATA(W) writes compete the IBF=0, the 2nd EC_DATA(W) write may
          be invalid due to IBF=1 after the 1st EC_DATA(W) write. Then the
          hardware will either refuse to respond a next EC_SC(W) write of the next
          command or discard the current WR_EC command when it receives a EC_SC(W)
          write of the next command.
       2. When 1 EC_SC(W) write and 1 EC_DATA(W) write compete the IBF=0, the
          EC_DATA(W) write may be invalid due to IBF=1 after the EC_SC(W) write.
          The next EC_DATA(R) could never be responded by the hardware. This is
          the root cause of the reported issue.
      
      Fix this issue by moving the EC_SC(R) access into the lock so that we can
      ensure that the state machine is advanced consistently.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911Reported-and-tested-by: default avatarGareth Williams <gareth@garethwilliams.me.uk>
      Reported-and-tested-by: default avatarHans de Goede <jwrdegoede@fedoraproject.org>
      Reported-by: default avatarBarton Xu <tank.xuhan@gmail.com>
      Tested-by: default avatarSteffen Weber <steffen.weber@gmail.com>
      Tested-by: default avatarArthur Chen <axchen@nvidia.com>
      Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      e9b3f9c5
    • Axel Lin's avatar
      hwmon: (adm1021) Fix cache problem when writing temperature limits · 9d3d2645
      Axel Lin authored
      commit c024044d upstream.
      
      The module test script for the adm1021 driver exposes a cache problem
      when writing temperature limits. temp_min and temp_max are expected
      to be stored in milli-degrees C but are stored in degrees C.
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      9d3d2645
    • Axel Lin's avatar
      hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div · fc3ea423
      Axel Lin authored
      commit 1035a9e3 upstream.
      
      Writing to fanX_div does not clear the cache. As a result, reading
      from fanX_div may return the old value for up to two seconds
      after writing a new value.
      
      This patch ensures the fan_div cache is updated in set_fan_div().
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      fc3ea423
    • Guenter Roeck's avatar
      hwmon: (adm1031) Fix writes to limit registers · b375dd27
      Guenter Roeck authored
      commit 145e74a4 upstream.
      
      Upper limit for write operations to temperature limit registers
      was clamped to a fractional value. However, limit registers do
      not support fractional values. As a result, upper limits of 127.5
      degrees C or higher resulted in a rounded limit of 128 degrees C.
      Since limit registers are signed, this was stored as -128 degrees C.
      Clamp limits to (-55, +127) degrees C to solve the problem.
      
      Value on writes to auto_temp[12]_min and auto_temp[12]_max were not
      clamped at all, but masked. As a result, out-of-range writes resulted
      in a more or less arbitrary limit. Clamp those attributes to (0, 127)
      degrees C for more predictable results.
      
      Cc: Axel Lin <axel.lin@ingics.com>
      Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      b375dd27
    • Guenter Roeck's avatar
      hwmon: (emc2103) Clamp limits instead of bailing out · 08efa418
      Guenter Roeck authored
      commit f6c2dd20 upstream.
      
      It is customary to clamp limits instead of bailing out with an error
      if a configured limit is out of the range supported by the driver.
      This simplifies limit configuration, since the user will not typically
      know chip and/or driver specific limits.
      Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      08efa418
    • Axel Lin's avatar
      hwmon: (amc6821) Fix permissions for temp2_input · b57dd1ad
      Axel Lin authored
      commit df86754b upstream.
      
      temp2_input should not be writable, fix it.
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      b57dd1ad
    • Aaron Lu's avatar
      thermal: hwmon: Make the check for critical temp valid consistent · c8052537
      Aaron Lu authored
      commit e8db5d67 upstream.
      
      On 05/21/2014 04:22 PM, Aaron Lu wrote:
      > On 05/21/2014 01:57 PM, Kui Zhang wrote:
      >> Hello,
      >>
      >> I get following error when rmmod thermal.
      >>
      >> rmmod  thermal
      >> Killed
      
      While dealing with this problem, I found another problem that also
      results in a kernel crash on thermal module removal:
      
      From: Aaron Lu <aaron.lu@intel.com>
      Date: Wed, 21 May 2014 16:05:38 +0800
      Subject: thermal: hwmon: Make the check for critical temp valid consistent
      
      We used the tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, temp)
      to decide if we need to create the temp_crit attribute file but we just
      check if tz->ops->get_crit_temp exists to decide if we need to remove
      that attribute file. Some ACPI thermal zone doesn't have a valid critical
      trip point and that would result in removing a non-existent device file
      on thermal module unload.
      Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      c8052537
    • Yasuaki Ishimatsu's avatar
      workqueue: zero cpumask of wq_numa_possible_cpumask on init · 9b8fa806
      Yasuaki Ishimatsu authored
      commit 5a6024f1 upstream.
      
      When hot-adding and onlining CPU, kernel panic occurs, showing following
      call trace.
      
        BUG: unable to handle kernel paging request at 0000000000001d08
        IP: [<ffffffff8114acfd>] __alloc_pages_nodemask+0x9d/0xb10
        PGD 0
        Oops: 0000 [#1] SMP
        ...
        Call Trace:
         [<ffffffff812b8745>] ? cpumask_next_and+0x35/0x50
         [<ffffffff810a3283>] ? find_busiest_group+0x113/0x8f0
         [<ffffffff81193bc9>] ? deactivate_slab+0x349/0x3c0
         [<ffffffff811926f1>] new_slab+0x91/0x300
         [<ffffffff815de95a>] __slab_alloc+0x2bb/0x482
         [<ffffffff8105bc1c>] ? copy_process.part.25+0xfc/0x14c0
         [<ffffffff810a3c78>] ? load_balance+0x218/0x890
         [<ffffffff8101a679>] ? sched_clock+0x9/0x10
         [<ffffffff81105ba9>] ? trace_clock_local+0x9/0x10
         [<ffffffff81193d1c>] kmem_cache_alloc_node+0x8c/0x200
         [<ffffffff8105bc1c>] copy_process.part.25+0xfc/0x14c0
         [<ffffffff81114d0d>] ? trace_buffer_unlock_commit+0x4d/0x60
         [<ffffffff81085a80>] ? kthread_create_on_node+0x140/0x140
         [<ffffffff8105d0ec>] do_fork+0xbc/0x360
         [<ffffffff8105d3b6>] kernel_thread+0x26/0x30
         [<ffffffff81086652>] kthreadd+0x2c2/0x300
         [<ffffffff81086390>] ? kthread_create_on_cpu+0x60/0x60
         [<ffffffff815f20ec>] ret_from_fork+0x7c/0xb0
         [<ffffffff81086390>] ? kthread_create_on_cpu+0x60/0x60
      
      In my investigation, I found the root cause is wq_numa_possible_cpumask.
      All entries of wq_numa_possible_cpumask is allocated by
      alloc_cpumask_var_node(). And these entries are used without initializing.
      So these entries have wrong value.
      
      When hot-adding and onlining CPU, wq_update_unbound_numa() is called.
      wq_update_unbound_numa() calls alloc_unbound_pwq(). And alloc_unbound_pwq()
      calls get_unbound_pool(). In get_unbound_pool(), worker_pool->node is set
      as follow:
      
      3592         /* if cpumask is contained inside a NUMA node, we belong to that node */
      3593         if (wq_numa_enabled) {
      3594                 for_each_node(node) {
      3595                         if (cpumask_subset(pool->attrs->cpumask,
      3596                                            wq_numa_possible_cpumask[node])) {
      3597                                 pool->node = node;
      3598                                 break;
      3599                         }
      3600                 }
      3601         }
      
      But wq_numa_possible_cpumask[node] does not have correct cpumask. So, wrong
      node is selected. As a result, kernel panic occurs.
      
      By this patch, all entries of wq_numa_possible_cpumask are allocated by
      zalloc_cpumask_var_node to initialize them. And the panic disappeared.
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Reviewed-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Fixes: bce90380 ("workqueue: add wq_numa_tbl_len and wq_numa_possible_cpumask[]")
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      9b8fa806
    • Gu Zheng's avatar
      cpuset,mempolicy: fix sleeping function called from invalid context · d9e8b4f6
      Gu Zheng authored
      commit 391acf97 upstream.
      
      When runing with the kernel(3.15-rc7+), the follow bug occurs:
      [ 9969.258987] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:586
      [ 9969.359906] in_atomic(): 1, irqs_disabled(): 0, pid: 160655, name: python
      [ 9969.441175] INFO: lockdep is turned off.
      [ 9969.488184] CPU: 26 PID: 160655 Comm: python Tainted: G       A      3.15.0-rc7+ #85
      [ 9969.581032] Hardware name: FUJITSU-SV PRIMEQUEST 1800E/SB, BIOS PRIMEQUEST 1000 Series BIOS Version 1.39 11/16/2012
      [ 9969.706052]  ffffffff81a20e60 ffff8803e941fbd0 ffffffff8162f523 ffff8803e941fd18
      [ 9969.795323]  ffff8803e941fbe0 ffffffff8109995a ffff8803e941fc58 ffffffff81633e6c
      [ 9969.884710]  ffffffff811ba5dc ffff880405c6b480 ffff88041fdd90a0 0000000000002000
      [ 9969.974071] Call Trace:
      [ 9970.003403]  [<ffffffff8162f523>] dump_stack+0x4d/0x66
      [ 9970.065074]  [<ffffffff8109995a>] __might_sleep+0xfa/0x130
      [ 9970.130743]  [<ffffffff81633e6c>] mutex_lock_nested+0x3c/0x4f0
      [ 9970.200638]  [<ffffffff811ba5dc>] ? kmem_cache_alloc+0x1bc/0x210
      [ 9970.272610]  [<ffffffff81105807>] cpuset_mems_allowed+0x27/0x140
      [ 9970.344584]  [<ffffffff811b1303>] ? __mpol_dup+0x63/0x150
      [ 9970.409282]  [<ffffffff811b1385>] __mpol_dup+0xe5/0x150
      [ 9970.471897]  [<ffffffff811b1303>] ? __mpol_dup+0x63/0x150
      [ 9970.536585]  [<ffffffff81068c86>] ? copy_process.part.23+0x606/0x1d40
      [ 9970.613763]  [<ffffffff810bf28d>] ? trace_hardirqs_on+0xd/0x10
      [ 9970.683660]  [<ffffffff810ddddf>] ? monotonic_to_bootbased+0x2f/0x50
      [ 9970.759795]  [<ffffffff81068cf0>] copy_process.part.23+0x670/0x1d40
      [ 9970.834885]  [<ffffffff8106a598>] do_fork+0xd8/0x380
      [ 9970.894375]  [<ffffffff81110e4c>] ? __audit_syscall_entry+0x9c/0xf0
      [ 9970.969470]  [<ffffffff8106a8c6>] SyS_clone+0x16/0x20
      [ 9971.030011]  [<ffffffff81642009>] stub_clone+0x69/0x90
      [ 9971.091573]  [<ffffffff81641c29>] ? system_call_fastpath+0x16/0x1b
      
      The cause is that cpuset_mems_allowed() try to take
      mutex_lock(&callback_mutex) under the rcu_read_lock(which was hold in
      __mpol_dup()). And in cpuset_mems_allowed(), the access to cpuset is
      under rcu_read_lock, so in __mpol_dup, we can reduce the rcu_read_lock
      protection region to protect the access to cpuset only in
      current_cpuset_is_being_rebound(). So that we can avoid this bug.
      
      This patch is a temporary solution that just addresses the bug
      mentioned above, can not fix the long-standing issue about cpuset.mems
      rebinding on fork():
      
      "When the forker's task_struct is duplicated (which includes
       ->mems_allowed) and it races with an update to cpuset_being_rebound
       in update_tasks_nodemask() then the task's mems_allowed doesn't get
       updated. And the child task's mems_allowed can be wrong if the
       cpuset's nodemask changes before the child has been added to the
       cgroup's tasklist."
      Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      d9e8b4f6
    • Maxime Bizon's avatar
      workqueue: fix dev_set_uevent_suppress() imbalance · 982170a3
      Maxime Bizon authored
      commit bddbceb6 upstream.
      
      Uevents are suppressed during attributes registration, but never
      restored, so kobject_uevent() does nothing.
      Signed-off-by: default avatarMaxime Bizon <mbizon@freebox.fr>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Fixes: 226223abSigned-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      982170a3
    • Jan Kardell's avatar
      iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends · 376a57d0
      Jan Kardell authored
      commit baa3c652 upstream.
      
      Since AI lines could be selected at will (linux-3.11) the sending
      and receiving ends of the FIFO does not agree about what step is used
      for a line. It only works if the last lines are used, like 5,6,7,
      and fails if ie 2,4,6 is selected in DT.
      Signed-off-by: default avatarJan Kardell <jan.kardell@telliq.com>
      Tested-by: default avatarZubair Lutfullah <zubair.lutfullah@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      376a57d0
    • Michal Sojka's avatar
    • Bert Vermeulen's avatar
      USB: ftdi_sio: Add extra PID. · 065cccd3
      Bert Vermeulen authored
      commit 5a7fbe7e upstream.
      
      This patch adds PID 0x0003 to the VID 0x128d (Testo). At least the
      Testo 435-4 uses this, likely other gear as well.
      Signed-off-by: default avatarBert Vermeulen <bert@biot.com>
      Cc: Johan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      065cccd3
    • Andras Kovacs's avatar
      USB: cp210x: add support for Corsair usb dongle · a74bd870
      Andras Kovacs authored
      commit b9326057 upstream.
      
      Corsair USB Dongles are shipped with Corsair AXi series PSUs.
      These are cp210x serial usb devices, so make driver detect these.
      I have a program, that can get information from these PSUs.
      
      Tested with 2 different dongles shipped with Corsair AX860i and
      AX1200i units.
      Signed-off-by: default avatarAndras Kovacs <andras@sth.sze.hu>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      a74bd870
    • Bernd Wachter's avatar
      usb: option: Add ID for Telewell TW-LTE 4G v2 · 04e38195
      Bernd Wachter authored
      commit 3d28bd84 upstream.
      
      Add ID of the Telewell 4G v2 hardware to option driver to get legacy
      serial interface working
      Signed-off-by: default avatarBernd Wachter <bernd.wachter@jolla.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      04e38195
    • Hugh Dickins's avatar
      mm: fix crashes from mbind() merging vmas · 3eef6e60
      Hugh Dickins authored
      commit d05f0cdc upstream.
      
      In v2.6.34 commit 9d8cebd4 ("mm: fix mbind vma merge problem")
      introduced vma merging to mbind(), but it should have also changed the
      convention of passing start vma from queue_pages_range() (formerly
      check_range()) to new_vma_page(): vma merging may have already freed
      that structure, resulting in BUG at mm/mempolicy.c:1738 and probably
      worse crashes.
      
      Fixes: 9d8cebd4 ("mm: fix mbind vma merge problem")
      Reported-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Tested-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Minchan Kim <minchan.kim@gmail.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 avatarJiri Slaby <jslaby@suse.cz>
      3eef6e60
    • Mikulas Patocka's avatar
      sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue · ae267ec9
      Mikulas Patocka authored
      commit fd1232b2 upstream.
      
      This patch fixes I/O errors with the sym53c8xx_2 driver when the disk
      returns QUEUE FULL status.
      
      When the controller encounters an error (including QUEUE FULL or BUSY
      status), it aborts all not yet submitted requests in the function
      sym_dequeue_from_squeue.
      
      This function aborts them with DID_SOFT_ERROR.
      
      If the disk has full tag queue, the request that caused the overflow is
      aborted with QUEUE FULL status (and the scsi midlayer properly retries
      it until it is accepted by the disk), but the sym53c8xx_2 driver aborts
      the following requests with DID_SOFT_ERROR --- for them, the midlayer
      does just a few retries and then signals the error up to sd.
      
      The result is that disk returning QUEUE FULL causes request failures.
      
      The error was reproduced on 53c895 with COMPAQ BD03685A24 disk
      (rebranded ST336607LC) with command queue 48 or 64 tags.  The disk has
      64 tags, but under some access patterns it return QUEUE FULL when there
      are less than 64 pending tags.  The SCSI specification allows returning
      QUEUE FULL anytime and it is up to the host to retry.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ae267ec9
    • Sander Eikelenboom's avatar
      ALSA: usb-audio: Prevent printk ratelimiting from spamming kernel log while DEBUG not defined · fbfba9cf
      Sander Eikelenboom authored
      commit b7a77235 upstream.
      
      This (widely used) construction:
      
      if(printk_ratelimit())
      	dev_dbg()
      
      Causes the ratelimiting to spam the kernel log with the "callbacks suppressed"
      message below, even while the dev_dbg it is supposed to rate limit wouldn't
      print anything because DEBUG is not defined for this device.
      
      [  533.803964] retire_playback_urb: 852 callbacks suppressed
      [  538.807930] retire_playback_urb: 852 callbacks suppressed
      [  543.811897] retire_playback_urb: 852 callbacks suppressed
      [  548.815745] retire_playback_urb: 852 callbacks suppressed
      [  553.819826] retire_playback_urb: 852 callbacks suppressed
      
      So use dev_dbg_ratelimited() instead of this construction.
      Signed-off-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      fbfba9cf
    • Tim Gardner's avatar
      ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb() · eae433b4
      Tim Gardner authored
      commit a5065eb6 upstream.
      
      BugLink: http://bugs.launchpad.net/bugs/1305133
      
      Malfunctioning or slow devices can cause a flood of dmesg SPAM.
      
      I've ignored checkpatch.pl complaints about the use of printk_ratelimit() in favour
      of prior art in sound/usb/pcm.c.
      
      WARNING: Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit
      +	if (printk_ratelimit() &&
      
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Eldad Zack <eldad@fogrefinery.com>
      Cc: Daniel Mack <zonque@gmail.com>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      eae433b4
    • Micky Ching's avatar
      mmc: rtsx: add R1-no-CRC mmc command type handle · c9fcc0e3
      Micky Ching authored
      commit 5027251e upstream.
      
      a27fbf2f ("mmc: add ignorance case for CMD13 CRC error") produced
      a cmd.flags unhandled in realtek pci host driver.  This will make MMC
      card fail to initialize, this patch is used to handle the new cmd.flags
      condition and MMC card can be used.
      Signed-off-by: default avatarMicky Ching <micky_ching@realsil.com.cn>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChris Ball <chris@printf.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      c9fcc0e3
    • Peter Hurley's avatar
      tty: Correct INPCK handling · ad4a4e1f
      Peter Hurley authored
      commit 66528f90 upstream.
      
      If INPCK is not set, input parity detection should be disabled. This means
      parity errors should not be received from the tty driver, and the data
      received should be treated normally.
      
      SUS v3, 11.2.2, General Terminal Interface - Input Modes, states:
        "If INPCK is set, input parity checking shall be enabled. If INPCK is
         not set, input parity checking shall be disabled, allowing output parity
         generation without input parity errors. Note that whether input parity
         checking is enabled or disabled is independent of whether parity detection
         is enabled or disabled (see Control Modes). If parity detection is enabled
         but input parity checking is disabled, the hardware to which the terminal
         is connected shall recognize the parity bit, but the terminal special file
         shall not check whether or not this bit is correctly set."
      
      Ignore parity errors reported by the tty driver when INPCK is not set, and
      handle the received data normally.
      
      Fixes: Bugzilla #71681, 'Improvement of n_tty_receive_parity_error from n_tty.c'
      Reported-by: default avatarIvan <athlon_@mail.ru>
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ad4a4e1f
    • Peter Hurley's avatar
      serial: Fix IGNBRK handling · 7d6467cf
      Peter Hurley authored
      commit ef8b9ddc upstream.
      
      If IGNBRK is set without either BRKINT or PARMRK set, some uart
      drivers send a 0x00 byte for BREAK without the TTYBREAK flag to the
      line discipline, when it should send either nothing or the TTYBREAK flag
      set. This happens because the read_status_mask masks out the BI
      condition, which uart_insert_char() then interprets as a normal 0x00 byte.
      
      SUS v3 is clear regarding the meaning of IGNBRK; Section 11.2.2, General
      Terminal Interface - Input Modes, states:
        "If IGNBRK is set, a break condition detected on input shall be ignored;
         that is, not put on the input queue and therefore not read by any
         process."
      
      Fix read_status_mask to include the BI bit if IGNBRK is set; the
      lsr status retains the BI bit if a BREAK is recv'd, which is
      subsequently ignored in uart_insert_char() when masked with the
      ignore_status_mask.
      
      Affected drivers:
      8250 - all
      serial_txx9
      mfd
      amba-pl010
      amba-pl011
      atmel_serial
      bfin_uart
      dz
      ip22zilog
      max310x
      mxs-auart
      netx-serial
      pnx8xxx_uart
      pxa
      sb1250-duart
      sccnxp
      serial_ks8695
      sirfsoc_uart
      st-asc
      vr41xx_siu
      zs
      sunzilog
      fsl_lpuart
      sunsab
      ucc_uart
      bcm63xx_uart
      sunsu
      efm32-uart
      pmac_zilog
      mpsc
      msm_serial
      m32r_sio
      
      Unaffected drivers:
      omap-serial
      rp2
      sa1100
      imx
      icom
      
      Annotated for fixes:
      altera_uart
      mcf
      
      Drivers without break detection:
      21285
      xilinx-uartps
      altera_jtaguart
      apbuart
      arc-uart
      clps711x
      max3100
      uartlite
      msm_serial_hs
      nwpserial
      lantiq
      vt8500_serial
      
      Unknown:
      samsung
      mpc52xx_uart
      bfin_sport_uart
      cpm_uart/core
      
      Fixes: Bugzilla #71651, '8250_core.c incorrectly handles IGNBRK flag'
      Reported-by: default avatarIvan <athlon_@mail.ru>
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      7d6467cf
    • Michal Nazarewicz's avatar
      mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER · c225b325
      Michal Nazarewicz authored
      commit dc78327c upstream.
      
      With a kernel configured with ARM64_64K_PAGES && !TRANSPARENT_HUGEPAGE,
      the following is triggered at early boot:
      
        SMP: Total of 8 processors activated.
        devtmpfs: initialized
        Unable to handle kernel NULL pointer dereference at virtual address 00000008
        pgd = fffffe0000050000
        [00000008] *pgd=00000043fba00003, *pmd=00000043fba00003, *pte=00e0000078010407
        Internal error: Oops: 96000006 [#1] SMP
        Modules linked in:
        CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.15.0-rc864k+ #44
        task: fffffe03bc040000 ti: fffffe03bc080000 task.ti: fffffe03bc080000
        PC is at __list_add+0x10/0xd4
        LR is at free_one_page+0x270/0x638
        ...
        Call trace:
          __list_add+0x10/0xd4
          free_one_page+0x26c/0x638
          __free_pages_ok.part.52+0x84/0xbc
          __free_pages+0x74/0xbc
          init_cma_reserved_pageblock+0xe8/0x104
          cma_init_reserved_areas+0x190/0x1e4
          do_one_initcall+0xc4/0x154
          kernel_init_freeable+0x204/0x2a8
          kernel_init+0xc/0xd4
      
      This happens because init_cma_reserved_pageblock() calls
      __free_one_page() with pageblock_order as page order but it is bigger
      than MAX_ORDER.  This in turn causes accesses past zone->free_list[].
      
      Fix the problem by changing init_cma_reserved_pageblock() such that it
      splits pageblock into individual MAX_ORDER pages if pageblock is bigger
      than a MAX_ORDER page.
      
      In cases where !CONFIG_HUGETLB_PAGE_SIZE_VARIABLE, which is all
      architectures expect for ia64, powerpc and tile at the moment, the
      “pageblock_order > MAX_ORDER” condition will be optimised out since both
      sides of the operator are constants.  In cases where pageblock size is
      variable, the performance degradation should not be significant anyway
      since init_cma_reserved_pageblock() is called only at boot time at most
      MAX_CMA_AREAS times which by default is eight.
      Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Reported-by: default avatarMark Salter <msalter@redhat.com>
      Tested-by: default avatarMark Salter <msalter@redhat.com>
      Tested-by: default avatarChristopher Covington <cov@codeaurora.org>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Cc: Catalin Marinas <catalin.marinas@arm.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 avatarJiri Slaby <jslaby@suse.cz>
      c225b325
    • Thomas Gleixner's avatar
      irqchip: spear_shirq: Fix interrupt offset · d90ff081
      Thomas Gleixner authored
      commit 4f436603 upstream.
      
      The ras3 block on spear320 claims to have 3 interrupts. In fact it has
      one and 6 reserved interrupts. Account the 6 reserved to this block so
      it has 7 interrupts total. That matches the datasheet and the device
      tree entries.
      
      Broken since commit 80515a5a(ARM: SPEAr3xx: shirq: simplify and move
      the shared irq multiplexor to DT). Testing is overrated....
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20140619212712.872379208@linutronix.de
      Fixes: 80515a5a ('ARM: SPEAr3xx: shirq: simplify and move the shared irq multiplexor to DT')
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      d90ff081
    • NeilBrown's avatar
      md: flush writes before starting a recovery. · f18a52f4
      NeilBrown authored
      commit 133d4527 upstream.
      
      When we write to a degraded array which has a bitmap, we
      make sure the relevant bit in the bitmap remains set when
      the write completes (so a 're-add' can quickly rebuilt a
      temporarily-missing device).
      
      If, immediately after such a write starts, we incorporate a spare,
      commence recovery, and skip over the region where the write is
      happening (because the 'needs recovery' flag isn't set yet),
      then that write will not get to the new device.
      
      Once the recovery finishes the new device will be trusted, but will
      have incorrect data, leading to possible corruption.
      
      We cannot set the 'needs recovery' flag when we start the write as we
      do not know easily if the write will be "degraded" or not.  That
      depends on details of the particular raid level and particular write
      request.
      
      This patch fixes a corruption issue of long standing and so it
      suitable for any -stable kernel.  It applied correctly to 3.0 at
      least and will minor editing to earlier kernels.
      Reported-by: default avatarBill <billstuff2001@sbcglobal.net>
      Tested-by: default avatarBill <billstuff2001@sbcglobal.net>
      Link: http://lkml.kernel.org/r/53A518BB.60709@sbcglobal.netSigned-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      f18a52f4
    • Steven Rostedt (Red Hat)'s avatar
      tracing: Remove ftrace_stop/start() from reading the trace file · 19a01928
      Steven Rostedt (Red Hat) authored
      commit 099ed151 upstream.
      
      Disabling reading and writing to the trace file should not be able to
      disable all function tracing callbacks. There's other users today
      (like kprobes and perf). Reading a trace file should not stop those
      from happening.
      Reviewed-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      19a01928
    • Michal Nazarewicz's avatar
      tools: ffs-test: fix header values endianess · cb116d6b
      Michal Nazarewicz authored
      commit f35f7124 upstream.
      
      It appears that no one ever run ffs-test on a big-endian machine,
      since it used cpu-endianess for fs_count and hs_count fields which
      should be in little-endian format.  Fix by wrapping the numbers in
      cpu_to_le32.
      Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      cb116d6b
    • J. Bruce Fields's avatar
      nfsd: fix rare symlink decoding bug · 12ea9001
      J. Bruce Fields authored
      commit 76f47128 upstream.
      
      An NFS operation that creates a new symlink includes the symlink data,
      which is xdr-encoded as a length followed by the data plus 0 to 3 bytes
      of zero-padding as required to reach a 4-byte boundary.
      
      The vfs, on the other hand, wants null-terminated data.
      
      The simple way to handle this would be by copying the data into a newly
      allocated buffer with space for the final null.
      
      The current nfsd_symlink code tries to be more clever by skipping that
      step in the (likely) case where the byte following the string is already
      0.
      
      But that assumes that the byte following the string is ours to look at.
      In fact, it might be the first byte of a page that we can't read, or of
      some object that another task might modify.
      
      Worse, the NFSv4 code tries to fix the problem by actually writing to
      that byte.
      
      In the NFSv2/v3 cases this actually appears to be safe:
      
      	- nfs3svc_decode_symlinkargs explicitly null-terminates the data
      	  (after first checking its length and copying it to a new
      	  page).
      	- NFSv2 limits symlinks to 1k.  The buffer holding the rpc
      	  request is always at least a page, and the link data (and
      	  previous fields) have maximum lengths that prevent the request
      	  from reaching the end of a page.
      
      In the NFSv4 case the CREATE op is potentially just one part of a long
      compound so can end up on the end of a page if you're unlucky.
      
      The minimal fix here is to copy and null-terminate in the NFSv4 case.
      The nfsd_symlink() interface here seems too fragile, though.  It should
      really either do the copy itself every time or just require a
      null-terminated string.
      Reported-by: default avatarJeff Layton <jlayton@primarydata.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      12ea9001
    • Adam Thomson's avatar
      iio: of_iio_channel_get_by_name() returns non-null pointers for error legs · 8f2574b7
      Adam Thomson authored
      commit a2c12493 upstream.
      
      Currently in the inkern.c code for IIO framework, the function
      of_iio_channel_get_by_name() will return a non-NULL pointer when
      it cannot find a channel using of_iio_channel_get() and when it
      tries to search for 'io-channel-ranges' property and fails. This
      is incorrect behaviour as the function which calls this expects
      a NULL pointer for failure. This patch rectifies the issue.
      Signed-off-by: default avatarAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      8f2574b7