All of lore.kernel.org
 help / color / mirror / Atom feed
* [3.11.y.z extended stable] Linux 3.11.10.14 stable review
@ 2014-07-24  9:44 Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 001/128] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Luis Henriques
                   ` (127 more replies)
  0 siblings, 128 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Luis Henriques

This is the start of the review cycle for the Linux 3.11.10.14 stable kernel.

This version contains 128 new patches, summarized below.  The new patches are
posted as replies to this message and also available in this git branch:

http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.11.y-review;a=shortlog

git://kernel.ubuntu.com/ubuntu/linux.git  linux-3.11.y-review

The review period for version 3.11.10.14 will be open for the next three days.
To report a problem, please reply to the relevant follow-up patch message.

For more information about the Linux 3.11.y.z extended stable kernel version,
see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .

 -Luis

--
 Documentation/sysctl/vm.txt                  |   3 +-
 arch/arc/include/uapi/asm/ptrace.h           |   1 +
 arch/arc/kernel/ptrace.c                     |   4 +
 arch/arm/mach-omap2/mux.c                    |   6 +-
 arch/arm64/include/asm/memory.h              |   2 +
 arch/arm64/mm/flush.c                        |   3 +-
 arch/mips/kernel/irq-msc01.c                 |   2 +-
 arch/mips/kvm/kvm_mips.c                     |  13 +-
 arch/powerpc/include/asm/perf_event_server.h |   3 +-
 arch/powerpc/kernel/time.c                   |   2 +-
 arch/powerpc/lib/sstep.c                     |   2 +-
 arch/powerpc/perf/core-book3s.c              |  24 ++-
 arch/powerpc/perf/power8-pmu.c               |   2 +-
 arch/score/Kconfig                           |   3 +
 arch/score/Makefile                          |   4 +-
 arch/score/include/asm/checksum.h            |  93 ++++++------
 arch/score/include/asm/io.h                  |   1 -
 arch/score/include/asm/pgalloc.h             |   2 +-
 arch/score/kernel/entry.S                    |   4 +-
 arch/score/kernel/process.c                  |   4 +-
 arch/x86/crypto/sha512_ssse3_glue.c          |   2 +-
 arch/x86/include/asm/kvm_host.h              |   4 +-
 arch/x86/include/asm/ptrace.h                |  16 ++
 arch/x86/mm/ioremap.c                        |  26 +++-
 block/blk-cgroup.c                           |   7 +-
 block/blk-cgroup.h                           |  17 +--
 drivers/acpi/battery.c                       |  27 +++-
 drivers/acpi/ec.c                            | 128 ++++++++--------
 drivers/block/rbd.c                          |  19 ++-
 drivers/clk/spear/spear3xx_clock.c           |   2 +-
 drivers/cpufreq/Makefile                     |   2 +-
 drivers/cpufreq/intel_pstate.c               |   2 +-
 drivers/firmware/efi/efi-pstore.c            |   2 +-
 drivers/gpu/drm/drm_drv.c                    |   3 +-
 drivers/gpu/drm/radeon/cikd.h                |   2 +-
 drivers/gpu/drm/radeon/cypress_dpm.c         |   2 +-
 drivers/gpu/drm/radeon/evergreen.c           |   8 +-
 drivers/gpu/drm/radeon/ni_dpm.c              |   2 +-
 drivers/gpu/drm/radeon/rv770_dpm.c           |   6 -
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c           |   1 -
 drivers/hv/connection.c                      |   8 +-
 drivers/hwmon/adm1021.c                      |  14 +-
 drivers/hwmon/adm1029.c                      |   3 +
 drivers/hwmon/adm1031.c                      |   8 +-
 drivers/hwmon/amc6821.c                      |   2 +-
 drivers/hwmon/emc2103.c                      |  25 ++--
 drivers/iio/adc/ti_am335x_adc.c              |   2 +-
 drivers/iio/inkern.c                         |   6 +-
 drivers/irqchip/spear-shirq.c                |   2 +-
 drivers/md/dm-io.c                           |  22 +--
 drivers/md/md.c                              |  13 ++
 drivers/misc/mei/hw-me.c                     |  14 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c  |   1 +
 drivers/net/wireless/b43/xmit.c              |  10 +-
 drivers/net/wireless/rt2x00/rt2500pci.c      |   7 +-
 drivers/net/wireless/rt2x00/rt2x00.h         |   1 +
 drivers/net/wireless/rt2x00/rt2x00dev.c      |  24 ++-
 drivers/net/wireless/rt2x00/rt2x00mac.c      |   2 +
 drivers/pci/pci.c                            |   2 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c             |  13 +-
 drivers/scsi/scsi_error.c                    |   9 ++
 drivers/scsi/sym53c8xx_2/sym_hipd.c          |   4 +
 drivers/scsi/virtio_scsi.c                   |  26 +++-
 drivers/target/iscsi/iscsi_target.c          |   2 +-
 drivers/target/iscsi/iscsi_target_util.c     |   2 +
 drivers/target/target_core_device.c          |   1 +
 drivers/thermal/thermal_core.c               |  33 +++--
 drivers/usb/chipidea/udc.c                   |   7 +
 drivers/usb/gadget/f_fs.c                    |  12 +-
 drivers/usb/host/xhci-hub.c                  |   5 +-
 drivers/usb/host/xhci-ring.c                 |   2 +-
 drivers/usb/host/xhci.c                      |  10 +-
 drivers/usb/musb/ux500.c                     |   1 -
 drivers/usb/serial/cp210x.c                  |   1 +
 drivers/usb/serial/ftdi_sio.c                |  12 +-
 drivers/usb/serial/ftdi_sio_ids.h            |   9 +-
 drivers/usb/serial/option.c                  |  28 +++-
 fs/btrfs/backref.c                           |  32 ++--
 fs/btrfs/backref.h                           |   4 +-
 fs/btrfs/disk-io.c                           |   5 +
 fs/btrfs/extent_io.c                         |   4 +-
 fs/btrfs/free-space-cache.c                  |   4 +-
 fs/btrfs/scrub.c                             |   5 +-
 fs/btrfs/send.c                              |   4 +
 fs/btrfs/volumes.c                           |  44 ++++--
 fs/cifs/cifs_unicode.c                       |   7 +-
 fs/ext4/ialloc.c                             |  14 +-
 fs/ext4/indirect.c                           |  20 ++-
 fs/ext4/super.c                              |   9 +-
 fs/jbd2/transaction.c                        |   5 +-
 fs/nfsd/nfs4proc.c                           |   9 --
 fs/nfsd/nfs4xdr.c                            |  13 +-
 fs/proc/stat.c                               |  22 +--
 include/linux/ptrace.h                       |   3 +
 include/linux/ring_buffer.h                  |   2 +-
 include/trace/syscall.h                      |  15 ++
 kernel/cpuset.c                              |   8 +-
 kernel/fork.c                                |   2 +
 kernel/rtmutex.c                             | 210 +++++++++++++++++++++++----
 kernel/sysctl.c                              |   3 +-
 kernel/trace/ring_buffer.c                   |   5 +-
 kernel/trace/trace.c                         |  40 +++--
 kernel/trace/trace.h                         |   4 +-
 kernel/workqueue.c                           |   3 +-
 lib/lz4/lz4_decompress.c                     |  12 +-
 mm/hugetlb.c                                 |  70 +++++----
 mm/mempolicy.c                               |  48 +++---
 mm/page_alloc.c                              |  56 +++++--
 mm/vmscan.c                                  |  11 +-
 net/bluetooth/hci_conn.c                     |   2 +-
 net/bluetooth/hci_event.c                    |  11 +-
 net/bluetooth/l2cap_sock.c                   |   5 -
 net/bluetooth/mgmt.c                         |   7 +-
 net/mac80211/ibss.c                          |   1 +
 net/netfilter/ipvs/ip_vs_ctl.c               |   2 +-
 net/netfilter/nf_nat_core.c                  |  35 ++++-
 scripts/recordmcount.h                       |   4 +-
 sound/usb/card.c                             |  13 +-
 sound/usb/endpoint.c                         |  17 ++-
 sound/usb/endpoint.h                         |   1 +
 tools/usb/ffs-test.c                         |   4 +-
 121 files changed, 1081 insertions(+), 513 deletions(-)

Aaron Lu (1):
      thermal: hwmon: Make the check for critical temp valid consistent

Adam Thomson (1):
      iio: of_iio_channel_get_by_name() returns non-null pointers for error legs

Alex Deucher (4):
      drm/radeon/dpm: fix typo in vddci setup for eg/btc
      drm/radeon/dpm: fix vddci setup typo on cayman
      drm/radeon/cik: fix typo in EOP packet
      drm/radeon: fix typo in golden register setup on evergreen

Alex Elder (1):
      rbd: use reference counts for image requests

Alex Smith (1):
      recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules

Alexandre Demers (1):
      drm/radeon/dpm: Reenabling SS on Cayman

Andras Kovacs (1):
      USB: cp210x: add support for Corsair usb dongle

Andrzej Zaborowski (1):
      efi-pstore: Fix an overflow on 32-bit builds

Anton Blanchard (1):
      powerpc/perf: Never program book3s PMCs with values >= 0x80000000

Anton Kolesov (1):
      ARC: Implement ptrace(PTRACE_GET_THREAD_AREA)

Axel Lin (3):
      hwmon: (amc6821) Fix permissions for temp2_input
      hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
      hwmon: (adm1021) Fix cache problem when writing temperature limits

Bernd Wachter (1):
      usb: option: Add ID for Telewell TW-LTE 4G v2

Bert Vermeulen (1):
      USB: ftdi_sio: Add extra PID.

Bjorn Helgaas (1):
      PCI: Fix incorrect vgaarb conditional in WARN_ON()

Bjørn Mork (1):
      usb: option: add/modify Olivetti Olicard modems

Brian King (2):
      ibmvscsi: Abort init sequence during error recovery
      ibmvscsi: Add memory barriers for send / receive

Colin Cross (1):
      arm64: implement TASK_SIZE_OF

David R. Piegdon (1):
      ARM: OMAP2+: Fix parser-bug in platform muxing code

David Rientjes (1):
      mm, pcp: allow restoring percpu_pagelist_fraction default

Deng-Cheng Zhu (1):
      MIPS: KVM: Fix memory leak on VCPU

Eric Sandeen (2):
      btrfs: fix use of uninit "ret" in end_extent_writepage()
      ext4: disable synchronous transaction batching if max_batch_time==0

Filipe Manana (1):
      Btrfs: send, don't error in the presence of subvols/snapshots

Florian Westphal (1):
      netfilter: nf_nat: fix oops on netns removal

Greg Kroah-Hartman (3):
      lz4: ensure length does not wrap
      lz4: fix another possible overrun
      lz4: add overrun checks to lz4_uncompress_unknownoutputsize()

Gu Zheng (1):
      cpuset,mempolicy: fix sleeping function called from invalid context

Guenter Roeck (2):
      hwmon: (adm1031) Fix writes to limit registers
      hwmon: (emc2103) Clamp limits instead of bailing out

Heiko Carstens (1):
      /proc/stat: convert to single_open_size()

Hugh Dickins (1):
      mm: fix crashes from mbind() merging vmas

Ilya Dryomov (1):
      rbd: handle parent_overlap on writes correctly

J. Bruce Fields (1):
      nfsd: fix rare symlink decoding bug

James Bottomley (1):
      [SCSI] Fix spurious request sense in error handling

James Hogan (1):
      MIPS: KVM: Remove redundant NULL checks before kfree()

Jan Kara (2):
      ext4: Fix buffer double free in ext4_alloc_branch()
      ext4: Fix hole punching for files with indirect blocks

Jan Kardell (1):
      iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends

Joe Thornber (1):
      dm io: fix a race condition in the wake up code for sync_io

Joel Stanley (2):
      powerpc/perf: Add PPMU_ARCH_207S define
      powerpc/perf: Clear MMCR2 when enabling PMU

Johan Hedberg (4):
      Bluetooth: Fix check for connection encryption
      Bluetooth: Fix SSP acceptor just-works confirmation without MITM
      Bluetooth: Fix indicating discovery state when canceling inquiry
      Bluetooth: Fix locking of hdev when calling into SMP code

Johan Hovold (1):
      USB: ftdi_sio: fix null deref at port probe

Julian Anastasov (1):
      ipvs: stop tot_stats estimator only under CONFIG_SYSCTL

Jussi Kivilinna (1):
      crypto: sha512_ssse3 - fix byte count to bit count conversion

K. Y. Srinivasan (1):
      Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code

Krzysztof Hałasa (1):
      mac80211: fix IBSS join by initializing last_scan_completed

Lan Tianyu (1):
      ACPI / battery: Retry to get battery information if failed during probing

Lennox Wu (3):
      Score: Implement the function csum_ipv6_magic
      Score: The commit is for compiling successfully.
      Score: Modify the Makefile of Score, remove -mlong-calls for compiling

Linus Torvalds (1):
      Don't trigger congestion wait on dirty-but-not-writeout pages

Linus Walleij (1):
      usb: musb: ux500: don't propagate the OF node

Liu Bo (4):
      Btrfs: fix NULL pointer crash of deleting a seed device
      Btrfs: mark mapping with error flag to report errors to userspace
      Btrfs: use right type to get real comparison
      Btrfs: fix scrub_print_warning to handle skinny metadata extents

Lu Baolu (1):
      xhci: clear root port wake on bits if controller isn't wake-up capable

Lv Zheng (4):
      ACPI / EC: Avoid race condition related to advance_transaction()
      ACPI / EC: Add asynchronous command byte write support
      ACPI / EC: Remove duplicated ec_wait_ibf0() waiter
      ACPI / EC: Fix race condition in ec_transaction_completed()

Marcin Kraglak (1):
      Bluetooth: Allow change security level on ATT_CID in slave role

Markos Chandras (1):
      MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region

Mathias Nyman (1):
      xhci: correct burst count field for isoc transfers on 1.0 xhci hosts

Maxime Bizon (1):
      workqueue: fix dev_set_uevent_suppress() imbalance

Maxime Ripard (1):
      net: allwinner: emac: Add missing free_irq

Miao Xie (1):
      Btrfs: output warning instead of error when loading free space cache failed

Michal Nazarewicz (3):
      usb: gadget: f_fs: fix NULL pointer dereference when there are no strings
      tools: ffs-test: fix header values endianess
      mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER

Michal Sojka (1):
      USB: serial: ftdi_sio: Add Infineon Triboard

Mikulas Patocka (1):
      sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue

Nadav Amit (1):
      KVM: x86: Increase the number of fixed MTRR regs to 10

Naoya Horiguchi (2):
      hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry
      mm: hugetlb: fix copy_hugetlb_page_range()

NeilBrown (1):
      md: flush writes before starting a recovery.

Nicholas Bellinger (3):
      target: Fix left-over se_lun->lun_sep pointer OOPs
      iscsi-target: Explicily clear login response PDU in exception path
      iscsi-target: Avoid rejecting incorrect ITT for Data-Out

Oleg Nesterov (1):
      tracing: Fix syscall_*regfunc() vs copy_process() race

Oliver Neukum (1):
      USB: option: add device ID for SpeedUp SU9800 usb 3g modem

Paolo Bonzini (3):
      KVM: x86: preserve the high 32-bits of the PAT register
      virtio-scsi: avoid cancelling uninitialized work items
      virtio-scsi: fix various bad behavior on aborted requests

Paul Bolle (2):
      powerpc: fix typo 'CONFIG_PPC_CPU'
      powerpc: fix typo 'CONFIG_PMAC'

Peter Chen (1):
      usb: chipidea: udc: delete td from req's td list at ep_dequeue

Prabhakar Lad (1):
      cpufreq: Makefile: fix compilation for davinci platform

Qu Wenruo (1):
      btrfs: Add ctime/mtime update for btrfs device add/remove.

Rafał Miłecki (1):
      b43: fix frequency reported on G-PHY with /new/ firmware

Rickard Strandqvist (1):
      fs: btrfs: volumes.c: Fix for possible null pointer dereference

Roland Dreier (1):
      x86, ioremap: Speed up check for RAM pages

Sachin Kamat (1):
      hwmon: (emc2103) Fix return value

Stanislaw Gruszka (2):
      rt2x00: disable TKIP on USB
      rt2x00: fix rfkill regression on rt2500pci

Steve Capper (1):
      arm64: mm: Make icache synchronisation logic huge page aware

Steve French (1):
      [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option

Steven Rostedt (Red Hat) (3):
      tracing: Try again for saved cmdline if failed due to locking
      ring-buffer: Check if buffer exists before polling
      tracing: Remove ftrace_stop/start() from reading the trace file

Takashi Iwai (1):
      ALSA: usb-audio: Fix races at disconnection and PCM closing

Tejun Heo (2):
      blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t
      ptrace,x86: force IRET path after a ptrace_stop()

Theodore Ts'o (2):
      ext4: fix unjournalled bg descriptor while initializing inode bitmap
      ext4: clarify error count warning messages

Thomas Gleixner (4):
      irqchip: spear_shirq: Fix interrupt offset
      rtmutex: Detect changes in the pi lock chain
      rtmutex: Plug slow unlock race
      clk: spear3xx: Use proper control register offset

Thomas Hellstrom (1):
      drm/vmwgfx: Fix incorrect write to read-only register v2:

Tomas Winkler (1):
      mei: me: fix hw ready reset flow

Vincent Minet (1):
      intel_pstate: Set CPU number before accessing MSRs

Wang Shilong (2):
      Btrfs: make sure there are not any read requests before stopping workers
      Btrfs: set right total device count for seeding support

Wang, Yu (1):
      xhci: Fix runtime suspended xhci from blocking system suspend.

Yasuaki Ishimatsu (1):
      workqueue: zero cpumask of wq_numa_possible_cpumask on init

Zhaowei Yuan (1):
      drm: fix NULL pointer access by wrong ioctl

^ permalink raw reply	[flat|nested] 134+ messages in thread

* [PATCH 3.11 001/128] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 002/128] MIPS: KVM: Remove redundant NULL checks before kfree() Luis Henriques
                   ` (126 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Matthew Wilcox, James Bottomley, Linus Torvalds,
	Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit fd1232b214af43a973443aec6a2808f16ee5bf70 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: Mikulas Patocka <mpatocka@redhat.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/sym53c8xx_2/sym_hipd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index d92fe4037e94..6b349e301869 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -3000,7 +3000,11 @@ sym_dequeue_from_squeue(struct sym_hcb *np, int i, int target, int lun, int task
 		if ((target == -1 || cp->target == target) &&
 		    (lun    == -1 || cp->lun    == lun)    &&
 		    (task   == -1 || cp->tag    == task)) {
+#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING
 			sym_set_cam_status(cp->cmd, DID_SOFT_ERROR);
+#else
+			sym_set_cam_status(cp->cmd, DID_REQUEUE);
+#endif
 			sym_remque(&cp->link_ccbq);
 			sym_insque_tail(&cp->link_ccbq, &np->comp_ccbq);
 		}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 002/128] MIPS: KVM: Remove redundant NULL checks before kfree()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 001/128] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 003/128] MIPS: KVM: Fix memory leak on VCPU Luis Henriques
                   ` (125 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Paolo Bonzini, Gleb Natapov, kvm, Ralf Baechle,
	linux-mips, Sanjay Lal, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hogan <james.hogan@imgtec.com>

commit c6c0a6637f9da54f9472144d44f71cf847f92e20 upstream.

The kfree() function already NULL checks the parameter so remove the
redundant NULL checks before kfree() calls in arch/mips/kvm/.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Sanjay Lal <sanjayl@kymasys.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/kvm/kvm_mips.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 426345ac6f6e..7e78af0e57de 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -149,9 +149,7 @@ void kvm_mips_free_vcpus(struct kvm *kvm)
 		if (kvm->arch.guest_pmap[i] != KVM_INVALID_PAGE)
 			kvm_mips_release_pfn_clean(kvm->arch.guest_pmap[i]);
 	}
-
-	if (kvm->arch.guest_pmap)
-		kfree(kvm->arch.guest_pmap);
+	kfree(kvm->arch.guest_pmap);
 
 	kvm_for_each_vcpu(i, vcpu, kvm) {
 		kvm_arch_vcpu_free(vcpu);
@@ -384,12 +382,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
 
 	kvm_mips_dump_stats(vcpu);
 
-	if (vcpu->arch.guest_ebase)
-		kfree(vcpu->arch.guest_ebase);
-
-	if (vcpu->arch.kseg0_commpage)
-		kfree(vcpu->arch.kseg0_commpage);
-
+	kfree(vcpu->arch.guest_ebase);
+	kfree(vcpu->arch.kseg0_commpage);
 }
 
 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 003/128] MIPS: KVM: Fix memory leak on VCPU
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 001/128] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 002/128] MIPS: KVM: Remove redundant NULL checks before kfree() Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 004/128] btrfs: Add ctime/mtime update for btrfs device add/remove Luis Henriques
                   ` (124 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Deng-Cheng Zhu, Paolo Bonzini, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>

commit 8c9eb041cf76038eb3b62ee259607eec9b89f48d upstream.

kvm_arch_vcpu_free() is called in 2 code paths:

1) kvm_vm_ioctl()
       kvm_vm_ioctl_create_vcpu()
           kvm_arch_vcpu_destroy()
               kvm_arch_vcpu_free()
2) kvm_put_kvm()
       kvm_destroy_vm()
           kvm_arch_destroy_vm()
               kvm_mips_free_vcpus()
                   kvm_arch_vcpu_free()

Neither of the paths handles VCPU free. We need to do it in
kvm_arch_vcpu_free() corresponding to the memory allocation in
kvm_arch_vcpu_create().

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/kvm/kvm_mips.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 7e78af0e57de..2c7b3ade8ec0 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -384,6 +384,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
 
 	kfree(vcpu->arch.guest_ebase);
 	kfree(vcpu->arch.kseg0_commpage);
+	kfree(vcpu);
 }
 
 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 004/128] btrfs: Add ctime/mtime update for btrfs device add/remove.
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (2 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 003/128] MIPS: KVM: Fix memory leak on VCPU Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 005/128] Btrfs: output warning instead of error when loading free space cache failed Luis Henriques
                   ` (123 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Karel Zak, Qu Wenruo, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Qu Wenruo <quwenruo@cn.fujitsu.com>

commit 5a1972bd9fd4b2fb1bac8b7a0b636d633d8717e3 upstream.

Btrfs will send uevent to udev inform the device change,
but ctime/mtime for the block device inode is not udpated, which cause
libblkid used by btrfs-progs unable to detect device change and use old
cache, causing 'btrfs dev scan; btrfs dev rmove; btrfs dev scan' give an
error message.

Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Cc: Karel Zak <kzak@redhat.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/volumes.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index feb93fc9863d..cacdb3effa35 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1403,6 +1403,22 @@ out:
 	return ret;
 }
 
+/*
+ * Function to update ctime/mtime for a given device path.
+ * Mainly used for ctime/mtime based probe like libblkid.
+ */
+static void update_dev_time(char *path_name)
+{
+	struct file *filp;
+
+	filp = filp_open(path_name, O_RDWR, 0);
+	if (!filp)
+		return;
+	file_update_time(filp);
+	filp_close(filp, NULL);
+	return;
+}
+
 static int btrfs_rm_dev_item(struct btrfs_root *root,
 			     struct btrfs_device *device)
 {
@@ -1649,10 +1665,14 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
 
 	ret = 0;
 
-	/* Notify udev that device has changed */
-	if (bdev)
+	if (bdev) {
+		/* Notify udev that device has changed */
 		btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
 
+		/* Update ctime/mtime for device path for libblkid */
+		update_dev_time(device_path);
+	}
+
 error_brelse:
 	brelse(bh);
 	if (bdev)
@@ -2096,6 +2116,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
 		ret = btrfs_commit_transaction(trans, root);
 	}
 
+	/* Update ctime/mtime for libblkid */
+	update_dev_time(device_path);
 	return ret;
 
 error_trans:
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 005/128] Btrfs: output warning instead of error when loading free space cache failed
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (3 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 004/128] btrfs: Add ctime/mtime update for btrfs device add/remove Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 006/128] Btrfs: make sure there are not any read requests before stopping workers Luis Henriques
                   ` (122 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Miao Xie, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Miao Xie <miaox@cn.fujitsu.com>

commit 32d6b47fe6fc1714d5f1bba1b9f38e0ab0ad58a8 upstream.

If we fail to load a free space cache, we can rebuild it from the extent tree,
so it is not a serious error, we should not output a error message that
would make the users uncomfortable. This patch uses warning message instead
of it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/free-space-cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index b21a3cd667d8..cd9d696c489d 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -835,7 +835,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
 
 	if (!matched) {
 		__btrfs_remove_free_space_cache(ctl);
-		btrfs_err(fs_info, "block group %llu has wrong amount of free space",
+		btrfs_warn(fs_info, "block group %llu has wrong amount of free space",
 			block_group->key.objectid);
 		ret = -1;
 	}
@@ -847,7 +847,7 @@ out:
 		spin_unlock(&block_group->lock);
 		ret = 0;
 
-		btrfs_err(fs_info, "failed to load free space cache for block group %llu",
+		btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuild it now",
 			block_group->key.objectid);
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 006/128] Btrfs: make sure there are not any read requests before stopping workers
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (4 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 005/128] Btrfs: output warning instead of error when loading free space cache failed Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 007/128] Btrfs: fix NULL pointer crash of deleting a seed device Luis Henriques
                   ` (121 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Wang Shilong, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>

commit de348ee022175401e77d7662b7ca6e231a94e3fd upstream.

In close_ctree(), after we have stopped all workers,there maybe still
some read requests(for example readahead) to submit and this *maybe* trigger
an oops that user reported before:

kernel BUG at fs/btrfs/async-thread.c:619!

By hacking codes, i can reproduce this problem with one cpu available.
We fix this potential problem by invalidating all btree inode pages before
stopping all workers.

Thanks to Miao for pointing out this problem.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/disk-io.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 3ce443662607..9001c263bc79 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3554,6 +3554,11 @@ int close_ctree(struct btrfs_root *root)
 
 	btrfs_free_block_groups(fs_info);
 
+	/*
+	 * we must make sure there is not any read request to
+	 * submit after we stopping all workers.
+	 */
+	invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
 	btrfs_stop_all_workers(fs_info);
 
 	del_fs_roots(fs_info);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 007/128] Btrfs: fix NULL pointer crash of deleting a seed device
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (5 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 006/128] Btrfs: make sure there are not any read requests before stopping workers Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 008/128] Btrfs: mark mapping with error flag to report errors to userspace Luis Henriques
                   ` (120 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Murphy, Liu Bo, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Liu Bo <bo.li.liu@oracle.com>

commit 29cc83f69c8338ff8fd1383c9be263d4bdf52d73 upstream.

Same as normal devices, seed devices should be initialized with
fs_info->dev_root as well, otherwise we'll get a NULL pointer crash.

Cc: Chris Murphy <lists@colorremedies.com>
Reported-by: Chris Murphy <lists@colorremedies.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/volumes.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index cacdb3effa35..f79b027fa0f1 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5730,10 +5730,14 @@ void btrfs_init_devices_late(struct btrfs_fs_info *fs_info)
 	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
 	struct btrfs_device *device;
 
-	mutex_lock(&fs_devices->device_list_mutex);
-	list_for_each_entry(device, &fs_devices->devices, dev_list)
-		device->dev_root = fs_info->dev_root;
-	mutex_unlock(&fs_devices->device_list_mutex);
+	while (fs_devices) {
+		mutex_lock(&fs_devices->device_list_mutex);
+		list_for_each_entry(device, &fs_devices->devices, dev_list)
+			device->dev_root = fs_info->dev_root;
+		mutex_unlock(&fs_devices->device_list_mutex);
+
+		fs_devices = fs_devices->seed;
+	}
 }
 
 static void __btrfs_reset_dev_stats(struct btrfs_device *dev)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 008/128] Btrfs: mark mapping with error flag to report errors to userspace
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (6 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 007/128] Btrfs: fix NULL pointer crash of deleting a seed device Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 009/128] Btrfs: set right total device count for seeding support Luis Henriques
                   ` (119 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Liu Bo, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Liu Bo <bo.li.liu@oracle.com>

commit 5dca6eea91653e9949ce6eb9e9acab6277e2f2c4 upstream.

According to commit 865ffef3797da2cac85b3354b5b6050dc9660978
(fs: fix fsync() error reporting),
it's not stable to just check error pages because pages can be
truncated or invalidated, we should also mark mapping with error
flag so that a later fsync can catch the error.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/extent_io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 6c80e0801e58..479d5aecd708 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2401,6 +2401,8 @@ int end_extent_writepage(struct page *page, int err, u64 start, u64 end)
 	if (!uptodate) {
 		ClearPageUptodate(page);
 		SetPageError(page);
+		ret = ret < 0 ? ret : -EIO;
+		mapping_set_error(page->mapping, ret);
 	}
 	return 0;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 009/128] Btrfs: set right total device count for seeding support
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (7 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 008/128] Btrfs: mark mapping with error flag to report errors to userspace Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 010/128] Btrfs: send, don't error in the presence of subvols/snapshots Luis Henriques
                   ` (118 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Wang Shilong, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>

commit 298658414a2f0bea1f05a81876a45c1cd96aa2e0 upstream.

Seeding device support allows us to create a new filesystem
based on existed filesystem.

However newly created filesystem's @total_devices should include seed
devices. This patch fix the following problem:

 # mkfs.btrfs -f /dev/sdb
 # btrfstune -S 1 /dev/sdb
 # mount /dev/sdb /mnt
 # btrfs device add -f /dev/sdc /mnt --->fs_devices->total_devices = 1
 # umount /mnt
 # mount /dev/sdc /mnt               --->fs_devices->total_devices = 2

This is because we record right @total_devices in superblock, but
@fs_devices->total_devices is reset to be 0 in btrfs_prepare_sprout().

Fix this problem by not resetting @fs_devices->total_devices.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/volumes.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index f79b027fa0f1..ca9a51400035 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1844,7 +1844,6 @@ static int btrfs_prepare_sprout(struct btrfs_root *root)
 	fs_devices->seeding = 0;
 	fs_devices->num_devices = 0;
 	fs_devices->open_devices = 0;
-	fs_devices->total_devices = 0;
 	fs_devices->seed = seed_devices;
 
 	generate_random_uuid(fs_devices->fsid);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 010/128] Btrfs: send, don't error in the presence of subvols/snapshots
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (8 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 009/128] Btrfs: set right total device count for seeding support Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 011/128] fs: btrfs: volumes.c: Fix for possible null pointer dereference Luis Henriques
                   ` (117 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Filipe David Borba Manana, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Filipe Manana <fdmanana@gmail.com>

commit 1af56070e3ef9477dbc7eba3b9ad7446979c7974 upstream.

If we are doing an incremental send and the base snapshot has a
directory with name X that doesn't exist anymore in the second
snapshot and a new subvolume/snapshot exists in the second snapshot
that has the same name as the directory (name X), the incremental
send would fail with -ENOENT error. This is because it attempts
to lookup for an inode with a number matching the objectid of a
root, which doesn't exist.

Steps to reproduce:

    mkfs.btrfs -f /dev/sdd
    mount /dev/sdd /mnt

    mkdir /mnt/testdir
    btrfs subvolume snapshot -r /mnt /mnt/mysnap1

    rmdir /mnt/testdir
    btrfs subvolume create /mnt/testdir
    btrfs subvolume snapshot -r /mnt /mnt/mysnap2

    btrfs send -p /mnt/mysnap1 /mnt/mysnap2 -f /tmp/send.data

A test case for xfstests follows.

Reported-by: Robert White <rwhite@pobox.com>
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/send.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index d4c34c8471a4..4bde74798d2b 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1547,6 +1547,10 @@ static int lookup_dir_item_inode(struct btrfs_root *root,
 		goto out;
 	}
 	btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
+	if (key.type == BTRFS_ROOT_ITEM_KEY) {
+		ret = -ENOENT;
+		goto out;
+	}
 	*found_inode = key.objectid;
 	*found_type = btrfs_dir_type(path->nodes[0], di);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 011/128] fs: btrfs: volumes.c: Fix for possible null pointer dereference
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (9 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 010/128] Btrfs: send, don't error in the presence of subvols/snapshots Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 012/128] Btrfs: use right type to get real comparison Luis Henriques
                   ` (116 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rickard Strandqvist, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

commit 8321cf2596d283821acc466377c2b85bcd3422b7 upstream.

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/volumes.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ca9a51400035..03f47b09f37f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1635,11 +1635,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
 		struct btrfs_fs_devices *fs_devices;
 		fs_devices = root->fs_info->fs_devices;
 		while (fs_devices) {
-			if (fs_devices->seed == cur_devices)
+			if (fs_devices->seed == cur_devices) {
+				fs_devices->seed = cur_devices->seed;
 				break;
+			}
 			fs_devices = fs_devices->seed;
 		}
-		fs_devices->seed = cur_devices->seed;
 		cur_devices->seed = NULL;
 		lock_chunks(root);
 		__btrfs_close_devices(cur_devices);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 012/128] Btrfs: use right type to get real comparison
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (10 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 011/128] fs: btrfs: volumes.c: Fix for possible null pointer dereference Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 013/128] Btrfs: fix scrub_print_warning to handle skinny metadata extents Luis Henriques
                   ` (115 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Liu Bo, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Liu Bo <bo.li.liu@oracle.com>

commit cd857dd6bc2ae9ecea14e75a34e8a8fdc158e307 upstream.

We want to make sure the point is still within the extent item, not to verify
the memory it's pointing to.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/backref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 8bc5e8ccb091..2b3d7ba4ad33 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1388,7 +1388,7 @@ static int __get_extent_inline_ref(unsigned long *ptr, struct extent_buffer *eb,
 			*out_eiref = (struct btrfs_extent_inline_ref *)(ei + 1);
 		}
 		*ptr = (unsigned long)*out_eiref;
-		if ((void *)*ptr >= (void *)ei + item_size)
+		if ((unsigned long)(*ptr) >= (unsigned long)ei + item_size)
 			return -ENOENT;
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 013/128] Btrfs: fix scrub_print_warning to handle skinny metadata extents
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (11 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 012/128] Btrfs: use right type to get real comparison Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 014/128] btrfs: fix use of uninit "ret" in end_extent_writepage() Luis Henriques
                   ` (114 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Liu Bo, Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Liu Bo <bo.li.liu@oracle.com>

commit 6eda71d0c030af0fc2f68aaa676e6d445600855b upstream.

The skinny extents are intepreted incorrectly in scrub_print_warning(),
and end up hitting the BUG() in btrfs_extent_inline_ref_size.

Reported-by: Konstantinos Skarlatos <k.skarlatos@gmail.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/backref.c | 30 +++++++++++++++++++-----------
 fs/btrfs/backref.h |  4 ++--
 fs/btrfs/scrub.c   |  5 +++--
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 2b3d7ba4ad33..75b85578d98a 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1369,9 +1369,10 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
  * returns <0 on error
  */
 static int __get_extent_inline_ref(unsigned long *ptr, struct extent_buffer *eb,
-				struct btrfs_extent_item *ei, u32 item_size,
-				struct btrfs_extent_inline_ref **out_eiref,
-				int *out_type)
+				   struct btrfs_key *key,
+				   struct btrfs_extent_item *ei, u32 item_size,
+				   struct btrfs_extent_inline_ref **out_eiref,
+				   int *out_type)
 {
 	unsigned long end;
 	u64 flags;
@@ -1381,9 +1382,16 @@ static int __get_extent_inline_ref(unsigned long *ptr, struct extent_buffer *eb,
 		/* first call */
 		flags = btrfs_extent_flags(eb, ei);
 		if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) {
-			info = (struct btrfs_tree_block_info *)(ei + 1);
-			*out_eiref =
-				(struct btrfs_extent_inline_ref *)(info + 1);
+			if (key->type == BTRFS_METADATA_ITEM_KEY) {
+				/* a skinny metadata extent */
+				*out_eiref =
+				     (struct btrfs_extent_inline_ref *)(ei + 1);
+			} else {
+				WARN_ON(key->type != BTRFS_EXTENT_ITEM_KEY);
+				info = (struct btrfs_tree_block_info *)(ei + 1);
+				*out_eiref =
+				   (struct btrfs_extent_inline_ref *)(info + 1);
+			}
 		} else {
 			*out_eiref = (struct btrfs_extent_inline_ref *)(ei + 1);
 		}
@@ -1393,7 +1401,7 @@ static int __get_extent_inline_ref(unsigned long *ptr, struct extent_buffer *eb,
 	}
 
 	end = (unsigned long)ei + item_size;
-	*out_eiref = (struct btrfs_extent_inline_ref *)*ptr;
+	*out_eiref = (struct btrfs_extent_inline_ref *)(*ptr);
 	*out_type = btrfs_extent_inline_ref_type(eb, *out_eiref);
 
 	*ptr += btrfs_extent_inline_ref_size(*out_type);
@@ -1412,8 +1420,8 @@ static int __get_extent_inline_ref(unsigned long *ptr, struct extent_buffer *eb,
  * <0 on error.
  */
 int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb,
-				struct btrfs_extent_item *ei, u32 item_size,
-				u64 *out_root, u8 *out_level)
+			    struct btrfs_key *key, struct btrfs_extent_item *ei,
+			    u32 item_size, u64 *out_root, u8 *out_level)
 {
 	int ret;
 	int type;
@@ -1424,8 +1432,8 @@ int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb,
 		return 1;
 
 	while (1) {
-		ret = __get_extent_inline_ref(ptr, eb, ei, item_size,
-						&eiref, &type);
+		ret = __get_extent_inline_ref(ptr, eb, key, ei, item_size,
+					      &eiref, &type);
 		if (ret < 0)
 			return ret;
 
diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h
index 8f2e76702932..a3bd63b06044 100644
--- a/fs/btrfs/backref.h
+++ b/fs/btrfs/backref.h
@@ -40,8 +40,8 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
 			u64 *flags);
 
 int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb,
-				struct btrfs_extent_item *ei, u32 item_size,
-				u64 *out_root, u8 *out_level);
+			    struct btrfs_key *key, struct btrfs_extent_item *ei,
+			    u32 item_size, u64 *out_root, u8 *out_level);
 
 int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
 				u64 extent_item_objectid,
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 64a157becbe5..8a56d4432522 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -545,8 +545,9 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
 
 	if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) {
 		do {
-			ret = tree_backref_for_extent(&ptr, eb, ei, item_size,
-							&ref_root, &ref_level);
+			ret = tree_backref_for_extent(&ptr, eb, &found_key, ei,
+						      item_size, &ref_root,
+						      &ref_level);
 			printk_in_rcu(KERN_WARNING
 				"btrfs: %s at logical %llu on dev %s, "
 				"sector %llu: metadata %s (level %d) in tree "
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 014/128] btrfs: fix use of uninit "ret" in end_extent_writepage()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (12 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 013/128] Btrfs: fix scrub_print_warning to handle skinny metadata extents Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 015/128] Bluetooth: Fix check for connection encryption Luis Henriques
                   ` (113 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Mason, David Sterba, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Sandeen <sandeen@redhat.com>

commit 3e2426bd0eb980648449e7a2f5a23e3cd3c7725c upstream.

If this condition in end_extent_writepage() is false:

	if (tree->ops && tree->ops->writepage_end_io_hook)

we will then test an uninitialized "ret" at:

	ret = ret < 0 ? ret : -EIO;

The test for ret is for the case where ->writepage_end_io_hook
failed, and we'd choose that ret as the error; but if
there is no ->writepage_end_io_hook, nothing sets ret.

Initializing ret to 0 should be sufficient; if
writepage_end_io_hook wasn't set, (!uptodate) means
non-zero err was passed in, so we choose -EIO in that case.

Signed-of-by: Eric Sandeen <sandeen@redhat.com>

Signed-off-by: Chris Mason <clm@fb.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 479d5aecd708..4a96d26bc6fd 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2387,7 +2387,7 @@ int end_extent_writepage(struct page *page, int err, u64 start, u64 end)
 {
 	int uptodate = (err == 0);
 	struct extent_io_tree *tree;
-	int ret;
+	int ret = 0;
 
 	tree = &BTRFS_I(page->mapping->host)->io_tree;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 015/128] Bluetooth: Fix check for connection encryption
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (13 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 014/128] btrfs: fix use of uninit "ret" in end_extent_writepage() Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 016/128] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Luis Henriques
                   ` (112 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hedberg, Marcel Holtmann, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hedberg <johan.hedberg@intel.com>

commit e694788d73efe139b24f78b036deb97fe57fa8cb upstream.

The conn->link_key variable tracks the type of link key in use. It is
set whenever we respond to a link key request as well as when we get a
link key notification event.

These two events do not however always guarantee that encryption is
enabled: getting a link key request and responding to it may only mean
that the remote side has requested authentication but not encryption. On
the other hand, the encrypt change event is a certain guarantee that
encryption is enabled. The real encryption state is already tracked in
the conn->link_mode variable through the HCI_LM_ENCRYPT bit.

This patch fixes a check for encryption in the hci_conn_auth function to
use the proper conn->link_mode value and thereby eliminates the chance
of a false positive result.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/bluetooth/hci_conn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 4c51c055d00f..8e7290aea8f8 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -659,7 +659,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
 		/* If we're already encrypted set the REAUTH_PEND flag,
 		 * otherwise set the ENCRYPT_PEND.
 		 */
-		if (conn->key_type != 0xff)
+		if (conn->link_mode & HCI_LM_ENCRYPT)
 			set_bit(HCI_CONN_REAUTH_PEND, &conn->flags);
 		else
 			set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 016/128] Bluetooth: Fix SSP acceptor just-works confirmation without MITM
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (14 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 015/128] Bluetooth: Fix check for connection encryption Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 017/128] Bluetooth: Fix indicating discovery state when canceling inquiry Luis Henriques
                   ` (111 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hedberg, Marcel Holtmann, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hedberg <johan.hedberg@intel.com>

commit ba15a58b179ed76a7e887177f2b06de12c58ec8f upstream.

>From the Bluetooth Core Specification 4.1 page 1958:

"if both devices have set the Authentication_Requirements parameter to
one of the MITM Protection Not Required options, authentication stage 1
shall function as if both devices set their IO capabilities to
DisplayOnly (e.g., Numeric comparison with automatic confirmation on
both devices)"

So far our implementation has done user confirmation for all just-works
cases regardless of the MITM requirements, however following the
specification to the word means that we should not be doing confirmation
when neither side has the MITM flag set.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Tested-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/bluetooth/hci_event.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b767ed9969c4..c3b45bc3a7f4 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3159,8 +3159,11 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev,
 
 		/* If we're not the initiators request authorization to
 		 * proceed from user space (mgmt_user_confirm with
-		 * confirm_hint set to 1). */
-		if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
+		 * confirm_hint set to 1). The exception is if neither
+		 * side had MITM in which case we do auto-accept.
+		 */
+		if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) &&
+		    (loc_mitm || rem_mitm)) {
 			BT_DBG("Confirming auto-accept as acceptor");
 			confirm_hint = 1;
 			goto confirm;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 017/128] Bluetooth: Fix indicating discovery state when canceling inquiry
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (15 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 016/128] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 018/128] Bluetooth: Fix locking of hdev when calling into SMP code Luis Henriques
                   ` (110 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hedberg, Marcel Holtmann, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hedberg <johan.hedberg@intel.com>

commit 50143a433b70e3145bcf8a4a4e54f0c11bdee32b upstream.

When inquiry is canceled through the HCI_Cancel_Inquiry command there is
no Inquiry Complete event generated. Instead, all we get is the command
complete for the HCI_Inquiry_Cancel command. This means that we must
call the hci_discovery_set_state() function from the respective command
complete handler in order to ensure that user space knows the correct
discovery state.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/bluetooth/hci_event.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index c3b45bc3a7f4..f4537e26caad 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -47,6 +47,10 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
 	smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */
 	wake_up_bit(&hdev->flags, HCI_INQUIRY);
 
+	hci_dev_lock(hdev);
+	hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
+	hci_dev_unlock(hdev);
+
 	hci_conn_check_pending(hdev);
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 018/128] Bluetooth: Fix locking of hdev when calling into SMP code
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (16 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 017/128] Bluetooth: Fix indicating discovery state when canceling inquiry Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 019/128] Bluetooth: Allow change security level on ATT_CID in slave role Luis Henriques
                   ` (109 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hedberg, Marcel Holtmann, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hedberg <johan.hedberg@intel.com>

commit c73f94b8c093a615ce80eabbde0ac6eb9abfe31a upstream.

The SMP code expects hdev to be unlocked since e.g. crypto functions
will try to (re)lock it. Therefore, we need to release the lock before
calling into smp.c from mgmt.c. Without this we risk a deadlock whenever
the smp_user_confirm_reply() function is called.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Tested-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/bluetooth/mgmt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index fedc5399d465..211fffb5dca8 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2319,8 +2319,13 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
 	}
 
 	if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) {
-		/* Continue with pairing via SMP */
+		/* Continue with pairing via SMP. The hdev lock must be
+		 * released as SMP may try to recquire it for crypto
+		 * purposes.
+		 */
+		hci_dev_unlock(hdev);
 		err = smp_user_confirm_reply(conn, mgmt_op, passkey);
+		hci_dev_lock(hdev);
 
 		if (!err)
 			err = cmd_complete(sk, hdev->id, mgmt_op,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 019/128] Bluetooth: Allow change security level on ATT_CID in slave role
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (17 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 018/128] Bluetooth: Fix locking of hdev when calling into SMP code Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 020/128] rt2x00: disable TKIP on USB Luis Henriques
                   ` (108 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Kraglak, Marcel Holtmann, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcin Kraglak <marcin.kraglak@tieto.com>

commit 92d1372e1a9fec00e146b74e8b9ad7a385b9b37f upstream.

Kernel supports SMP Security Request so don't block increasing security
when we are slave.

Signed-off-by: Marcin Kraglak <marcin.kraglak@tieto.com>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/bluetooth/l2cap_sock.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 07c9aea21244..a3a81d96314b 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -631,11 +631,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
 
 		/*change security for LE channels */
 		if (chan->scid == L2CAP_CID_ATT) {
-			if (!conn->hcon->out) {
-				err = -EINVAL;
-				break;
-			}
-
 			if (smp_conn_security(conn->hcon, sec.level))
 				break;
 			sk->sk_state = BT_CONFIG;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 020/128] rt2x00: disable TKIP on USB
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (18 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 019/128] Bluetooth: Allow change security level on ATT_CID in slave role Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 021/128] b43: fix frequency reported on G-PHY with /new/ firmware Luis Henriques
                   ` (107 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stanislaw Gruszka, John W. Linville, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Stanislaw Gruszka <sgruszka@redhat.com>

commit 8edcb0ba0d56f5914eef11eda6db8bfe74eb9ca8 upstream.

On USB we can not get atomically TKIP key. We have to disable support
for TKIP acceleration on USB hardware to avoid bug as showed bellow.

[  860.827243] BUG: scheduling while atomic: hostapd/3397/0x00000002
<snip>
[  860.827280] Call Trace:
[  860.827282]  [<ffffffff81682ea6>] dump_stack+0x4d/0x66
[  860.827284]  [<ffffffff8167eb9b>] __schedule_bug+0x47/0x55
[  860.827285]  [<ffffffff81685bb3>] __schedule+0x733/0x7b0
[  860.827287]  [<ffffffff81685c59>] schedule+0x29/0x70
[  860.827289]  [<ffffffff81684f8a>] schedule_timeout+0x15a/0x2b0
[  860.827291]  [<ffffffff8105ac50>] ? ftrace_raw_event_tick_stop+0xc0/0xc0
[  860.827294]  [<ffffffff810c13c2>] ? __module_text_address+0x12/0x70
[  860.827296]  [<ffffffff81686823>] wait_for_completion_timeout+0xb3/0x140
[  860.827298]  [<ffffffff81080fc0>] ? wake_up_state+0x20/0x20
[  860.827301]  [<ffffffff814d5b3d>] usb_start_wait_urb+0x7d/0x150
[  860.827303]  [<ffffffff814d5cd5>] usb_control_msg+0xc5/0x110
[  860.827305]  [<ffffffffa02fb0c6>] rt2x00usb_vendor_request+0xc6/0x160  [rt2x00usb]
[  860.827307]  [<ffffffffa02fb215>] rt2x00usb_vendor_req_buff_lock+0x75/0x150 [rt2x00usb]
[  860.827309]  [<ffffffffa02fb393>] rt2x00usb_vendor_request_buff+0xa3/0xe0 [rt2x00usb]
[  860.827311]  [<ffffffffa023d1a3>] rt2x00usb_register_multiread+0x33/0x40 [rt2800usb]
[  860.827314]  [<ffffffffa05805f9>] rt2800_get_tkip_seq+0x39/0x50  [rt2800lib]
[  860.827321]  [<ffffffffa0480f88>] ieee80211_get_key+0x218/0x2a0  [mac80211]
[  860.827322]  [<ffffffff815cc68c>] ? __nlmsg_put+0x6c/0x80
[  860.827329]  [<ffffffffa051b02e>] nl80211_get_key+0x22e/0x360 [cfg80211]

Reported-and-tested-by: Peter Wu <lekensteyn@gmail.com>
Reported-and-tested-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/rt2x00/rt2x00mac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 2b724fc4e306..c03748dafd49 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -489,6 +489,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	crypto.cipher = rt2x00crypto_key_to_cipher(key);
 	if (crypto.cipher == CIPHER_NONE)
 		return -EOPNOTSUPP;
+	if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
+		return -EOPNOTSUPP;
 
 	crypto.cmd = cmd;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 021/128] b43: fix frequency reported on G-PHY with /new/ firmware
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (19 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 020/128] rt2x00: disable TKIP on USB Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 022/128] rt2x00: fix rfkill regression on rt2500pci Luis Henriques
                   ` (106 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rafał Miłecki, John W. Linville, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>

commit 2fc68eb122c7ea6cd5be1fe7d6650c0beb2f4f40 upstream.

Support for firmware rev 508+ was added years ago, but we never noticed
it reports channel in a different way for G-PHY devices. Instead of
offset from 2400 MHz it simply passes channel id (AKA hw_value).

So far it was (most probably) affecting monitor mode users only, but
the following recent commit made it noticeable for quite everybody:

commit 3afc2167f60a327a2c1e1e2600ef209a3c2b75b7
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date:   Tue Mar 4 16:50:13 2014 +0200

    cfg80211/mac80211: ignore signal if the frame was heard on wrong channel

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/b43/xmit.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index e85d34b76039..ebcce00ce067 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -810,9 +810,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		break;
 	case B43_PHYTYPE_G:
 		status.band = IEEE80211_BAND_2GHZ;
-		/* chanid is the radio channel cookie value as used
-		 * to tune the radio. */
-		status.freq = chanid + 2400;
+		/* Somewhere between 478.104 and 508.1084 firmware for G-PHY
+		 * has been modified to be compatible with N-PHY and others.
+		 */
+		if (dev->fw.rev >= 508)
+			status.freq = ieee80211_channel_to_frequency(chanid, status.band);
+		else
+			status.freq = chanid + 2400;
 		break;
 	case B43_PHYTYPE_N:
 	case B43_PHYTYPE_LP:
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 022/128] rt2x00: fix rfkill regression on rt2500pci
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (20 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 021/128] b43: fix frequency reported on G-PHY with /new/ firmware Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 023/128] tracing: Fix syscall_*regfunc() vs copy_process() race Luis Henriques
                   ` (105 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stanislaw Gruszka, John W. Linville, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Stanislaw Gruszka <stf_xl@wp.pl>

commit 616a8394b5df8c88f4dd416f4527439a4e365034 upstream.

As reported by Niels, starting rfkill polling during device probe
(commit e2bc7c5, generally sane change) broke rfkill on rt2500pci
device. I considered that bug as some initalization issue, which
should be fixed on rt2500pci specific code. But after several
attempts (see bug report for details) we fail to find working solution.
Hence I decided to revert to old behaviour on rt2500pci to fix
regression.

Additionally patch also unregister rfkill on device remove instead
of ifconfig down, what was another issue introduced by bad commit.

Bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=73821

Fixes: e2bc7c5f3cb8 ("rt2x00: Fix rfkill_polling register function.")
Bisected-by: Niels <nille0386@googlemail.com>
Reported-and-tested-by: Niels <nille0386@googlemail.com>
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/rt2x00/rt2500pci.c |  7 ++++++-
 drivers/net/wireless/rt2x00/rt2x00.h    |  1 +
 drivers/net/wireless/rt2x00/rt2x00dev.c | 24 +++++++++++++++++++++---
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 0ac5c589ddce..13f557a44a62 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1684,8 +1684,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Detect if this device has an hardware controlled radio.
 	 */
-	if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
+	if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) {
 		__set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
+		/*
+		 * On this device RFKILL initialized during probe does not work.
+		 */
+		__set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags);
+	}
 
 	/*
 	 * Check if the BBP tuning should be enabled.
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index ee3fc570b11d..4f17cad0d9a9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -704,6 +704,7 @@ enum rt2x00_capability_flags {
 	REQUIRE_SW_SEQNO,
 	REQUIRE_HT_TX_DESC,
 	REQUIRE_PS_AUTOWAKE,
+	REQUIRE_DELAYED_RFKILL,
 
 	/*
 	 * Capabilities
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index e418d32882e8..cd4b1590db5c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1128,9 +1128,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
 		return;
 
 	/*
-	 * Unregister extra components.
+	 * Stop rfkill polling.
 	 */
-	rt2x00rfkill_unregister(rt2x00dev);
+	if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_unregister(rt2x00dev);
 
 	/*
 	 * Allow the HW to uninitialize.
@@ -1168,6 +1169,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
 
 	set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
 
+	/*
+	 * Start rfkill polling.
+	 */
+	if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_register(rt2x00dev);
+
 	return 0;
 }
 
@@ -1377,7 +1384,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
 	rt2x00link_register(rt2x00dev);
 	rt2x00leds_register(rt2x00dev);
 	rt2x00debug_register(rt2x00dev);
-	rt2x00rfkill_register(rt2x00dev);
+
+	/*
+	 * Start rfkill polling.
+	 */
+	if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_register(rt2x00dev);
 
 	return 0;
 
@@ -1393,6 +1405,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
 	clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 
 	/*
+	 * Stop rfkill polling.
+	 */
+	if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_unregister(rt2x00dev);
+
+	/*
 	 * Disable radio.
 	 */
 	rt2x00lib_disable_radio(rt2x00dev);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 023/128] tracing: Fix syscall_*regfunc() vs copy_process() race
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (21 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 022/128] rt2x00: fix rfkill regression on rt2500pci Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 024/128] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t Luis Henriques
                   ` (104 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Steven Rostedt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Oleg Nesterov <oleg@redhat.com>

commit 4af4206be2bd1933cae20c2b6fb2058dbc887f7c upstream.

syscall_regfunc() and syscall_unregfunc() should set/clear
TIF_SYSCALL_TRACEPOINT system-wide, but do_each_thread() can race
with copy_process() and miss the new child which was not added to
the process/thread lists yet.

Change copy_process() to update the child's TIF_SYSCALL_TRACEPOINT
under tasklist.

Link: http://lkml.kernel.org/p/20140413185854.GB20668@redhat.com

Fixes: a871bd33a6c0 "tracing: Add syscall tracepoints"
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/trace/syscall.h | 15 +++++++++++++++
 kernel/fork.c           |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index fed853f3d7aa..9674145e2f6a 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -4,6 +4,7 @@
 #include <linux/tracepoint.h>
 #include <linux/unistd.h>
 #include <linux/ftrace_event.h>
+#include <linux/thread_info.h>
 
 #include <asm/ptrace.h>
 
@@ -32,4 +33,18 @@ struct syscall_metadata {
 	struct ftrace_event_call *exit_event;
 };
 
+#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
+static inline void syscall_tracepoint_update(struct task_struct *p)
+{
+	if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+		set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
+	else
+		clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
+}
+#else
+static inline void syscall_tracepoint_update(struct task_struct *p)
+{
+}
+#endif
+
 #endif /* _TRACE_SYSCALL_H */
diff --git a/kernel/fork.c b/kernel/fork.c
index 2782836d8adc..8c8cb29ebc95 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1491,7 +1491,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
 	total_forks++;
 	spin_unlock(&current->sighand->siglock);
+	syscall_tracepoint_update(p);
 	write_unlock_irq(&tasklist_lock);
+
 	proc_fork_connector(p);
 	cgroup_post_fork(p);
 	if (clone_flags & CLONE_THREAD)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 024/128] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (22 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 023/128] tracing: Fix syscall_*regfunc() vs copy_process() race Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 025/128] rbd: handle parent_overlap on writes correctly Luis Henriques
                   ` (103 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tejun Heo, Jens Axboe, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tejun Heo <tj@kernel.org>

commit a5049a8ae34950249a7ae94c385d7c5c98914412 upstream.

Hello,

So, this patch should do.  Joe, Vivek, can one of you guys please
verify that the oops goes away with this patch?

Jens, the original thread can be read at

  http://thread.gmane.org/gmane.linux.kernel/1720729

The fix converts blkg->refcnt from int to atomic_t.  It does some
overhead but it should be minute compared to everything else which is
going on and the involved cacheline bouncing, so I think it's highly
unlikely to cause any noticeable difference.  Also, the refcnt in
question should be converted to a perpcu_ref for blk-mq anyway, so the
atomic_t is likely to go away pretty soon anyway.

Thanks.

------- 8< -------
__blkg_release_rcu() may be invoked after the associated request_queue
is released with a RCU grace period inbetween.  As such, the function
and callbacks invoked from it must not dereference the associated
request_queue.  This is clearly indicated in the comment above the
function.

Unfortunately, while trying to fix a different issue, 2a4fd070ee85
("blkcg: move bulk of blkcg_gq release operations to the RCU
callback") ignored this and added [un]locking of @blkg->q->queue_lock
to __blkg_release_rcu().  This of course can cause oops as the
request_queue may be long gone by the time this code gets executed.

  general protection fault: 0000 [#1] SMP
  CPU: 21 PID: 30 Comm: rcuos/21 Not tainted 3.15.0 #1
  Hardware name: Stratus ftServer 6400/G7LAZ, BIOS BIOS Version 6.3:57 12/25/2013
  task: ffff880854021de0 ti: ffff88085403c000 task.ti: ffff88085403c000
  RIP: 0010:[<ffffffff8162e9e5>]  [<ffffffff8162e9e5>] _raw_spin_lock_irq+0x15/0x60
  RSP: 0018:ffff88085403fdf0  EFLAGS: 00010086
  RAX: 0000000000020000 RBX: 0000000000000010 RCX: 0000000000000000
  RDX: 000060ef80008248 RSI: 0000000000000286 RDI: 6b6b6b6b6b6b6b6b
  RBP: ffff88085403fdf0 R08: 0000000000000286 R09: 0000000000009f39
  R10: 0000000000020001 R11: 0000000000020001 R12: ffff88103c17a130
  R13: ffff88103c17a080 R14: 0000000000000000 R15: 0000000000000000
  FS:  0000000000000000(0000) GS:ffff88107fca0000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000006e5ab8 CR3: 000000000193d000 CR4: 00000000000407e0
  Stack:
   ffff88085403fe18 ffffffff812cbfc2 ffff88103c17a130 0000000000000000
   ffff88103c17a130 ffff88085403fec0 ffffffff810d1d28 ffff880854021de0
   ffff880854021de0 ffff88107fcaec58 ffff88085403fe80 ffff88107fcaec30
  Call Trace:
   [<ffffffff812cbfc2>] __blkg_release_rcu+0x72/0x150
   [<ffffffff810d1d28>] rcu_nocb_kthread+0x1e8/0x300
   [<ffffffff81091d81>] kthread+0xe1/0x100
   [<ffffffff8163813c>] ret_from_fork+0x7c/0xb0
  Code: ff 47 04 48 8b 7d 08 be 00 02 00 00 e8 55 48 a4 ff 5d c3 0f 1f 00 66 66 66 66 90 55 48 89 e5
  +fa 66 66 90 66 66 90 b8 00 00 02 00 <f0> 0f c1 07 89 c2 c1 ea 10 66 39 c2 75 02 5d c3 83 e2 fe 0f
  +b7
  RIP  [<ffffffff8162e9e5>] _raw_spin_lock_irq+0x15/0x60
   RSP <ffff88085403fdf0>

The request_queue locking was added because blkcg_gq->refcnt is an int
protected with the queue lock and __blkg_release_rcu() needs to put
the parent.  Let's fix it by making blkcg_gq->refcnt an atomic_t and
dropping queue locking in the function.

Given the general heavy weight of the current request_queue and blkcg
operations, this is unlikely to cause any noticeable overhead.
Moreover, blkcg_gq->refcnt is likely to be converted to percpu_ref in
the near future, so whatever (most likely negligible) overhead it may
add is temporary.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Link: http://lkml.kernel.org/g/alpine.DEB.2.02.1406081816540.17948@jlaw-desktop.mno.stratus.com
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 block/blk-cgroup.c |  7 ++-----
 block/blk-cgroup.h | 17 +++++++----------
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 290792a13e3c..354efcdad847 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -80,7 +80,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q,
 	blkg->q = q;
 	INIT_LIST_HEAD(&blkg->q_node);
 	blkg->blkcg = blkcg;
-	blkg->refcnt = 1;
+	atomic_set(&blkg->refcnt, 1);
 
 	/* root blkg uses @q->root_rl, init rl only for !root blkgs */
 	if (blkcg != &blkcg_root) {
@@ -392,11 +392,8 @@ void __blkg_release_rcu(struct rcu_head *rcu_head)
 
 	/* release the blkcg and parent blkg refs this blkg has been holding */
 	css_put(&blkg->blkcg->css);
-	if (blkg->parent) {
-		spin_lock_irq(blkg->q->queue_lock);
+	if (blkg->parent)
 		blkg_put(blkg->parent);
-		spin_unlock_irq(blkg->q->queue_lock);
-	}
 
 	blkg_free(blkg);
 }
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index f50082d1e155..c20deb138239 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -18,6 +18,7 @@
 #include <linux/seq_file.h>
 #include <linux/radix-tree.h>
 #include <linux/blkdev.h>
+#include <linux/atomic.h>
 
 /* Max limits for throttle policy */
 #define THROTL_IOPS_MAX		UINT_MAX
@@ -104,7 +105,7 @@ struct blkcg_gq {
 	struct request_list		rl;
 
 	/* reference count */
-	int				refcnt;
+	atomic_t			refcnt;
 
 	/* is this blkg online? protected by both blkcg and q locks */
 	bool				online;
@@ -257,13 +258,12 @@ static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen)
  * blkg_get - get a blkg reference
  * @blkg: blkg to get
  *
- * The caller should be holding queue_lock and an existing reference.
+ * The caller should be holding an existing reference.
  */
 static inline void blkg_get(struct blkcg_gq *blkg)
 {
-	lockdep_assert_held(blkg->q->queue_lock);
-	WARN_ON_ONCE(!blkg->refcnt);
-	blkg->refcnt++;
+	WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0);
+	atomic_inc(&blkg->refcnt);
 }
 
 void __blkg_release_rcu(struct rcu_head *rcu);
@@ -271,14 +271,11 @@ void __blkg_release_rcu(struct rcu_head *rcu);
 /**
  * blkg_put - put a blkg reference
  * @blkg: blkg to put
- *
- * The caller should be holding queue_lock.
  */
 static inline void blkg_put(struct blkcg_gq *blkg)
 {
-	lockdep_assert_held(blkg->q->queue_lock);
-	WARN_ON_ONCE(blkg->refcnt <= 0);
-	if (!--blkg->refcnt)
+	WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0);
+	if (atomic_dec_and_test(&blkg->refcnt))
 		call_rcu(&blkg->rcu_head, __blkg_release_rcu);
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 025/128] rbd: handle parent_overlap on writes correctly
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (23 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 024/128] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 026/128] lz4: ensure length does not wrap Luis Henriques
                   ` (102 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ilya Dryomov, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ilya Dryomov <ilya.dryomov@inktank.com>

commit 9638556a276125553549fdfe349c464481ec2f39 upstream.

The following check in rbd_img_obj_request_submit()

    rbd_dev->parent_overlap <= obj_request->img_offset

allows the fall through to the non-layered write case even if both
parent_overlap and obj_request->img_offset belong to the same RADOS
object.  This leads to data corruption, because the area to the left of
parent_overlap ends up unconditionally zero-filled instead of being
populated with parent data.  Suppose we want to write 1M to offset 6M
of image bar, which is a clone of foo@snap; object_size is 4M,
parent_overlap is 5M:

    rbd_data.<id>.0000000000000001
     ---------------------|----------------------|------------
    | should be copyup'ed | should be zeroed out | write ...
     ---------------------|----------------------|------------
   4M                    5M                     6M
                    parent_overlap    obj_request->img_offset

4..5M should be copyup'ed from foo, yet it is zero-filled, just like
5..6M is.

Given that the only striping mode kernel client currently supports is
chunking (i.e. stripe_unit == object_size, stripe_count == 1), round
parent_overlap up to the next object boundary for the purposes of the
overlap check.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/block/rbd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index eebf3d6ec8db..cabe12e8390b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1375,6 +1375,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request)
 	return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0;
 }
 
+static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request)
+{
+	struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev;
+
+	return obj_request->img_offset <
+	    round_up(rbd_dev->parent_overlap, rbd_obj_bytes(&rbd_dev->header));
+}
+
 static void rbd_obj_request_get(struct rbd_obj_request *obj_request)
 {
 	dout("%s: obj %p (was %d)\n", __func__, obj_request,
@@ -2662,7 +2670,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
 	 */
 	if (!img_request_write_test(img_request) ||
 		!img_request_layered_test(img_request) ||
-		rbd_dev->parent_overlap <= obj_request->img_offset ||
+		!obj_request_overlaps_parent(obj_request) ||
 		((known = obj_request_known_test(obj_request)) &&
 			obj_request_exists_test(obj_request))) {
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 026/128] lz4: ensure length does not wrap
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (24 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 025/128] rbd: handle parent_overlap on writes correctly Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 027/128] mm, pcp: allow restoring percpu_pagelist_fraction default Luis Henriques
                   ` (101 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 206204a1162b995e2185275167b22468c00d6b36 upstream.

Given some pathologically compressed data, lz4 could possibly decide to
wrap a few internal variables, causing unknown things to happen.  Catch
this before the wrapping happens and abort the decompression.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 lib/lz4/lz4_decompress.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index 411be80ddb46..6423f018f907 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -72,6 +72,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
 			len = *ip++;
 			for (; len == 255; length += 255)
 				len = *ip++;
+			if (unlikely(length > (size_t)(length + len)))
+				goto _output_error;
 			length += len;
 		}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 027/128] mm, pcp: allow restoring percpu_pagelist_fraction default
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (25 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 026/128] lz4: ensure length does not wrap Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 028/128] mm: fix crashes from mbind() merging vmas Luis Henriques
                   ` (100 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Rientjes, Andrew Morton, Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Rientjes <rientjes@google.com>

commit 7cd2b0a34ab8e4db971920eef8982f985441adfb upstream.

Oleg reports a division by zero error on zero-length write() to the
percpu_pagelist_fraction sysctl:

    divide error: 0000 [#1] SMP DEBUG_PAGEALLOC
    CPU: 1 PID: 9142 Comm: badarea_io Not tainted 3.15.0-rc2-vm-nfs+ #19
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    task: ffff8800d5aeb6e0 ti: ffff8800d87a2000 task.ti: ffff8800d87a2000
    RIP: 0010: percpu_pagelist_fraction_sysctl_handler+0x84/0x120
    RSP: 0018:ffff8800d87a3e78  EFLAGS: 00010246
    RAX: 0000000000000f89 RBX: ffff88011f7fd000 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000010
    RBP: ffff8800d87a3e98 R08: ffffffff81d002c8 R09: ffff8800d87a3f50
    R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000060
    R13: ffffffff81c3c3e0 R14: ffffffff81cfddf8 R15: ffff8801193b0800
    FS:  00007f614f1e9740(0000) GS:ffff88011f440000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 00007f614f1fa000 CR3: 00000000d9291000 CR4: 00000000000006e0
    Call Trace:
      proc_sys_call_handler+0xb3/0xc0
      proc_sys_write+0x14/0x20
      vfs_write+0xba/0x1e0
      SyS_write+0x46/0xb0
      tracesys+0xe1/0xe6

However, if the percpu_pagelist_fraction sysctl is set by the user, it
is also impossible to restore it to the kernel default since the user
cannot write 0 to the sysctl.

This patch allows the user to write 0 to restore the default behavior.
It still requires a fraction equal to or larger than 8, however, as
stated by the documentation for sanity.  If a value in the range [1, 7]
is written, the sysctl will return EINVAL.

This successfully solves the divide by zero issue at the same time.

Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 Documentation/sysctl/vm.txt |  3 ++-
 kernel/sysctl.c             |  3 +--
 mm/page_alloc.c             | 40 ++++++++++++++++++++++++++++------------
 3 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 36ecc26c7433..d958ed640cee 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -656,7 +656,8 @@ The batch value of each per cpu pagelist is also updated as a result.  It is
 set to pcp->high/4.  The upper limit of batch is (PAGE_SHIFT * 8)
 
 The initial value is zero.  Kernel does not use this value at boot time to set
-the high water marks for each per cpu page list.
+the high water marks for each per cpu page list.  If the user writes '0' to this
+sysctl, it will revert to this default behavior.
 
 ==============================================================
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8515e5f93fc4..134216d752df 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -138,7 +138,6 @@ static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
 static int maxolduid = 65535;
 static int minolduid;
-static int min_percpu_pagelist_fract = 8;
 
 static int ngroups_max = NGROUPS_MAX;
 static const int cap_last_cap = CAP_LAST_CAP;
@@ -1293,7 +1292,7 @@ static struct ctl_table vm_table[] = {
 		.maxlen		= sizeof(percpu_pagelist_fraction),
 		.mode		= 0644,
 		.proc_handler	= percpu_pagelist_fraction_sysctl_handler,
-		.extra1		= &min_percpu_pagelist_fract,
+		.extra1		= &zero,
 	},
 #ifdef CONFIG_MMU
 	{
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4b545f5595e4..6a2b267a521f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -68,6 +68,7 @@
 
 /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */
 static DEFINE_MUTEX(pcp_batch_high_lock);
+#define MIN_PERCPU_PAGELIST_FRACTION	(8)
 
 #ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
 DEFINE_PER_CPU(int, numa_node);
@@ -3988,7 +3989,7 @@ static void __meminit zone_init_free_lists(struct zone *zone)
 	memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
 #endif
 
-static int __meminit zone_batchsize(struct zone *zone)
+static int zone_batchsize(struct zone *zone)
 {
 #ifdef CONFIG_MMU
 	int batch;
@@ -4104,8 +4105,8 @@ static void pageset_set_high(struct per_cpu_pageset *p,
 	pageset_update(&p->pcp, high, batch);
 }
 
-static void __meminit pageset_set_high_and_batch(struct zone *zone,
-		struct per_cpu_pageset *pcp)
+static void pageset_set_high_and_batch(struct zone *zone,
+				       struct per_cpu_pageset *pcp)
 {
 	if (percpu_pagelist_fraction)
 		pageset_set_high(pcp,
@@ -5689,23 +5690,38 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
 	void __user *buffer, size_t *length, loff_t *ppos)
 {
 	struct zone *zone;
-	unsigned int cpu;
+	int old_percpu_pagelist_fraction;
 	int ret;
 
+	mutex_lock(&pcp_batch_high_lock);
+	old_percpu_pagelist_fraction = percpu_pagelist_fraction;
+
 	ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
-	if (!write || (ret < 0))
-		return ret;
+	if (!write || ret < 0)
+		goto out;
+
+	/* Sanity checking to avoid pcp imbalance */
+	if (percpu_pagelist_fraction &&
+	    percpu_pagelist_fraction < MIN_PERCPU_PAGELIST_FRACTION) {
+		percpu_pagelist_fraction = old_percpu_pagelist_fraction;
+		ret = -EINVAL;
+		goto out;
+	}
+
+	/* No change? */
+	if (percpu_pagelist_fraction == old_percpu_pagelist_fraction)
+		goto out;
 
-	mutex_lock(&pcp_batch_high_lock);
 	for_each_populated_zone(zone) {
-		unsigned long  high;
-		high = zone->managed_pages / percpu_pagelist_fraction;
+		unsigned int cpu;
+
 		for_each_possible_cpu(cpu)
-			pageset_set_high(per_cpu_ptr(zone->pageset, cpu),
-					 high);
+			pageset_set_high_and_batch(zone,
+					per_cpu_ptr(zone->pageset, cpu));
 	}
+out:
 	mutex_unlock(&pcp_batch_high_lock);
-	return 0;
+	return ret;
 }
 
 int hashdist = HASHDIST_DEFAULT;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 028/128] mm: fix crashes from mbind() merging vmas
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (26 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 027/128] mm, pcp: allow restoring percpu_pagelist_fraction default Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 029/128] [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option Luis Henriques
                   ` (99 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hugh Dickins, KOSAKI Motohiro, Minchan Kim, Andrew Morton,
	Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hugh Dickins <hughd@google.com>

commit d05f0cdcbe6388723f1900c549b4850360545201 upstream.

In v2.6.34 commit 9d8cebd4bcd7 ("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: 9d8cebd4bcd7 ("mm: fix mbind vma merge problem")
Reported-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Tested-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ luis: backported to 3.11: used hughd's backport for 3.10 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/mempolicy.c | 46 ++++++++++++++++++++--------------------------
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index bfb32380190b..9aec9ae2a99c 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -608,19 +608,18 @@ static unsigned long change_prot_numa(struct vm_area_struct *vma,
  * If pagelist != NULL then isolate pages from the LRU and
  * put them on the pagelist.
  */
-static struct vm_area_struct *
+static int
 check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
 		const nodemask_t *nodes, unsigned long flags, void *private)
 {
-	int err;
-	struct vm_area_struct *first, *vma, *prev;
-
+	int err = 0;
+	struct vm_area_struct *vma, *prev;
 
-	first = find_vma(mm, start);
-	if (!first)
-		return ERR_PTR(-EFAULT);
+	vma = find_vma(mm, start);
+	if (!vma)
+		return -EFAULT;
 	prev = NULL;
-	for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) {
+	for (; vma && vma->vm_start < end; vma = vma->vm_next) {
 		unsigned long endvma = vma->vm_end;
 
 		if (endvma > end)
@@ -630,9 +629,9 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
 
 		if (!(flags & MPOL_MF_DISCONTIG_OK)) {
 			if (!vma->vm_next && vma->vm_end < end)
-				return ERR_PTR(-EFAULT);
+				return -EFAULT;
 			if (prev && prev->vm_end < vma->vm_start)
-				return ERR_PTR(-EFAULT);
+				return -EFAULT;
 		}
 
 		if (is_vm_hugetlb_page(vma))
@@ -649,15 +648,13 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
 
 			err = check_pgd_range(vma, start, endvma, nodes,
 						flags, private);
-			if (err) {
-				first = ERR_PTR(err);
+			if (err)
 				break;
-			}
 		}
 next:
 		prev = vma;
 	}
-	return first;
+	return err;
 }
 
 /*
@@ -1138,16 +1135,17 @@ out:
 
 /*
  * Allocate a new page for page migration based on vma policy.
- * Start assuming that page is mapped by vma pointed to by @private.
+ * Start by assuming the page is mapped by the same vma as contains @start.
  * Search forward from there, if not.  N.B., this assumes that the
  * list of pages handed to migrate_pages()--which is how we get here--
  * is in virtual address order.
  */
-static struct page *new_vma_page(struct page *page, unsigned long private, int **x)
+static struct page *new_page(struct page *page, unsigned long start, int **x)
 {
-	struct vm_area_struct *vma = (struct vm_area_struct *)private;
+	struct vm_area_struct *vma;
 	unsigned long uninitialized_var(address);
 
+	vma = find_vma(current->mm, start);
 	while (vma) {
 		address = page_address_in_vma(page, vma);
 		if (address != -EFAULT)
@@ -1173,7 +1171,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
 	return -ENOSYS;
 }
 
-static struct page *new_vma_page(struct page *page, unsigned long private, int **x)
+static struct page *new_page(struct page *page, unsigned long start, int **x)
 {
 	return NULL;
 }
@@ -1183,7 +1181,6 @@ static long do_mbind(unsigned long start, unsigned long len,
 		     unsigned short mode, unsigned short mode_flags,
 		     nodemask_t *nmask, unsigned long flags)
 {
-	struct vm_area_struct *vma;
 	struct mm_struct *mm = current->mm;
 	struct mempolicy *new;
 	unsigned long end;
@@ -1249,11 +1246,9 @@ static long do_mbind(unsigned long start, unsigned long len,
 	if (err)
 		goto mpol_out;
 
-	vma = check_range(mm, start, end, nmask,
+	err = check_range(mm, start, end, nmask,
 			  flags | MPOL_MF_INVERT, &pagelist);
-
-	err = PTR_ERR(vma);	/* maybe ... */
-	if (!IS_ERR(vma))
+	if (!err)
 		err = mbind_range(mm, start, end, new);
 
 	if (!err) {
@@ -1261,9 +1256,8 @@ static long do_mbind(unsigned long start, unsigned long len,
 
 		if (!list_empty(&pagelist)) {
 			WARN_ON_ONCE(flags & MPOL_MF_LAZY);
-			nr_failed = migrate_pages(&pagelist, new_vma_page,
-					(unsigned long)vma,
-					MIGRATE_SYNC, MR_MEMPOLICY_MBIND);
+			nr_failed = migrate_pages(&pagelist, new_page,
+				start, MIGRATE_SYNC, MR_MEMPOLICY_MBIND);
 			if (nr_failed)
 				putback_lru_pages(&pagelist);
 		}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 029/128] [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (27 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 028/128] mm: fix crashes from mbind() merging vmas Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 030/128] drm: fix NULL pointer access by wrong ioctl Luis Henriques
                   ` (98 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steve French, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steve French <smfrench@gmail.com>

commit ce36d9ab3bab06b7b5522f5c8b68fac231b76ffb upstream.

When we SMB3 mounted with mapchars (to allow reserved characters : \ / > < * ?
via the Unicode Windows to POSIX remap range) empty paths
(eg when we open "" to query the root of the SMB3 directory on mount) were not
null terminated so we sent garbarge as a path name on empty paths which caused
SMB2/SMB2.1/SMB3 mounts to fail when mapchars was specified.  mapchars is
particularly important since Unix Extensions for SMB3 are not supported (yet)

Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/cifs/cifs_unicode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
index 0227b45ef00a..15e9505aa35f 100644
--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -290,7 +290,8 @@ int
 cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
 		 const struct nls_table *cp, int mapChars)
 {
-	int i, j, charlen;
+	int i, charlen;
+	int j = 0;
 	char src_char;
 	__le16 dst_char;
 	wchar_t tmp;
@@ -298,12 +299,11 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
 	if (!mapChars)
 		return cifs_strtoUTF16(target, source, PATH_MAX, cp);
 
-	for (i = 0, j = 0; i < srclen; j++) {
+	for (i = 0; i < srclen; j++) {
 		src_char = source[i];
 		charlen = 1;
 		switch (src_char) {
 		case 0:
-			put_unaligned(0, &target[j]);
 			goto ctoUTF16_out;
 		case ':':
 			dst_char = cpu_to_le16(UNI_COLON);
@@ -350,6 +350,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
 	}
 
 ctoUTF16_out:
+	put_unaligned(0, &target[j]); /* Null terminate target unicode string */
 	return j;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 030/128] drm: fix NULL pointer access by wrong ioctl
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (28 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 029/128] [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 031/128] net: allwinner: emac: Add missing free_irq Luis Henriques
                   ` (97 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Zhaowei Yuan, Dave Airlie, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zhaowei Yuan <zhaowei.yuan@samsung.com>

commit 1539fb9bd405ee32282ea0a38404f9e008ac5b7a upstream.

If user uses wrong ioctl command with _IOC_NONE and argument size
greater than 0, it can cause NULL pointer access from memset of line
463. If _IOC_NONE, don't memset to 0 for kdata.

Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 drivers/gpu/drm/drm_drv.c

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
old mode 100644
new mode 100755
index 6dd71735cab4..d71e1a46c4d4
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -460,8 +460,9 @@ long drm_ioctl(struct file *filp,
 				retcode = -EFAULT;
 				goto err_i1;
 			}
-		} else
+		} else if (cmd & IOC_OUT) {
 			memset(kdata, 0, usize);
+		}
 
 		if (ioctl->flags & DRM_UNLOCKED)
 			retcode = func(dev, kdata, file_priv);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 031/128] net: allwinner: emac: Add missing free_irq
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (29 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 030/128] drm: fix NULL pointer access by wrong ioctl Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 032/128] ALSA: usb-audio: Fix races at disconnection and PCM closing Luis Henriques
                   ` (96 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxime Ripard, David S. Miller, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maxime Ripard <maxime.ripard@free-electrons.com>

commit b91113282bf44df46aba374a0b8f88a75bfd4b3f upstream.

If the mdio probe function fails in emac_open, the interrupt we just requested
isn't freed. If emac_open is called again, for example because we try to set up
the interface again, the kernel will oops because the interrupt wasn't properly
released.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/allwinner/sun4i-emac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 46dfb1378c17..81576c6c31e0 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -726,6 +726,7 @@ static int emac_open(struct net_device *dev)
 
 	ret = emac_mdio_probe(dev);
 	if (ret < 0) {
+		free_irq(dev->irq, dev);
 		netdev_err(dev, "cannot probe MDIO bus\n");
 		return ret;
 	}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 032/128] ALSA: usb-audio: Fix races at disconnection and PCM closing
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (30 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 031/128] net: allwinner: emac: Add missing free_irq Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 033/128] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules Luis Henriques
                   ` (95 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 92a586bdc06de6629dae1b357dac221253f55ff8 upstream.

When a USB-audio device is disconnected while PCM is still running, we
still see some race: the disconnect callback calls
snd_usb_endpoint_free() that calls release_urbs() and then kfree()
while a PCM stream would be closed at the same time and calls
stop_endpoints() that leads to wait_clear_urbs().  That is, the EP
object might be deallocated while a PCM stream is syncing with
wait_clear_urbs() with the same EP.

Basically calling multiple wait_clear_urbs() would work fine, also
calling wait_clear_urbs() and release_urbs() would work, too, as
wait_clear_urbs() just reads some fields in ep.  The problem is the
succeeding kfree() in snd_pcm_endpoint_free().

This patch moves out the EP deallocation into the later point, the
destructor callback.  At this stage, all PCMs must have been already
closed, so it's safe to free the objects.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/usb/card.c     | 13 ++++++++++---
 sound/usb/endpoint.c | 17 ++++++++++++++---
 sound/usb/endpoint.h |  1 +
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 64952e2d3ed1..fda227e3bbac 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -307,6 +307,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
 
 static int snd_usb_audio_free(struct snd_usb_audio *chip)
 {
+	struct list_head *p, *n;
+
+	list_for_each_safe(p, n, &chip->ep_list)
+		snd_usb_endpoint_free(p);
+
 	mutex_destroy(&chip->mutex);
 	kfree(chip);
 	return 0;
@@ -583,7 +588,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 				     struct snd_usb_audio *chip)
 {
 	struct snd_card *card;
-	struct list_head *p, *n;
+	struct list_head *p;
 
 	if (chip == (void *)-1L)
 		return;
@@ -596,14 +601,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 	mutex_lock(&register_mutex);
 	chip->num_interfaces--;
 	if (chip->num_interfaces <= 0) {
+		struct snd_usb_endpoint *ep;
+
 		snd_card_disconnect(card);
 		/* release the pcm resources */
 		list_for_each(p, &chip->pcm_list) {
 			snd_usb_stream_disconnect(p);
 		}
 		/* release the endpoint resources */
-		list_for_each_safe(p, n, &chip->ep_list) {
-			snd_usb_endpoint_free(p);
+		list_for_each_entry(ep, &chip->ep_list, list) {
+			snd_usb_endpoint_release(ep);
 		}
 		/* release the midi resources */
 		list_for_each(p, &chip->midi_list) {
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 308c02b2a597..e3e8560c2e46 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -957,19 +957,30 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
 }
 
 /**
+ * snd_usb_endpoint_release: Tear down an snd_usb_endpoint
+ *
+ * @ep: the endpoint to release
+ *
+ * This function does not care for the endpoint's use count but will tear
+ * down all the streaming URBs immediately.
+ */
+void snd_usb_endpoint_release(struct snd_usb_endpoint *ep)
+{
+	release_urbs(ep, 1);
+}
+
+/**
  * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint
  *
  * @ep: the list header of the endpoint to free
  *
- * This function does not care for the endpoint's use count but will tear
- * down all the streaming URBs immediately and free all resources.
+ * This free all resources of the given ep.
  */
 void snd_usb_endpoint_free(struct list_head *head)
 {
 	struct snd_usb_endpoint *ep;
 
 	ep = list_entry(head, struct snd_usb_endpoint, list);
-	release_urbs(ep, 1);
 	kfree(ep);
 }
 
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
index 2287adf5ca59..fe65a38ba387 100644
--- a/sound/usb/endpoint.h
+++ b/sound/usb/endpoint.h
@@ -21,6 +21,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
+void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_free(struct list_head *head);
 
 int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 033/128] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (31 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 032/128] ALSA: usb-audio: Fix races at disconnection and PCM closing Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 034/128] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region Luis Henriques
                   ` (94 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alex Smith, linux-mips, Ralf Baechle, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Smith <alex.smith@imgtec.com>

commit 91ad11d7cc6f4472ebf177a6252fbf0fd100d798 upstream.

On MIPS calls to _mcount in modules generate 2 instructions to load
the _mcount address (and therefore 2 relocations). The mcount_loc
table should only reference the first of these, so the second is
filtered out by checking the relocation offset and ignoring ones that
immediately follow the previous one seen.

However if a module has an _mcount call at offset 0, the second
relocation would not be filtered out due to old_r_offset == 0
being taken to mean that the current relocation is the first one
seen, and both would end up in the mcount_loc table.

This results in ftrace_make_nop() patching both (adjacent)
instructions to branches over the _mcount call sequence like so:

  0xffffffffc08a8000:  04 00 00 10     b       0xffffffffc08a8014
  0xffffffffc08a8004:  04 00 00 10     b       0xffffffffc08a8018
  0xffffffffc08a8008:  2d 08 e0 03     move    at,ra
  ...

The second branch is in the delay slot of the first, which is
defined to be unpredictable - on the platform on which this bug was
encountered, it triggers a reserved instruction exception.

Fix by initializing old_r_offset to ~0 and using that instead of 0
to determine whether the current relocation is the first seen.

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7098/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 scripts/recordmcount.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 9d1421e63ff8..49b582a225b0 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -163,11 +163,11 @@ static int mcount_adjust = 0;
 
 static int MIPS_is_fake_mcount(Elf_Rel const *rp)
 {
-	static Elf_Addr old_r_offset;
+	static Elf_Addr old_r_offset = ~(Elf_Addr)0;
 	Elf_Addr current_r_offset = _w(rp->r_offset);
 	int is_fake;
 
-	is_fake = old_r_offset &&
+	is_fake = (old_r_offset != ~(Elf_Addr)0) &&
 		(current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET);
 	old_r_offset = current_r_offset;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 034/128] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (32 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 033/128] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 035/128] target: Fix left-over se_lun->lun_sep pointer OOPs Luis Henriques
                   ` (93 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Markos Chandras, linux-mips, Ralf Baechle, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Markos Chandras <markos.chandras@imgtec.com>

commit ab6c15bc6620ebe220970cc040b29bcb2757f373 upstream.

Previously, the lower limit for the MIPS SC initialization loop was
set incorrectly allowing one extra loop leading to writes
beyond the MSC ioremap'd space. More precisely, the value of the 'imp'
in the last loop increased beyond the msc_irqmap_t boundaries and
as a result of which, the 'n' variable was loaded with an incorrect
value. This value was used later on to calculate the offset in the
MSC01_IC_SUP which led to random crashes like the following one:

CPU 0 Unable to handle kernel paging request at virtual address e75c0200,
epc == 8058dba4, ra == 8058db90
[...]
Call Trace:
[<8058dba4>] init_msc_irqs+0x104/0x154
[<8058b5bc>] arch_init_irq+0xd8/0x154
[<805897b0>] start_kernel+0x220/0x36c

Kernel panic - not syncing: Attempted to kill the idle task!

This patch fixes the problem

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7118/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/kernel/irq-msc01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index fab40f7d2e03..ac9facc08694 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -131,7 +131,7 @@ void __init init_msc_irqs(unsigned long icubase, unsigned int irqbase, msc_irqma
 
 	board_bind_eic_interrupt = &msc_bind_eic_interrupt;
 
-	for (; nirq >= 0; nirq--, imp++) {
+	for (; nirq > 0; nirq--, imp++) {
 		int n = imp->im_irq;
 
 		switch (imp->im_type) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 035/128] target: Fix left-over se_lun->lun_sep pointer OOPs
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (33 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 034/128] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 036/128] iscsi-target: Explicily clear login response PDU in exception path Luis Henriques
                   ` (92 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Nicholas Bellinger, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit 83ff42fcce070801a3aa1cd6a3269d7426271a8d upstream.

This patch fixes a left-over se_lun->lun_sep pointer OOPs when one
of the /sys/kernel/config/target/$FABRIC/$WWPN/$TPGT/lun/$LUN/alua*
attributes is accessed after the $DEVICE symlink has been removed.

To address this bug, go ahead and clear se_lun->lun_sep memory in
core_dev_unexport(), so that the existing checks for show/store
ALUA attributes in target_core_fabric_configfs.c work as expected.

Reported-by: Sebastian Herbszt <herbszt@gmx.de>
Tested-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 2640f2c65329..8a6b0e9f526a 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -614,6 +614,7 @@ void core_dev_unexport(
 	dev->export_count--;
 	spin_unlock(&hba->device_lock);
 
+	lun->lun_sep = NULL;
 	lun->lun_se_dev = NULL;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 036/128] iscsi-target: Explicily clear login response PDU in exception path
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (34 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 035/128] target: Fix left-over se_lun->lun_sep pointer OOPs Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 037/128] efi-pstore: Fix an overflow on 32-bit builds Luis Henriques
                   ` (91 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Nicholas Bellinger, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit 683497566d48f86e04d026de1ee658dd74fc1077 upstream.

This patch adds a explicit memset to the login response PDU
exception path in iscsit_tx_login_rsp().

This addresses a regression bug introduced in commit baa4d64b
where the initiator would end up not receiving the login
response and associated status class + detail, before closing
the login connection.

Reported-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
Tested-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/iscsi/iscsi_target_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index d93bc6b1d001..5763073ebd48 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -1289,6 +1289,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta
 	login->login_failed = 1;
 	iscsit_collect_login_stats(conn, status_class, status_detail);
 
+	memset(&login->rsp[0], 0, ISCSI_HDR_LEN);
+
 	hdr	= (struct iscsi_login_rsp *)&login->rsp[0];
 	hdr->opcode		= ISCSI_OP_LOGIN_RSP;
 	hdr->status_class	= status_class;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 037/128] efi-pstore: Fix an overflow on 32-bit builds
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (35 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 036/128] iscsi-target: Explicily clear login response PDU in exception path Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 038/128] lz4: fix another possible overrun Luis Henriques
                   ` (90 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrew Zaborowski, Matt Fleming, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrzej Zaborowski <andrew.zaborowski@intel.com>

commit 783ee43118dc773bc8b0342c5b230e017d5a04d0 upstream.

In generic_id the long int timestamp is multiplied by 100000 and needs
an explicit cast to u64.

Without that the id in the resulting pstore filename is wrong and
userspace may have problems parsing it, but more importantly files in
pstore can never be deleted and may fill the EFI flash (brick device?).
This happens because when generic pstore code wants to delete a file,
it passes the id to the EFI backend which reinterpretes it and a wrong
variable name is attempted to be deleted.  There's no error message but
after remounting pstore, deleted files would reappear.

Signed-off-by: Andrew Zaborowski <andrew.zaborowski@intel.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/firmware/efi/efi-pstore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index b438a3a4d0d8..14e83e955182 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -39,7 +39,7 @@ struct pstore_read_data {
 static inline u64 generic_id(unsigned long timestamp,
 			     unsigned int part, int count)
 {
-	return (timestamp * 100 + part) * 1000 + count;
+	return ((u64) timestamp * 100 + part) * 1000 + count;
 }
 
 static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 038/128] lz4: fix another possible overrun
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (36 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 037/128] efi-pstore: Fix an overflow on 32-bit builds Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 039/128] iscsi-target: Avoid rejecting incorrect ITT for Data-Out Luis Henriques
                   ` (89 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4148c1f67abf823099b2d7db6851e4aea407f5ee upstream.

There is one other possible overrun in the lz4 code as implemented by
Linux at this point in time (which differs from the upstream lz4
codebase, but will get synced at in a future kernel release.)  As
pointed out by Don, we also need to check the overflow in the data
itself.

While we are at it, replace the odd error return value with just a
"simple" -1 value as the return value is never used for anything other
than a basic "did this work or not" check.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Reported-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 lib/lz4/lz4_decompress.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index 6423f018f907..8ee9333e87ae 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -108,6 +108,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
 		if (length == ML_MASK) {
 			for (; *ip == 255; length += 255)
 				ip++;
+			if (unlikely(length > (size_t)(length + *ip)))
+				goto _output_error;
 			length += *ip++;
 		}
 
@@ -157,7 +159,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
 
 	/* write overflow error detected */
 _output_error:
-	return (int) (-(((char *)ip) - source));
+	return -1;
 }
 
 static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 039/128] iscsi-target: Avoid rejecting incorrect ITT for Data-Out
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (37 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 038/128] lz4: fix another possible overrun Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 040/128] powerpc: fix typo 'CONFIG_PPC_CPU' Luis Henriques
                   ` (88 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Nicholas Bellinger, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit 97c99b47ac58bacb7c09e1f47d5d184434f6b06a upstream.

This patch changes iscsit_check_dataout_hdr() to dump the incoming
Data-Out payload when the received ITT is not associated with a
WRITE, instead of calling iscsit_reject_cmd() for the non WRITE
ITT descriptor.

This addresses a bug where an initiator sending an Data-Out for
an ITT associated with a READ would end up generating a reject
for the READ, eventually resulting in list corruption.

Reported-by: Santosh Kulkarni <santosh.kulkarni@calsoftinc.com>
Reported-by: Arshad Hussain <arshad.hussain@calsoftinc.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/iscsi/iscsi_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index a5825ea2488e..5283359ef299 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1317,7 +1317,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
 	if (cmd->data_direction != DMA_TO_DEVICE) {
 		pr_err("Command ITT: 0x%08x received DataOUT for a"
 			" NON-WRITE command.\n", cmd->init_task_tag);
-		return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf);
+		return iscsit_dump_data_payload(conn, payload_length, 1);
 	}
 	se_cmd = &cmd->se_cmd;
 	iscsit_mod_dataout_timer(cmd);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 040/128] powerpc: fix typo 'CONFIG_PPC_CPU'
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (38 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 039/128] iscsi-target: Avoid rejecting incorrect ITT for Data-Out Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 041/128] powerpc: fix typo 'CONFIG_PMAC' Luis Henriques
                   ` (87 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Paul Bolle, Benjamin Herrenschmidt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Paul Bolle <pebolle@tiscali.nl>

commit b69a1da94f3d1589d1942b5d1b384d8cfaac4500 upstream.

Commit cd64d1697cf0 ("powerpc: mtmsrd not defined") added a check for
CONFIG_PPC_CPU were a check for CONFIG_PPC_FPU was clearly intended.

Fixes: cd64d1697cf0 ("powerpc: mtmsrd not defined")
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/lib/sstep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 99c7fc16dc0d..fd4a24541a4b 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1395,7 +1395,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
 				regs->gpr[rd] = byterev_4(val);
 			goto ldst_done;
 
-#ifdef CONFIG_PPC_CPU
+#ifdef CONFIG_PPC_FPU
 		case 535:	/* lfsx */
 		case 567:	/* lfsux */
 			if (!(regs->msr & MSR_FP))
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 041/128] powerpc: fix typo 'CONFIG_PMAC'
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (39 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 040/128] powerpc: fix typo 'CONFIG_PPC_CPU' Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 042/128] PCI: Fix incorrect vgaarb conditional in WARN_ON() Luis Henriques
                   ` (86 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Paul Bolle, Benjamin Herrenschmidt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Paul Bolle <pebolle@tiscali.nl>

commit 6e0fdf9af216887e0032c19d276889aad41cad00 upstream.

Commit b0d278b7d3ae ("powerpc/perf_event: Reduce latency of calling
perf_event_do_pending") added a check for CONFIG_PMAC were a check for
CONFIG_PPC_PMAC was clearly intended.

Fixes: b0d278b7d3ae ("powerpc/perf_event: Reduce latency of calling perf_event_do_pending")
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/kernel/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index d1f90d3d6f07..93ce00413e25 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -512,7 +512,7 @@ void timer_interrupt(struct pt_regs * regs)
 
 	__get_cpu_var(irq_stat).timer_irqs++;
 
-#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
+#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
 	if (atomic_read(&ppc_n_lost_interrupts) != 0)
 		do_IRQ(regs);
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 042/128] PCI: Fix incorrect vgaarb conditional in WARN_ON()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (40 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 041/128] powerpc: fix typo 'CONFIG_PMAC' Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 043/128] ptrace,x86: force IRET path after a ptrace_stop() Luis Henriques
                   ` (85 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Bjorn Helgaas, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bjorn Helgaas <bhelgaas@google.com>

commit 67ebd8140dc8923c65451fa0f6a8eee003c4dcd3 upstream.

3448a19da479 "vgaarb: use bridges to control VGA routing where possible"
added the "flags & PCI_VGA_STATE_CHANGE_DECODES" condition to an existing
WARN_ON(), but used bitwise AND (&) instead of logical AND (&&), so the
condition is never true.  Replace with logical AND.

Found by Coverity (CID 142811).

Fixes: 3448a19da479 "vgaarb: use bridges to control VGA routing where possible"
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: David Airlie <airlied@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b5352fcf5df7..b25b53e41a7e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3669,7 +3669,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
 	u16 cmd;
 	int rc;
 
-	WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) & (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
+	WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) && (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
 
 	/* ARCH specific VGA enables */
 	rc = pci_set_vga_state_arch(dev, decode, command_bits, flags);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 043/128] ptrace,x86: force IRET path after a ptrace_stop()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (41 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 042/128] PCI: Fix incorrect vgaarb conditional in WARN_ON() Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 044/128] mei: me: fix hw ready reset flow Luis Henriques
                   ` (84 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tejun Heo, Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tejun Heo <tj@kernel.org>

commit b9cd18de4db3c9ffa7e17b0dc0ca99ed5aa4d43a upstream.

The 'sysret' fastpath does not correctly restore even all regular
registers, much less any segment registers or reflags values.  That is
very much part of why it's faster than 'iret'.

Normally that isn't a problem, because the normal ptrace() interface
catches the process using the signal handler infrastructure, which
always returns with an iret.

However, some paths can get caught using ptrace_event() instead of the
signal path, and for those we need to make sure that we aren't going to
return to user space using 'sysret'.  Otherwise the modifications that
may have been done to the register set by the tracer wouldn't
necessarily take effect.

Fix it by forcing IRET path by setting TIF_NOTIFY_RESUME from
arch_ptrace_stop_needed() which is invoked from ptrace_stop().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Andy Lutomirski <luto@amacapital.net>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/asm/ptrace.h | 16 ++++++++++++++++
 include/linux/ptrace.h        |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 942a08623a1a..68e9f007cd4a 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -232,6 +232,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
 
 #define ARCH_HAS_USER_SINGLE_STEP_INFO
 
+/*
+ * When hitting ptrace_stop(), we cannot return using SYSRET because
+ * that does not restore the full CPU state, only a minimal set.  The
+ * ptracer can change arbitrary register values, which is usually okay
+ * because the usual ptrace stops run off the signal delivery path which
+ * forces IRET; however, ptrace_event() stops happen in arbitrary places
+ * in the kernel and don't force IRET path.
+ *
+ * So force IRET path after a ptrace stop.
+ */
+#define arch_ptrace_stop_needed(code, info)				\
+({									\
+	set_thread_flag(TIF_NOTIFY_RESUME);				\
+	false;								\
+})
+
 struct user_desc;
 extern int do_get_thread_area(struct task_struct *p, int idx,
 			      struct user_desc __user *info);
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 077904c8b70d..cc79eff4a1ad 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -334,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
  * calling arch_ptrace_stop() when it would be superfluous.  For example,
  * if the thread has not been back to user mode since the last stop, the
  * thread state might indicate that nothing needs to be done.
+ *
+ * This is guaranteed to be invoked once before a task stops for ptrace and
+ * may include arch-specific operations necessary prior to a ptrace stop.
  */
 #define arch_ptrace_stop_needed(code, info)	(0)
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 044/128] mei: me: fix hw ready reset flow
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (42 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 043/128] ptrace,x86: force IRET path after a ptrace_stop() Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 045/128] tracing: Try again for saved cmdline if failed due to locking Luis Henriques
                   ` (83 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tomas Winkler, Alexander Usyskin, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tomas Winkler <tomas.winkler@intel.com>

commit b04ada92ffaabb868497a1fce8e4f6bf74e5488f upstream.

We cleared H_RST for H_CSR on spurious interrupt generated when ME_RDY
while cleared and not while  ME_RDY is set. The spurious interrupt
is not delivered on all platforms in this case the
driver may fail to initialize.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.11: based on backport for 3.10 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/misc/mei/hw-me.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index e2ca1574d22a..8ed62292926f 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -164,6 +164,9 @@ static void mei_me_hw_reset_release(struct mei_device *dev)
 	hcsr |= H_IG;
 	hcsr &= ~H_RST;
 	mei_hcsr_set(hw, hcsr);
+
+	/* complete this write before we set host ready on another CPU */
+	mmiowb();
 }
 /**
  * mei_me_hw_reset - resets fw via mei csr register.
@@ -214,6 +217,7 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
 static void mei_me_host_set_ready(struct mei_device *dev)
 {
 	struct mei_me_hw *hw = to_me_hw(dev);
+	hw->host_hw_state = mei_hcsr_read(hw);
 	hw->host_hw_state |= H_IE | H_IG | H_RDY;
 	mei_hcsr_set(hw, hw->host_hw_state);
 }
@@ -506,19 +510,15 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
 	/*  check if we need to start the dev */
 	if (!mei_host_is_ready(dev)) {
 		if (mei_hw_is_ready(dev)) {
+			mei_me_hw_reset_release(dev);
 			dev_dbg(&dev->pdev->dev, "we need to start the dev.\n");
 
 			dev->recvd_hw_ready = true;
 			wake_up_interruptible(&dev->wait_hw_ready);
-
-			mutex_unlock(&dev->device_lock);
-			return IRQ_HANDLED;
 		} else {
-			dev_dbg(&dev->pdev->dev, "Reset Completed.\n");
-			mei_me_hw_reset_release(dev);
-			mutex_unlock(&dev->device_lock);
-			return IRQ_HANDLED;
+			dev_dbg(&dev->pdev->dev, "Spurious Interrupt\n");
 		}
+		goto end;
 	}
 	/* check slots available for reading */
 	slots = mei_count_full_read_slots(dev);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 045/128] tracing: Try again for saved cmdline if failed due to locking
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (43 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 044/128] mei: me: fix hw ready reset flow Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 046/128] ring-buffer: Check if buffer exists before polling Luis Henriques
                   ` (82 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit 379cfdac37923653c9d4242d10052378b7563005 upstream.

In order to prevent the saved cmdline cache from being filled when
tracing is not active, the comms are only recorded after a trace event
is recorded.

The problem is, a comm can fail to be recorded if the trace_cmdline_lock
is held. That lock is taken via a trylock to allow it to happen from
any context (including NMI). If the lock fails to be taken, the comm
is skipped. No big deal, as we will try again later.

But! Because of the code that was added to only record after an event,
we may not try again later as the recording is made as a oneshot per
event per CPU.

Only disable the recording of the comm if the comm is actually recorded.

Fixes: 7ffbd48d5cab "tracing: Cache comms only after an event occurred"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/trace.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f788ecfee618..56ecc310b818 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1417,12 +1417,12 @@ static void tracing_stop_tr(struct trace_array *tr)
 
 void trace_stop_cmdline_recording(void);
 
-static void trace_save_cmdline(struct task_struct *tsk)
+static int trace_save_cmdline(struct task_struct *tsk)
 {
 	unsigned pid, idx;
 
 	if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
-		return;
+		return 0;
 
 	/*
 	 * It's not the end of the world if we don't get
@@ -1431,7 +1431,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
 	 * so if we miss here, then better luck next time.
 	 */
 	if (!arch_spin_trylock(&trace_cmdline_lock))
-		return;
+		return 0;
 
 	idx = map_pid_to_cmdline[tsk->pid];
 	if (idx == NO_CMDLINE_MAP) {
@@ -1456,6 +1456,8 @@ static void trace_save_cmdline(struct task_struct *tsk)
 	memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN);
 
 	arch_spin_unlock(&trace_cmdline_lock);
+
+	return 1;
 }
 
 void trace_find_cmdline(int pid, char comm[])
@@ -1497,9 +1499,8 @@ void tracing_record_cmdline(struct task_struct *tsk)
 	if (!__this_cpu_read(trace_cmdline_save))
 		return;
 
-	__this_cpu_write(trace_cmdline_save, false);
-
-	trace_save_cmdline(tsk);
+	if (trace_save_cmdline(tsk))
+		__this_cpu_write(trace_cmdline_save, false);
 }
 
 void
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 046/128] ring-buffer: Check if buffer exists before polling
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (44 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 045/128] tracing: Try again for saved cmdline if failed due to locking Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 047/128] Score: Implement the function csum_ipv6_magic Luis Henriques
                   ` (81 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit 8b8b36834d0fff67fc8668093f4312dd04dcf21d upstream.

The per_cpu buffers are created one per possible CPU. But these do
not mean that those CPUs are online, nor do they even exist.

With the addition of the ring buffer polling, it assumes that the
caller polls on an existing buffer. But this is not the case if
the user reads trace_pipe from a CPU that does not exist, and this
causes the kernel to crash.

Simple fix is to check the cpu against buffer bitmask against to see
if the buffer was allocated or not and return -ENODEV if it is
not.

More updates were done to pass the -ENODEV back up to userspace.

Link: http://lkml.kernel.org/r/5393DB61.6060707@oracle.com

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
[ luis: backported to 3.11: used rostedt's backport for 3.10 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/ring_buffer.h |  2 +-
 kernel/trace/ring_buffer.c  |  5 ++++-
 kernel/trace/trace.c        | 25 ++++++++++++++++++-------
 kernel/trace/trace.h        |  4 ++--
 4 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index d69cf637a15a..49a4d6f59108 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
 	__ring_buffer_alloc((size), (flags), &__key);	\
 })
 
-void ring_buffer_wait(struct ring_buffer *buffer, int cpu);
+int ring_buffer_wait(struct ring_buffer *buffer, int cpu);
 int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
 			  struct file *filp, poll_table *poll_table);
 
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 0e337eedb909..15c4ae203885 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -543,7 +543,7 @@ static void rb_wake_up_waiters(struct irq_work *work)
  * as data is added to any of the @buffer's cpu buffers. Otherwise
  * it will wait for data to be added to a specific cpu buffer.
  */
-void ring_buffer_wait(struct ring_buffer *buffer, int cpu)
+int ring_buffer_wait(struct ring_buffer *buffer, int cpu)
 {
 	struct ring_buffer_per_cpu *cpu_buffer;
 	DEFINE_WAIT(wait);
@@ -557,6 +557,8 @@ void ring_buffer_wait(struct ring_buffer *buffer, int cpu)
 	if (cpu == RING_BUFFER_ALL_CPUS)
 		work = &buffer->irq_work;
 	else {
+		if (!cpumask_test_cpu(cpu, buffer->cpumask))
+			return -ENODEV;
 		cpu_buffer = buffer->buffers[cpu];
 		work = &cpu_buffer->irq_work;
 	}
@@ -591,6 +593,7 @@ void ring_buffer_wait(struct ring_buffer *buffer, int cpu)
 		schedule();
 
 	finish_wait(&work->waiters, &wait);
+	return 0;
 }
 
 /**
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 56ecc310b818..5f22856fd02a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1044,13 +1044,13 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
 }
 #endif /* CONFIG_TRACER_MAX_TRACE */
 
-static void default_wait_pipe(struct trace_iterator *iter)
+static int default_wait_pipe(struct trace_iterator *iter)
 {
 	/* Iterators are static, they should be filled or empty */
 	if (trace_buffer_iter(iter, iter->cpu_file))
-		return;
+		return 0;
 
-	ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file);
+	return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file);
 }
 
 #ifdef CONFIG_FTRACE_STARTUP_TEST
@@ -4064,17 +4064,19 @@ tracing_poll_pipe(struct file *filp, poll_table *poll_table)
  *
  *     Anyway, this is really very primitive wakeup.
  */
-void poll_wait_pipe(struct trace_iterator *iter)
+int poll_wait_pipe(struct trace_iterator *iter)
 {
 	set_current_state(TASK_INTERRUPTIBLE);
 	/* sleep for 100 msecs, and try again. */
 	schedule_timeout(HZ / 10);
+	return 0;
 }
 
 /* Must be called with trace_types_lock mutex held. */
 static int tracing_wait_pipe(struct file *filp)
 {
 	struct trace_iterator *iter = filp->private_data;
+	int ret;
 
 	while (trace_empty(iter)) {
 
@@ -4084,10 +4086,13 @@ static int tracing_wait_pipe(struct file *filp)
 
 		mutex_unlock(&iter->mutex);
 
-		iter->trace->wait_pipe(iter);
+		ret = iter->trace->wait_pipe(iter);
 
 		mutex_lock(&iter->mutex);
 
+		if (ret)
+			return ret;
+
 		if (signal_pending(current))
 			return -EINTR;
 
@@ -5021,8 +5026,12 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
 				goto out_unlock;
 			}
 			mutex_unlock(&trace_types_lock);
-			iter->trace->wait_pipe(iter);
+			ret = iter->trace->wait_pipe(iter);
 			mutex_lock(&trace_types_lock);
+			if (ret) {
+				size = ret;
+				goto out_unlock;
+			}
 			if (signal_pending(current)) {
 				size = -EINTR;
 				goto out_unlock;
@@ -5234,8 +5243,10 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
 			goto out;
 		}
 		mutex_unlock(&trace_types_lock);
-		iter->trace->wait_pipe(iter);
+		ret = iter->trace->wait_pipe(iter);
 		mutex_lock(&trace_types_lock);
+		if (ret)
+			goto out;
 		if (signal_pending(current)) {
 			ret = -EINTR;
 			goto out;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index afaae41b0a02..61fbe61ed3a0 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -333,7 +333,7 @@ struct tracer {
 	void			(*stop)(struct trace_array *tr);
 	void			(*open)(struct trace_iterator *iter);
 	void			(*pipe_open)(struct trace_iterator *iter);
-	void			(*wait_pipe)(struct trace_iterator *iter);
+	int			(*wait_pipe)(struct trace_iterator *iter);
 	void			(*close)(struct trace_iterator *iter);
 	void			(*pipe_close)(struct trace_iterator *iter);
 	ssize_t			(*read)(struct trace_iterator *iter,
@@ -548,7 +548,7 @@ void trace_init_global_iter(struct trace_iterator *iter);
 
 void tracing_iter_reset(struct trace_iterator *iter, int cpu);
 
-void poll_wait_pipe(struct trace_iterator *iter);
+int poll_wait_pipe(struct trace_iterator *iter);
 
 void tracing_sched_switch_trace(struct trace_array *tr,
 				struct task_struct *prev,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 047/128] Score: Implement the function csum_ipv6_magic
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (45 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 046/128] ring-buffer: Check if buffer exists before polling Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 048/128] Score: The commit is for compiling successfully Luis Henriques
                   ` (80 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lennox Wu, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lennox Wu <lennox.wu@gmail.com>

commit 1ed62ca648557b884d117a4a8bbcf2ae4e2d1153 upstream.

Signed-off-by: Lennox Wu <lennox.wu@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/score/include/asm/checksum.h | 93 +++++++++++++++++++++------------------
 1 file changed, 51 insertions(+), 42 deletions(-)

diff --git a/arch/score/include/asm/checksum.h b/arch/score/include/asm/checksum.h
index f909ac3144a4..961bd64015a8 100644
--- a/arch/score/include/asm/checksum.h
+++ b/arch/score/include/asm/checksum.h
@@ -184,48 +184,57 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
 				__wsum sum)
 {
 	__asm__ __volatile__(
-		".set\tnoreorder\t\t\t# csum_ipv6_magic\n\t"
-		".set\tnoat\n\t"
-		"addu\t%0, %5\t\t\t# proto (long in network byte order)\n\t"
-		"sltu\t$1, %0, %5\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %6\t\t\t# csum\n\t"
-		"sltu\t$1, %0, %6\n\t"
-		"lw\t%1, 0(%2)\t\t\t# four words source address\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"lw\t%1, 4(%2)\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"lw\t%1, 8(%2)\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"lw\t%1, 12(%2)\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"lw\t%1, 0(%3)\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"lw\t%1, 4(%3)\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"lw\t%1, 8(%3)\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"lw\t%1, 12(%3)\n\t"
-		"addu\t%0, $1\n\t"
-		"addu\t%0, %1\n\t"
-		"sltu\t$1, %0, %1\n\t"
-		"addu\t%0, $1\t\t\t# Add final carry\n\t"
-		".set\tnoat\n\t"
-		".set\tnoreorder"
+		".set\tvolatile\t\t\t# csum_ipv6_magic\n\t"
+		"add\t%0, %0, %5\t\t\t# proto (long in network byte order)\n\t"
+		"cmp.c\t%5, %0\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %6\t\t\t# csum\n\t"
+		"cmp.c\t%6, %0\n\t"
+		"lw\t%1, [%2, 0]\t\t\t# four words source address\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"1:lw\t%1, [%2, 4]\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"lw\t%1, [%2,8]\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"lw\t%1, [%2, 12]\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0,%1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"lw\t%1, [%3, 0]\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"lw\t%1, [%3, 4]\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"lw\t%1, [%3, 8]\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"lw\t%1, [%3, 12]\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:add\t%0, %0, %1\n\t"
+		"cmp.c\t%1, %0\n\t"
+		"bleu 1f\n\t"
+		"addi\t%0, 0x1\n\t"
+		"1:\n\t"
+		".set\toptimize"
 		: "=r" (sum), "=r" (proto)
 		: "r" (saddr), "r" (daddr),
 		  "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 048/128] Score: The commit is for compiling successfully.
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (46 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 047/128] Score: Implement the function csum_ipv6_magic Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 049/128] Score: Modify the Makefile of Score, remove -mlong-calls for compiling Luis Henriques
                   ` (79 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lennox Wu, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lennox Wu <lennox.wu@gmail.com>

commit 5fbbf8a1a93452b26e7791cf32cefce62b0a480b upstream.
	The modifications include:
	1. Kconfig of Score: we don't support ioremap
	2. Missed headfile including
	3. There are some errors in other people's commit not checked by us, we fix it now
	3.1 arch/score/kernel/entry.S: wrong instructions
	3.2 arch/score/kernel/process.c : just some typos

Signed-off-by: Lennox Wu <lennox.wu@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/score/Kconfig               | 3 +++
 arch/score/include/asm/io.h      | 1 -
 arch/score/include/asm/pgalloc.h | 2 +-
 arch/score/kernel/entry.S        | 4 ++--
 arch/score/kernel/process.c      | 4 ++--
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index 5fc237581caf..305f7ee1f382 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -111,3 +111,6 @@ source "security/Kconfig"
 source "crypto/Kconfig"
 
 source "lib/Kconfig"
+
+config NO_IOMEM
+       def_bool y
diff --git a/arch/score/include/asm/io.h b/arch/score/include/asm/io.h
index fbbfd7132e3b..574c8827abe2 100644
--- a/arch/score/include/asm/io.h
+++ b/arch/score/include/asm/io.h
@@ -5,5 +5,4 @@
 
 #define virt_to_bus	virt_to_phys
 #define bus_to_virt	phys_to_virt
-
 #endif /* _ASM_SCORE_IO_H */
diff --git a/arch/score/include/asm/pgalloc.h b/arch/score/include/asm/pgalloc.h
index 059a61b7071b..716b3fd1d863 100644
--- a/arch/score/include/asm/pgalloc.h
+++ b/arch/score/include/asm/pgalloc.h
@@ -2,7 +2,7 @@
 #define _ASM_SCORE_PGALLOC_H
 
 #include <linux/mm.h>
-
+#include <linux/highmem.h>
 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
 	pte_t *pte)
 {
diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S
index 7234ed09b7b7..befb87d30a89 100644
--- a/arch/score/kernel/entry.S
+++ b/arch/score/kernel/entry.S
@@ -264,7 +264,7 @@ resume_kernel:
 	disable_irq
 	lw	r8, [r28, TI_PRE_COUNT]
 	cmpz.c	r8
-	bne	r8, restore_all
+	bne	restore_all
 need_resched:
 	lw	r8, [r28, TI_FLAGS]
 	andri.c	r9, r8, _TIF_NEED_RESCHED
@@ -415,7 +415,7 @@ ENTRY(handle_sys)
 	sw	r9, [r0, PT_EPC]
 
 	cmpi.c	r27, __NR_syscalls 	# check syscall number
-	bgeu	illegal_syscall
+	bcs	illegal_syscall
 
 	slli	r8, r27, 2		# get syscall routine
 	la	r11, sys_call_table
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index f4c6d02421d3..a1519ad3d49d 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -78,8 +78,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 	p->thread.reg0 = (unsigned long) childregs;
 	if (unlikely(p->flags & PF_KTHREAD)) {
 		memset(childregs, 0, sizeof(struct pt_regs));
-		p->thread->reg12 = usp;
-		p->thread->reg13 = arg;
+		p->thread.reg12 = usp;
+		p->thread.reg13 = arg;
 		p->thread.reg3 = (unsigned long) ret_from_kernel_thread;
 	} else {
 		*childregs = *current_pt_regs();
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 049/128] Score: Modify the Makefile of Score, remove -mlong-calls for compiling
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (47 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 048/128] Score: The commit is for compiling successfully Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:44 ` [PATCH 3.11 050/128] ext4: Fix buffer double free in ext4_alloc_branch() Luis Henriques
                   ` (78 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lennox Wu, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lennox Wu <lennox.wu@gmail.com>

commit df9e4d1c39c472cb44d81ab2ed2db503fc486e3b upstream.

Signed-off-by: Lennox Wu <lennox.wu@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/score/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/score/Makefile b/arch/score/Makefile
index 974aefe86123..9e3e060290e0 100644
--- a/arch/score/Makefile
+++ b/arch/score/Makefile
@@ -20,8 +20,8 @@ cflags-y += -G0 -pipe -mel -mnhwloop -D__SCOREEL__ \
 #
 KBUILD_AFLAGS += $(cflags-y)
 KBUILD_CFLAGS += $(cflags-y)
-KBUILD_AFLAGS_MODULE += -mlong-calls
-KBUILD_CFLAGS_MODULE += -mlong-calls
+KBUILD_AFLAGS_MODULE +=
+KBUILD_CFLAGS_MODULE +=
 LDFLAGS += --oformat elf32-littlescore
 LDFLAGS_vmlinux	+= -G0 -static -nostdlib
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 050/128] ext4: Fix buffer double free in ext4_alloc_branch()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (48 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 049/128] Score: Modify the Makefile of Score, remove -mlong-calls for compiling Luis Henriques
@ 2014-07-24  9:44 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 051/128] ARM: OMAP2+: Fix parser-bug in platform muxing code Luis Henriques
                   ` (77 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Theodore Ts'o, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

commit c5c7b8ddfbf8cb3b2291e515a34ab1b8982f5a2d upstream.

Error recovery in ext4_alloc_branch() calls ext4_forget() even for
buffer corresponding to indirect block it did not allocate. This leads
to brelse() being called twice for that buffer (once from ext4_forget()
and once from cleanup in ext4_ind_map_blocks()) leading to buffer use
count misaccounting. Eventually (but often much later because there
are other users of the buffer) we will see messages like:
VFS: brelse: Trying to free free buffer

Another manifestation of this problem is an error:
JBD2 unexpected failure: jbd2_journal_revoke: !buffer_revoked(bh);
inconsistent data on disk

The fix is easy - don't forget buffer we did not allocate. Also add an
explanatory comment because the indexing at ext4_alloc_branch() is
somewhat subtle.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/indirect.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 87b30cd357e7..c40587735e58 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -390,7 +390,13 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
 	return 0;
 failed:
 	for (; i >= 0; i--) {
-		if (i != indirect_blks && branch[i].bh)
+		/*
+		 * We want to ext4_forget() only freshly allocated indirect
+		 * blocks.  Buffer for new_blocks[i-1] is at branch[i].bh and
+		 * buffer at branch[0].bh is indirect block / inode already
+		 * existing before ext4_alloc_branch() was called.
+		 */
+		if (i > 0 && i != indirect_blks && branch[i].bh)
 			ext4_forget(handle, 1, inode, branch[i].bh,
 				    branch[i].bh->b_blocknr);
 		ext4_free_blocks(handle, inode, NULL, new_blocks[i],
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 051/128] ARM: OMAP2+: Fix parser-bug in platform muxing code
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (49 preceding siblings ...)
  2014-07-24  9:44 ` [PATCH 3.11 050/128] ext4: Fix buffer double free in ext4_alloc_branch() Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 052/128] KVM: x86: Increase the number of fixed MTRR regs to 10 Luis Henriques
                   ` (76 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David R. Piegdon, Tony Lindgren, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "David R. Piegdon" <lkml@p23q.org>

commit c021f241f4fab2bb4fc4120a38a828a03dd3f970 upstream.

Fix a parser-bug in the omap2 muxing code where muxtable-entries will be
wrongly selected if the requested muxname is a *prefix* of their
m0-entry and they have a matching mN-entry. Fix by additionally checking
that the length of the m0_entry is equal.

For example muxing of "dss_data2.dss_data2" on omap32xx will fail
because the prefix "dss_data2" will match the mux-entries "dss_data2" as
well as "dss_data20", with the suffix "dss_data2" matching m0 (for
dss_data2) and m4 (for dss_data20). Thus both are recognized as signal
path candidates:

Relevant muxentries from mux34xx.c:
        _OMAP3_MUXENTRY(DSS_DATA20, 90,
                "dss_data20", NULL, "mcspi3_somi", "dss_data2",
                "gpio_90", NULL, NULL, "safe_mode"),
        _OMAP3_MUXENTRY(DSS_DATA2, 72,
                "dss_data2", NULL, NULL, NULL,
                "gpio_72", NULL, NULL, "safe_mode"),

This will result in a failure to mux the pin at all:

 _omap_mux_get_by_name: Multiple signal paths (2) for dss_data2.dss_data2

Patch should apply to linus' latest master down to rather old linux-2.6
trees.

Signed-off-by: David R. Piegdon <lkml@p23q.org>
[tony@atomide.com: updated description to include full description]
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mach-omap2/mux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index f82cf878d6af..94c2f6d17dae 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -183,8 +183,10 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
 		m0_entry = mux->muxnames[0];
 
 		/* First check for full name in mode0.muxmode format */
-		if (mode0_len && strncmp(muxname, m0_entry, mode0_len))
-			continue;
+		if (mode0_len)
+			if (strncmp(muxname, m0_entry, mode0_len) ||
+			    (strlen(m0_entry) != mode0_len))
+				continue;
 
 		/* Then check for muxmode only */
 		for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 052/128] KVM: x86: Increase the number of fixed MTRR regs to 10
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (50 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 051/128] ARM: OMAP2+: Fix parser-bug in platform muxing code Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 053/128] KVM: x86: preserve the high 32-bits of the PAT register Luis Henriques
                   ` (75 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nadav Amit, Paolo Bonzini, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nadav Amit <namit@cs.technion.ac.il>

commit 682367c494869008eb89ef733f196e99415ae862 upstream.

Recent Intel CPUs have 10 variable range MTRRs. Since operating systems
sometime make assumptions on CPUs while they ignore capability MSRs, it is
better for KVM to be consistent with recent CPUs. Reporting more MTRRs than
actually supported has no functional implications.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index f87f7fcefa0a..ec71e13240b9 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -92,7 +92,7 @@
 #define KVM_REFILL_PAGES 25
 #define KVM_MAX_CPUID_ENTRIES 80
 #define KVM_NR_FIXED_MTRR_REGION 88
-#define KVM_NR_VAR_MTRR 8
+#define KVM_NR_VAR_MTRR 10
 
 #define ASYNC_PF_PER_VCPU 64
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 053/128] KVM: x86: preserve the high 32-bits of the PAT register
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (51 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 052/128] KVM: x86: Increase the number of fixed MTRR regs to 10 Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 054/128] usb: musb: ux500: don't propagate the OF node Luis Henriques
                   ` (74 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Paolo Bonzini, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Paolo Bonzini <pbonzini@redhat.com>

commit 7cb060a91c0efc5ff94f83c6df3ed705e143cdb9 upstream.

KVM does not really do much with the PAT, so this went unnoticed for a
long time.  It is exposed however if you try to do rdmsr on the PAT
register.

Reported-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index ec71e13240b9..e2986788dc6b 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -453,7 +453,7 @@ struct kvm_vcpu_arch {
 	bool nmi_injected;    /* Trying to inject an NMI this entry */
 
 	struct mtrr_state_type mtrr_state;
-	u32 pat;
+	u64 pat;
 
 	int switch_db_regs;
 	unsigned long db[KVM_NR_DB_REGS];
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 054/128] usb: musb: ux500: don't propagate the OF node
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (52 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 053/128] KVM: x86: preserve the high 32-bits of the PAT register Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 055/128] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Luis Henriques
                   ` (73 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Linus Walleij, Felipe Balbi, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Linus Walleij <linus.walleij@linaro.org>

commit 82363cf2eeafeea6ba88849f5e2febdc8a05943f upstream.

There is a regression in the upcoming v3.16-rc1, that is caused
by a problem that has been around for a while but now finally
hangs the system. The bootcrawl looks like this:

pinctrl-nomadik soc:pinctrl: pin GPIO256_AF28 already
requested by a03e0000.usb_per5; cannot claim for musb-hdrc.0.auto
pinctrl-nomadik soc:pinctrl: pin-256 (musb-hdrc.0.auto) status -22
pinctrl-nomadik soc:pinctrl: could not request pin 256
(GPIO256_AF28) from group usb_a_1  on device pinctrl-nomadik
musb-hdrc musb-hdrc.0.auto: Error applying setting, reverse
things back
HS USB OTG: no transceiver configured
musb-hdrc musb-hdrc.0.auto: musb_init_controller failed
with status -517
platform musb-hdrc.0.auto: Driver musb-hdrc requests
probe deferral
(...)

The ux500 MUSB driver propagates the OF node to the dynamically
created musb-hdrc device, which is incorrect as it makes the OF
core believe there are two devices spun from the very same
DT node, which confuses other parts of the device core, notably
the pin control subsystem, which will try to apply all the pin
control settings also to the HDRC device as it gets
instantiated. (The OMAP2430 for example, does not set the
of_node member.)

Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/musb/ux500.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index fce71b605936..027a35b003d9 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -275,7 +275,6 @@ static int ux500_probe(struct platform_device *pdev)
 	musb->dev.parent		= &pdev->dev;
 	musb->dev.dma_mask		= &pdev->dev.coherent_dma_mask;
 	musb->dev.coherent_dma_mask	= pdev->dev.coherent_dma_mask;
-	musb->dev.of_node		= pdev->dev.of_node;
 
 	glue->dev			= &pdev->dev;
 	glue->musb			= musb;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 055/128] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (53 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 054/128] usb: musb: ux500: don't propagate the OF node Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 056/128] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Luis Henriques
                   ` (72 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Nazarewicz, Felipe Balbi, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michal Nazarewicz <mina86@mina86.com>

commit f0688c8b81d2ea239c3fb0b848f623b579238d99 upstream.

If the descriptors do not need any strings and user space sends empty
set of strings, the ffs->stringtabs field remains NULL.  Thus
*ffs->stringtabs in functionfs_bind leads to a NULL pointer
dereferenece.

The bug was introduced by commit [fd7c9a007f: “use usb_string_ids_n()”].

While at it, remove double initialisation of lang local variable in
that function.

ffs->strings_count does not need to be checked in any way since in
the above scenario it will remain zero and usb_string_ids_n() is
a no-operation when colled with 0 argument.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/gadget/f_fs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index b6e9d917221e..84219f656051 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1389,11 +1389,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
 	ffs->ep0req->context = ffs;
 
 	lang = ffs->stringtabs;
-	for (lang = ffs->stringtabs; *lang; ++lang) {
-		struct usb_string *str = (*lang)->strings;
-		int id = first_id;
-		for (; str->s; ++id, ++str)
-			str->id = id;
+	if (lang) {
+		for (; *lang; ++lang) {
+			struct usb_string *str = (*lang)->strings;
+			int id = first_id;
+			for (; str->s; ++id, ++str)
+				str->id = id;
+		}
 	}
 
 	ffs->gadget = cdev->gadget;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 056/128] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (54 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 055/128] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 057/128] irqchip: spear_shirq: Fix interrupt offset Luis Henriques
                   ` (71 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Adam Thomson, Jonathan Cameron, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

commit a2c12493ed7e63a18cef33a71686d12ffcd6600e 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: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/inkern.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 0cf5f8e06cfc..1e8e94d4db7d 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
 		else if (name && index >= 0) {
 			pr_err("ERROR: could not get IIO channel %s:%s(%i)\n",
 				np->full_name, name ? name : "", index);
-			return chan;
+			return NULL;
 		}
 
 		/*
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
 		 */
 		np = np->parent;
 		if (np && !of_get_property(np, "io-channel-ranges", NULL))
-			break;
+			return NULL;
 	}
+
 	return chan;
 }
 
@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev,
 		if (channel != NULL)
 			return channel;
 	}
+
 	return iio_channel_get_sys(name, channel_name);
 }
 EXPORT_SYMBOL_GPL(iio_channel_get);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 057/128] irqchip: spear_shirq: Fix interrupt offset
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (55 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 056/128] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 058/128] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Luis Henriques
                   ` (70 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Gleixner, Jason Cooper, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit 4f4366033945419b0c52118c29d3057d7c558765 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: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20140619212712.872379208@linutronix.de
Fixes: 80515a5a2e3c ('ARM: SPEAr3xx: shirq: simplify and move the shared irq multiplexor to DT')
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/irqchip/spear-shirq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c
index 8527743b5cef..391b9cea73ed 100644
--- a/drivers/irqchip/spear-shirq.c
+++ b/drivers/irqchip/spear-shirq.c
@@ -125,7 +125,7 @@ static struct spear_shirq spear320_shirq_ras2 = {
 };
 
 static struct spear_shirq spear320_shirq_ras3 = {
-	.irq_nr = 3,
+	.irq_nr = 7,
 	.irq_bit_off = 0,
 	.invalid_irq = 1,
 	.regs = {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 058/128] USB: option: add device ID for SpeedUp SU9800 usb 3g modem
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (56 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 057/128] irqchip: spear_shirq: Fix interrupt offset Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 059/128] USB: ftdi_sio: fix null deref at port probe Luis Henriques
                   ` (69 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Johan Hovold, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Oliver Neukum <oneukum@suse.de>

commit 1cab4c68e339086cdaff7535848e878e8f261fca upstream.

Reported by Alif Mubarak Ahmad:

This device vendor and product id is 1c9e:9800
It is working as serial interface with generic usbserial driver.
I thought it is more suitable to use usbserial option driver, which has
better capability distinguishing between modem serial interface and
micro sd storage interface.

[ johan: style changes ]

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Tested-by: Alif Mubarak Ahmad <alive4ever@live.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/option.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 70ede84f4f6b..909bb77544b5 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -352,6 +352,9 @@ static void option_instat_callback(struct urb *urb);
 /* Zoom */
 #define ZOOM_PRODUCT_4597			0x9607
 
+/* SpeedUp SU9800 usb 3g modem */
+#define SPEEDUP_PRODUCT_SU9800			0x9800
+
 /* Haier products */
 #define HAIER_VENDOR_ID				0x201e
 #define HAIER_PRODUCT_CE100			0x2009
@@ -1577,6 +1580,7 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
   	  .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
   	},
+	{ USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
 	{ USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 059/128] USB: ftdi_sio: fix null deref at port probe
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (57 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 058/128] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 060/128] usb: option: add/modify Olivetti Olicard modems Luis Henriques
                   ` (68 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johan Hovold, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit aea1ae8760314e072bf1b773521e9de5d5dda10d upstream.

Fix NULL-pointer dereference when probing an interface with no
endpoints.

These devices have two bulk endpoints per interface, but this avoids
crashing the kernel if a user forces a non-FTDI device to be probed.

Note that the iterator variable was made unsigned in order to avoid
a maybe-uninitialized compiler warning for ep_desc after the loop.

Fixes: 895f28badce9 ("USB: ftdi_sio: fix hi-speed device packet size
calculation")

Reported-by: Mike Remski <mremski@mutualink.net>
Tested-by: Mike Remski <mremski@mutualink.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index b9e663ac9a35..3e315de9bbd4 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1577,14 +1577,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port)
 	struct usb_device *udev = serial->dev;
 
 	struct usb_interface *interface = serial->interface;
-	struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc;
+	struct usb_endpoint_descriptor *ep_desc;
 
 	unsigned num_endpoints;
-	int i;
+	unsigned i;
 
 	num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
 	dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
 
+	if (!num_endpoints)
+		return;
+
 	/* NOTE: some customers have programmed FT232R/FT245R devices
 	 * with an endpoint size of 0 - not good.  In this case, we
 	 * want to override the endpoint descriptor setting and use a
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 060/128] usb: option: add/modify Olivetti Olicard modems
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (58 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 059/128] USB: ftdi_sio: fix null deref at port probe Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 061/128] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Luis Henriques
                   ` (67 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Johan Hovold, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit b0ebef36e93703e59003ad6a1a20227e47714417 upstream.

Adding a couple of Olivetti modems and blacklisting the net
function on a couple which are already supported.

Reported-by: Lars Melin <larsm17@gmail.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/option.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 909bb77544b5..e25e8ca09fe2 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -375,8 +375,12 @@ static void option_instat_callback(struct urb *urb);
 /* Olivetti products */
 #define OLIVETTI_VENDOR_ID			0x0b3c
 #define OLIVETTI_PRODUCT_OLICARD100		0xc000
+#define OLIVETTI_PRODUCT_OLICARD120		0xc001
+#define OLIVETTI_PRODUCT_OLICARD140		0xc002
 #define OLIVETTI_PRODUCT_OLICARD145		0xc003
+#define OLIVETTI_PRODUCT_OLICARD155		0xc004
 #define OLIVETTI_PRODUCT_OLICARD200		0xc005
+#define OLIVETTI_PRODUCT_OLICARD160		0xc00a
 #define OLIVETTI_PRODUCT_OLICARD500		0xc00b
 
 /* Celot products */
@@ -1615,15 +1619,21 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
-
-	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155),
+		.driver_info = (kernel_ulong_t)&net_intf6_blacklist },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200),
-		.driver_info = (kernel_ulong_t)&net_intf6_blacklist
-	},
+		.driver_info = (kernel_ulong_t)&net_intf6_blacklist },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160),
+		.driver_info = (kernel_ulong_t)&net_intf6_blacklist },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500),
-		.driver_info = (kernel_ulong_t)&net_intf4_blacklist
-	},
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
 	{ USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
 	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 061/128] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (59 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 060/128] usb: option: add/modify Olivetti Olicard modems Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 062/128] xhci: clear root port wake on bits if controller isn't wake-up capable Luis Henriques
                   ` (66 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit 3213b151387df0b95f4eada104f68eb1c1409cb3 upstream.

The transfer burst count (TBC) field in xhci 1.0 hosts should be set
to the number of bursts needed to transfer all packets in a isoc TD.
Supported values are 0-2 (1 to 3 bursts per service interval).

Formula for TBC calculation is given in xhci spec section 4.11.2.3:
TBC = roundup( Transfer Descriptor Packet Count / Max Burst Size +1 ) - 1

This patch should be applied to stable kernels since 3.0 that contain
the commit 5cd43e33b9519143f06f507dd7cbee6b7a621885
"xhci 1.0: Set transfer burst count field."

Suggested-by: ShiChun Ma <masc2008@qq.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 1cef7b36a187..bf2857b95c20 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3590,7 +3590,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd *xhci,
 		return 0;
 
 	max_burst = urb->ep->ss_ep_comp.bMaxBurst;
-	return roundup(total_packet_count, max_burst + 1) - 1;
+	return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1;
 }
 
 /*
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 062/128] xhci: clear root port wake on bits if controller isn't wake-up capable
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (60 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 061/128] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 063/128] xhci: Fix runtime suspended xhci from blocking system suspend Luis Henriques
                   ` (65 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lu Baolu, Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lu Baolu <baolu.lu@linux.intel.com>

commit ff8cbf250b448aac35589f6075082c3fcad8a8fe upstream.

When xHCI PCI host is suspended, if do_wakeup is false in xhci_pci_suspend,
xhci_bus_suspend needs to clear all root port wake on bits. Otherwise some Intel
platforms may get a spurious wakeup, even if PCI PME# is disabled.

This patch should be back-ported to kernels as old as 2.6.37, that
contains the commit 9777e3ce907d4cb5a513902a87ecd03b52499569
"USB: xHCI: bus power management implementation".

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-hub.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 1f582d969f97..8786b9b5a631 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -21,6 +21,7 @@
  */
 
 #include <linux/gfp.h>
+#include <linux/device.h>
 #include <asm/unaligned.h>
 
 #include "xhci.h"
@@ -1078,7 +1079,9 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
 		 * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME
 		 * is enabled, so also enable remote wake here.
 		 */
-		if (hcd->self.root_hub->do_remote_wakeup) {
+		if (hcd->self.root_hub->do_remote_wakeup
+				&& device_may_wakeup(hcd->self.controller)) {
+
 			if (t1 & PORT_CONNECT) {
 				t2 |= PORT_WKOC_E | PORT_WKDISC_E;
 				t2 &= ~PORT_WKCONN_E;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 063/128] xhci: Fix runtime suspended xhci from blocking system suspend.
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (61 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 062/128] xhci: clear root port wake on bits if controller isn't wake-up capable Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 064/128] ibmvscsi: Abort init sequence during error recovery Luis Henriques
                   ` (64 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Wang, Yu, Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Wang, Yu" <yu.y.wang@intel.com>

commit d6236f6d1d885aa19d1cd7317346fe795227a3cc upstream.

The system suspend flow as following:
1, Freeze all user processes and kenrel threads.

2, Try to suspend all devices.

2.1, If pci device is in RPM suspended state, then pci driver will try
to resume it to RPM active state in the prepare stage.

2.2, xhci_resume function calls usb_hcd_resume_root_hub to queue two
workqueue items to resume usb2&usb3 roothub devices.

2.3, Call suspend callbacks of devices.

2.3.1, All suspend callbacks of all hcd's children, including
roothub devices are called.

2.3.2, Finally, hcd_pci_suspend callback is called.

Due to workqueue threads were already frozen in step 1, the workqueue
items can't be scheduled, and the roothub devices can't be resumed in
this flow. The HCD_FLAG_WAKEUP_PENDING flag which is set in
usb_hcd_resume_root_hub won't be cleared. Finally,
hcd_pci_suspend will return -EBUSY, and system suspend fails.

The reason why this issue doesn't show up very often is due to that
choose_wakeup will be called in step 2.3.1. In step 2.3.1, if
udev->do_remote_wakeup is not equal to device_may_wakeup(&udev->dev), then
udev will resume to RPM active for changing the wakeup settings. This
has been a lucky hit which hides this issue.

For some special xHCI controllers which have no USB2 port, then roothub
will not match hub driver due to probe failed. Then its
do_remote_wakeup will be set to zero, and we won't be as lucky.

xhci driver doesn't need to resume roothub devices everytime like in
the above case. It's only needed when there are pending event TRBs.

This patch should be back-ported to kernels as old as 3.2, that
contains the commit f69e3120df82391a0ee8118e0a156239a06b2afb
"USB: XHCI: resume root hubs when the controller resumes"

Signed-off-by: Wang, Yu <yu.y.wang@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
[use readl() instead of removed xhci_readl(), reword commit message -Mathias]
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 0411eb9ea64c..969a02993d97 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -973,7 +973,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
  */
 int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 {
-	u32			command, temp = 0;
+	u32			command, temp = 0, status;
 	struct usb_hcd		*hcd = xhci_to_hcd(xhci);
 	struct usb_hcd		*secondary_hcd;
 	int			retval = 0;
@@ -1097,8 +1097,12 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 
  done:
 	if (retval == 0) {
-		usb_hcd_resume_root_hub(hcd);
-		usb_hcd_resume_root_hub(xhci->shared_hcd);
+		/* Resume root hubs only when have pending events. */
+		status = readl(&xhci->op_regs->status);
+		if (status & STS_EINT) {
+			usb_hcd_resume_root_hub(hcd);
+			usb_hcd_resume_root_hub(xhci->shared_hcd);
+		}
 	}
 
 	/*
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 064/128] ibmvscsi: Abort init sequence during error recovery
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (62 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 063/128] xhci: Fix runtime suspended xhci from blocking system suspend Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 065/128] ibmvscsi: Add memory barriers for send / receive Luis Henriques
                   ` (63 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian King, Christoph Hellwig, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Brian King <brking@linux.vnet.ibm.com>

commit 9ee755974bea2f9880e517ec985dc9dede1b3a36 upstream.

If a CRQ reset is triggered for some reason while in the middle
of performing VSCSI adapter initialization, we don't want to
call the done function for the initialization MAD commands as
this will only result in two threads attempting initialization
at the same time, resulting in failures.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index d0fa4b6c551f..1e29efc8271a 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -794,7 +794,8 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
 				       evt->hostdata->dev);
 			if (evt->cmnd_done)
 				evt->cmnd_done(evt->cmnd);
-		} else if (evt->done)
+		} else if (evt->done && evt->crq.format != VIOSRP_MAD_FORMAT &&
+			   evt->iu.srp.login_req.opcode != SRP_LOGIN_REQ)
 			evt->done(evt);
 		free_event_struct(&evt->hostdata->pool, evt);
 		spin_lock_irqsave(hostdata->host->host_lock, flags);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 065/128] ibmvscsi: Add memory barriers for send / receive
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (63 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 064/128] ibmvscsi: Abort init sequence during error recovery Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 066/128] virtio-scsi: avoid cancelling uninitialized work items Luis Henriques
                   ` (62 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian King, Christoph Hellwig, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Brian King <brking@linux.vnet.ibm.com>

commit 7114aae02742d6b5c5a0d39a41deb61d415d3717 upstream.

Add a memory barrier prior to sending a new command to the VIOS
to ensure the VIOS does not receive stale data in the command buffer.
Also add a memory barrier when processing the CRQ for completed commands.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 1e29efc8271a..c62b3e5d44bd 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -185,6 +185,11 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue)
 	if (crq->valid & 0x80) {
 		if (++queue->cur == queue->size)
 			queue->cur = 0;
+
+		/* Ensure the read of the valid bit occurs before reading any
+		 * other bits of the CRQ entry
+		 */
+		rmb();
 	} else
 		crq = NULL;
 	spin_unlock_irqrestore(&queue->lock, flags);
@@ -203,6 +208,11 @@ static int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata,
 {
 	struct vio_dev *vdev = to_vio_dev(hostdata->dev);
 
+	/*
+	 * Ensure the command buffer is flushed to memory before handing it
+	 * over to the VIOS to prevent it from fetching any stale data.
+	 */
+	mb();
 	return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2);
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 066/128] virtio-scsi: avoid cancelling uninitialized work items
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (64 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 065/128] ibmvscsi: Add memory barriers for send / receive Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 067/128] virtio-scsi: fix various bad behavior on aborted requests Luis Henriques
                   ` (61 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Paolo Bonzini, Christoph Hellwig, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Paolo Bonzini <pbonzini@redhat.com>

commit cdda0e5acbb78f7b777049f8c27899e5c5bb368f upstream.

Calling the workqueue interface on uninitialized work items isn't a
good idea even if they're zeroed. It's not failing catastrophically only
through happy accidents.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/virtio_scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 95a5d73e675c..57c39e1e6681 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -288,6 +288,8 @@ static void virtscsi_ctrl_done(struct virtqueue *vq)
 	virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free);
 };
 
+static void virtscsi_handle_event(struct work_struct *work);
+
 static int virtscsi_kick_event(struct virtio_scsi *vscsi,
 			       struct virtio_scsi_event_node *event_node)
 {
@@ -295,6 +297,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi,
 	struct scatterlist sg;
 	unsigned long flags;
 
+	INIT_WORK(&event_node->work, virtscsi_handle_event);
 	sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
 
 	spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags);
@@ -412,7 +415,6 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf)
 {
 	struct virtio_scsi_event_node *event_node = buf;
 
-	INIT_WORK(&event_node->work, virtscsi_handle_event);
 	schedule_work(&event_node->work);
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 067/128] virtio-scsi: fix various bad behavior on aborted requests
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (65 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 066/128] virtio-scsi: avoid cancelling uninitialized work items Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 068/128] ext4: Fix hole punching for files with indirect blocks Luis Henriques
                   ` (60 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Paolo Bonzini, Christoph Hellwig, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Paolo Bonzini <pbonzini@redhat.com>

commit 8faeb529b2dabb9df691d614dda18910a43d05c9 upstream.

Even though the virtio-scsi spec guarantees that all requests related
to the TMF will have been completed by the time the TMF itself completes,
the request queue's callback might not have run yet.  This causes requests
to be completed more than once, and as a result triggers a variety of
BUGs or oopses.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Venkatesh Srinivas <venkateshs@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/virtio_scsi.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 57c39e1e6681..11f5326f449f 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -270,6 +270,16 @@ static void virtscsi_req_done(struct virtqueue *vq)
 	virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd);
 };
 
+static void virtscsi_poll_requests(struct virtio_scsi *vscsi)
+{
+	int i, num_vqs;
+
+	num_vqs = vscsi->num_queues;
+	for (i = 0; i < num_vqs; i++)
+		virtscsi_vq_done(vscsi, &vscsi->req_vqs[i],
+				 virtscsi_complete_cmd);
+}
+
 static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf)
 {
 	struct virtio_scsi_cmd *cmd = buf;
@@ -604,6 +614,18 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)
 	    cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED)
 		ret = SUCCESS;
 
+	/*
+	 * The spec guarantees that all requests related to the TMF have
+	 * been completed, but the callback might not have run yet if
+	 * we're using independent interrupts (e.g. MSI).  Poll the
+	 * virtqueues once.
+	 *
+	 * In the abort case, sc->scsi_done will do nothing, because
+	 * the block layer must have detected a timeout and as a result
+	 * REQ_ATOM_COMPLETE has been set.
+	 */
+	virtscsi_poll_requests(vscsi);
+
 out:
 	mempool_free(cmd, virtscsi_cmd_pool);
 	return ret;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 068/128] ext4: Fix hole punching for files with indirect blocks
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (66 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 067/128] virtio-scsi: fix various bad behavior on aborted requests Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 069/128] nfsd: fix rare symlink decoding bug Luis Henriques
                   ` (59 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Theodore Ts'o, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

commit a93cd4cf86466caa49cfe64607bea7f0bde3f916 upstream.

Hole punching code for files with indirect blocks wrongly computed
number of blocks which need to be cleared when traversing the indirect
block tree. That could result in punching more blocks than actually
requested and thus effectively cause a data loss. For example:

fallocate -n -p 10240000 4096

will punch the range 10240000 - 12632064 instead of the range 1024000 -
10244096. Fix the calculation.

Fixes: 8bad6fc813a3a5300f51369c39d315679fd88c72
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/indirect.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index c40587735e58..0ade936f2b83 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -1319,16 +1319,24 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode,
 		blk = *i_data;
 		if (level > 0) {
 			ext4_lblk_t first2;
+			ext4_lblk_t count2;
+
 			bh = sb_bread(inode->i_sb, le32_to_cpu(blk));
 			if (!bh) {
 				EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk),
 						       "Read failure");
 				return -EIO;
 			}
-			first2 = (first > offset) ? first - offset : 0;
+			if (first > offset) {
+				first2 = first - offset;
+				count2 = count;
+			} else {
+				first2 = 0;
+				count2 = count - (offset - first);
+			}
 			ret = free_hole_blocks(handle, inode, bh,
 					       (__le32 *)bh->b_data, level - 1,
-					       first2, count - offset,
+					       first2, count2,
 					       inode->i_sb->s_blocksize >> 2);
 			if (ret) {
 				brelse(bh);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 069/128] nfsd: fix rare symlink decoding bug
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (67 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 068/128] ext4: Fix hole punching for files with indirect blocks Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 070/128] tools: ffs-test: fix header values endianess Luis Henriques
                   ` (58 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: J. Bruce Fields, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "J. Bruce Fields" <bfields@redhat.com>

commit 76f47128f9b33af1e96819746550d789054c9664 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: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nfsd/nfs4proc.c |  9 ---------
 fs/nfsd/nfs4xdr.c  | 13 ++++++++++++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index b9e784486729..08c8e023c157 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -610,15 +610,6 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 
 	switch (create->cr_type) {
 	case NF4LNK:
-		/* ugh! we have to null-terminate the linktext, or
-		 * vfs_symlink() will choke.  it is always safe to
-		 * null-terminate by brute force, since at worst we
-		 * will overwrite the first byte of the create namelen
-		 * in the XDR buffer, which has already been extracted
-		 * during XDR decode.
-		 */
-		create->cr_linkname[create->cr_linklen] = 0;
-
 		status = nfsd_symlink(rqstp, &cstate->current_fh,
 				      create->cr_name, create->cr_namelen,
 				      create->cr_linkname, create->cr_linklen,
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 9e250c229007..84d741b3dc3b 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -594,7 +594,18 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
 		READ_BUF(4);
 		READ32(create->cr_linklen);
 		READ_BUF(create->cr_linklen);
-		SAVEMEM(create->cr_linkname, create->cr_linklen);
+		/*
+		 * The VFS will want a null-terminated string, and
+		 * null-terminating in place isn't safe since this might
+		 * end on a page boundary:
+		 */
+		create->cr_linkname =
+				kmalloc(create->cr_linklen + 1, GFP_KERNEL);
+		if (!create->cr_linkname)
+			return nfserr_jukebox;
+		memcpy(create->cr_linkname, p, create->cr_linklen);
+		create->cr_linkname[create->cr_linklen] = '\0';
+		defer_free(argp, kfree, create->cr_linkname);
 		break;
 	case NF4BLK:
 	case NF4CHR:
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 070/128] tools: ffs-test: fix header values endianess
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (68 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 069/128] nfsd: fix rare symlink decoding bug Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 071/128] drm/radeon/dpm: fix typo in vddci setup for eg/btc Luis Henriques
                   ` (57 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Nazarewicz, Felipe Balbi, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michal Nazarewicz <mina86@mina86.com>

commit f35f71244da6e51db4e1f2c7e318581f498ececf 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: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 tools/usb/ffs-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index fe1e66b6ef40..a87e99f37c52 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -116,8 +116,8 @@ static const struct {
 	.header = {
 		.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC),
 		.length = cpu_to_le32(sizeof descriptors),
-		.fs_count = 3,
-		.hs_count = 3,
+		.fs_count = cpu_to_le32(3),
+		.hs_count = cpu_to_le32(3),
 	},
 	.fs_descs = {
 		.intf = {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 071/128] drm/radeon/dpm: fix typo in vddci setup for eg/btc
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (69 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 070/128] tools: ffs-test: fix header values endianess Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 072/128] drm/radeon/dpm: fix vddci setup typo on cayman Luis Henriques
                   ` (56 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit e07929810f0a19ddd756558290c7d72827cbfcd9 upstream.

We were using the vddc mask rather than the vddci mask.

Bug:
https://bugzilla.kernel.org/show_bug.cgi?id=79071

Possibly also fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=68571

Noticed-by:  Jonathan Howard <jonathan@unbiased.name>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/cypress_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c
index 7e5d0b570a30..06338db6d7f1 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -1549,7 +1549,7 @@ int cypress_populate_smc_voltage_tables(struct radeon_device *rdev,
 
 		table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0;
 		table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] =
-			cpu_to_be32(eg_pi->vddc_voltage_table.mask_low);
+			cpu_to_be32(eg_pi->vddci_voltage_table.mask_low);
 	}
 
 	return 0;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 072/128] drm/radeon/dpm: fix vddci setup typo on cayman
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (70 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 071/128] drm/radeon/dpm: fix typo in vddci setup for eg/btc Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 073/128] tracing: Remove ftrace_stop/start() from reading the trace file Luis Henriques
                   ` (55 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit b0880e87c1fd038b84498944f52e52c3e86ebe59 upstream.

We were using the vddc mask rather than the vddci mask.

Bug:
https://bugzilla.kernel.org/show_bug.cgi?id=79071

May also fix:
https://bugs.freedesktop.org/show_bug.cgi?id=69723

Noticed by: Dieter Nützel <Dieter@nuetzel-hh.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/ni_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 4c64254abd0f..596cc12bf356 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -1294,7 +1294,7 @@ static void ni_populate_smc_voltage_tables(struct radeon_device *rdev,
 
 		table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0;
 		table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] =
-			cpu_to_be32(eg_pi->vddc_voltage_table.mask_low);
+			cpu_to_be32(eg_pi->vddci_voltage_table.mask_low);
 	}
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 073/128] tracing: Remove ftrace_stop/start() from reading the trace file
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (71 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 072/128] drm/radeon/dpm: fix vddci setup typo on cayman Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 074/128] usb: chipidea: udc: delete td from req's td list at ep_dequeue Luis Henriques
                   ` (54 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit 099ed151675cd1d2dbeae1dac697975f6a68716d 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: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/trace.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5f22856fd02a..c8b8717afc23 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1323,7 +1323,6 @@ void tracing_start(void)
 
 	arch_spin_unlock(&ftrace_max_lock);
 
-	ftrace_start();
  out:
 	raw_spin_unlock_irqrestore(&global_trace.start_lock, flags);
 }
@@ -1370,7 +1369,6 @@ void tracing_stop(void)
 	struct ring_buffer *buffer;
 	unsigned long flags;
 
-	ftrace_stop();
 	raw_spin_lock_irqsave(&global_trace.start_lock, flags);
 	if (global_trace.stop_count++)
 		goto out;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 074/128] usb: chipidea: udc: delete td from req's td list at ep_dequeue
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (72 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 073/128] tracing: Remove ftrace_stop/start() from reading the trace file Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 075/128] drm/radeon/cik: fix typo in EOP packet Luis Henriques
                   ` (53 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrzej Pietrasiewicz, Peter Chen, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Chen <peter.chen@freescale.com>

commit e4adcff09ca39ecbcc4851d40d0f0a5458e7b77a upstream.

We need to delete un-finished td from current request's td list
at ep_dequeue API, otherwise, this non-user td will be remained
at td list before this request is freed. So if we do ep_queue->
ep_dequeue->ep_queue sequence, when the complete interrupt for
the second ep_queue comes, we search td list for this request,
the first td (added by the first ep_queue) will be handled, and
its status is still active, so we will consider the this transfer
still not be completed, but in fact, it has completed. It causes
the peripheral side considers it never receives current data for
this transfer.

We met this problem when do "Error Recovery Test - Device Configured"
test item for USBCV2 MSC test, the host has never received ACK for
the IN token for CSW due to peripheral considers it does not get this
CBW, the USBCV test log like belows:

--------------------------------------------------------------------------
INFO
Issuing BOT MSC Reset, reset should always succeed
INFO
Retrieving status on CBW endpoint
INFO
CBW endpoint status = 0x0
INFO
Retrieving status on CSW endpoint
INFO
CSW endpoint status = 0x0
INFO
Issuing required command (Test Unit Ready) to verify device has recovered
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN                  = 0x0
INFO
|----- CBW Flags                = 0x0
INFO
|----- CBW Data Transfer Length = 0x0
INFO
|----- CBW CDB Length           = 0x6
INFO
|----- CBW CDB-00 = 0x0
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing CSW : try 1
INFO
CSW Bulk Request timed out!
ERROR
Failed CSW phase : should have been success or stall
FAIL
(5.3.4) The CSW status value must be 0x00, 0x01, or 0x02.
ERROR
BOTCommonMSCRequest failed:  error=80004000

Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/chipidea/udc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index b13fc29966ac..592022c92652 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1322,6 +1322,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 	struct ci_hw_ep  *hwep  = container_of(ep,  struct ci_hw_ep, ep);
 	struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
 	unsigned long flags;
+	struct td_node *node, *tmpnode;
 
 	if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY ||
 		hwep->ep.desc == NULL || list_empty(&hwreq->queue) ||
@@ -1332,6 +1333,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 
 	hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
 
+	list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
+		dma_pool_free(hwep->td_pool, node->ptr, node->dma);
+		list_del(&node->td);
+		kfree(node);
+	}
+
 	/* pop request */
 	list_del_init(&hwreq->queue);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 075/128] drm/radeon/cik: fix typo in EOP packet
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (73 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 074/128] usb: chipidea: udc: delete td from req's td list at ep_dequeue Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 076/128] md: flush writes before starting a recovery Luis Henriques
                   ` (52 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit b397207b7475afa9df2f94541f978100ff1ea47e upstream.

Volatile bit was in the wrong location.  This bit is
not used at the moment.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/cikd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h
index 302d2b756e94..02846db501b5 100644
--- a/drivers/gpu/drm/radeon/cikd.h
+++ b/drivers/gpu/drm/radeon/cikd.h
@@ -1123,12 +1123,12 @@
 #define		EOP_TC_WB_ACTION_EN                     (1 << 15) /* L2 */
 #define		EOP_TCL1_ACTION_EN                      (1 << 16)
 #define		EOP_TC_ACTION_EN                        (1 << 17) /* L2 */
+#define		EOP_TCL2_VOLATILE                       (1 << 24)
 #define		EOP_CACHE_POLICY(x)                     ((x) << 25)
                 /* 0 - LRU
 		 * 1 - Stream
 		 * 2 - Bypass
 		 */
-#define		EOP_TCL2_VOLATILE                       (1 << 27)
 #define		DATA_SEL(x)                             ((x) << 29)
                 /* 0 - discard
 		 * 1 - send low 32bit data
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 076/128] md: flush writes before starting a recovery.
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (74 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 075/128] drm/radeon/cik: fix typo in EOP packet Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 077/128] drm/vmwgfx: Fix incorrect write to read-only register v2: Luis Henriques
                   ` (51 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: NeilBrown <neilb@suse.de>

commit 133d4527eab8d199a62eee6bd433f0776842df2e 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: Bill <billstuff2001@sbcglobal.net>
Tested-by: Bill <billstuff2001@sbcglobal.net>
Link: http://lkml.kernel.org/r/53A518BB.60709@sbcglobal.net
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/md.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2d3111ba445c..e29e434a5742 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7466,6 +7466,19 @@ void md_do_sync(struct md_thread *thread)
 			    rdev->recovery_offset < j)
 				j = rdev->recovery_offset;
 		rcu_read_unlock();
+
+		/* If there is a bitmap, we need to make sure all
+		 * writes that started before we added a spare
+		 * complete before we start doing a recovery.
+		 * Otherwise the write might complete and (via
+		 * bitmap_endwrite) set a bit in the bitmap after the
+		 * recovery has checked that bit and skipped that
+		 * region.
+		 */
+		if (mddev->bitmap) {
+			mddev->pers->quiesce(mddev, 1);
+			mddev->pers->quiesce(mddev, 0);
+		}
 	}
 
 	printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev));
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 077/128] drm/vmwgfx: Fix incorrect write to read-only register v2:
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (75 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 076/128] md: flush writes before starting a recovery Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 078/128] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER Luis Henriques
                   ` (50 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christopher Friedt, Thomas Hellstrom, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Hellstrom <thellstrom@vmware.com>

commit 4e578080ed3262ed2c3985868539bc66218d25c0 upstream.

Commit "drm/vmwgfx: correct fb_fix_screeninfo.line_length", while fixing a
vmwgfx fbdev bug, also writes the pitch to a supposedly read-only register:
SVGA_REG_BYTES_PER_LINE, while it should be (and also in fact is) written to
SVGA_REG_PITCHLOCK.

This patch is Cc'd stable because of the unknown effects writing to this
register might have, particularly on older device versions.

v2: Updated log message.

Cc: Christopher Friedt <chrisfriedt@gmail.com>
Tested-by: Christopher Friedt <chrisfriedt@gmail.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 021b5227e783..1b0f34bd3a03 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -179,7 +179,6 @@ static int vmw_fb_set_par(struct fb_info *info)
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset);
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres);
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres);
-		vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length);
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID);
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 078/128] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (76 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 077/128] drm/vmwgfx: Fix incorrect write to read-only register v2: Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 079/128] /proc/stat: convert to single_open_size() Luis Henriques
                   ` (49 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Nazarewicz, Mel Gorman, David Rientjes, Marek Szyprowski,
	Catalin Marinas, Andrew Morton, Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michal Nazarewicz <mina86@mina86.com>

commit dc78327c0ea7da5186d8cbc1647bd6088c5c9fa5 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: Michal Nazarewicz <mina86@mina86.com>
Reported-by: Mark Salter <msalter@redhat.com>
Tested-by: Mark Salter <msalter@redhat.com>
Tested-by: Christopher 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/page_alloc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6a2b267a521f..1b5e9fb49ed4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -780,9 +780,21 @@ void __init init_cma_reserved_pageblock(struct page *page)
 		set_page_count(p, 0);
 	} while (++p, --i);
 
-	set_page_refcounted(page);
 	set_pageblock_migratetype(page, MIGRATE_CMA);
-	__free_pages(page, pageblock_order);
+
+	if (pageblock_order >= MAX_ORDER) {
+		i = pageblock_nr_pages;
+		p = page;
+		do {
+			set_page_refcounted(p);
+			__free_pages(p, MAX_ORDER - 1);
+			p += MAX_ORDER_NR_PAGES;
+		} while (i -= MAX_ORDER_NR_PAGES);
+	} else {
+		set_page_refcounted(page);
+		__free_pages(page, pageblock_order);
+	}
+
 	adjust_managed_page_count(page, pageblock_nr_pages);
 }
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 079/128] /proc/stat: convert to single_open_size()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (77 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 078/128] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 080/128] lz4: add overrun checks to lz4_uncompress_unknownoutputsize() Luis Henriques
                   ` (48 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Heiko Carstens, Ian Kent, Hendrik Brueckner, Thorsten Diehl,
	Andrea Righi, Christoph Hellwig, Al Viro, Stefan Bader,
	Andrew Morton, Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Heiko Carstens <heiko.carstens@de.ibm.com>

commit f74373a5cc7a0155d232c4e999648c7a95435bb2 upstream.

These two patches are supposed to "fix" failed order-4 memory
allocations which have been observed when reading /proc/stat.  The
problem has been observed on s390 as well as on x86.

To address the problem change the seq_file memory allocations to
fallback to use vmalloc, so that allocations also work if memory is
fragmented.

This approach seems to be simpler and less intrusive than changing
/proc/stat to use an interator.  Also it "fixes" other users as well,
which use seq_file's single_open() interface.

This patch (of 2):

Use seq_file's single_open_size() to preallocate a buffer that is large
enough to hold the whole output, instead of open coding it.  Also
calculate the requested size using the number of online cpus instead of
possible cpus, since the size of the output only depends on the number
of online cpus.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Thorsten Diehl <thorsten.diehl@de.ibm.com>
Cc: Andrea Righi <andrea@betterlinux.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/proc/stat.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index 1cf86c0e8689..ccc657e5ace1 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -184,29 +184,11 @@ static int show_stat(struct seq_file *p, void *v)
 
 static int stat_open(struct inode *inode, struct file *file)
 {
-	size_t size = 1024 + 128 * num_possible_cpus();
-	char *buf;
-	struct seq_file *m;
-	int res;
+	size_t size = 1024 + 128 * num_online_cpus();
 
 	/* minimum size to display an interrupt count : 2 bytes */
 	size += 2 * nr_irqs;
-
-	/* don't ask for more than the kmalloc() max size */
-	if (size > KMALLOC_MAX_SIZE)
-		size = KMALLOC_MAX_SIZE;
-	buf = kmalloc(size, GFP_KERNEL);
-	if (!buf)
-		return -ENOMEM;
-
-	res = single_open(file, show_stat, NULL);
-	if (!res) {
-		m = file->private_data;
-		m->buf = buf;
-		m->size = ksize(buf);
-	} else
-		kfree(buf);
-	return res;
+	return single_open_size(file, show_stat, NULL, size);
 }
 
 static const struct file_operations proc_stat_operations = {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 080/128] lz4: add overrun checks to lz4_uncompress_unknownoutputsize()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (78 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 079/128] /proc/stat: convert to single_open_size() Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 081/128] arm64: mm: Make icache synchronisation logic huge page aware Luis Henriques
                   ` (47 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Don A. Bailey, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4a3a99045177369700c60d074c0e525e8093b0fc upstream.

Jan points out that I forgot to make the needed fixes to the
lz4_uncompress_unknownoutputsize() function to mirror the changes done
in lz4_decompress() with regards to potential pointer overflows.

The only in-kernel user of this function is the zram code, which only
takes data from a valid compressed buffer that it made itself, so it's
not a big issue.  But due to external kernel modules using this
function, it's better to be safe here.

Reported-by: Jan Beulich <JBeulich@suse.com>
Cc: "Don A. Bailey" <donb@securitymouse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 lib/lz4/lz4_decompress.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index 8ee9333e87ae..b6ce2cf35d5d 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -192,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
 			int s = 255;
 			while ((ip < iend) && (s == 255)) {
 				s = *ip++;
+				if (unlikely(length > (size_t)(length + s)))
+					goto _output_error;
 				length += s;
 			}
 		}
@@ -232,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
 		if (length == ML_MASK) {
 			while (ip < iend) {
 				int s = *ip++;
+				if (unlikely(length > (size_t)(length + s)))
+					goto _output_error;
 				length += s;
 				if (s == 255)
 					continue;
@@ -284,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
 
 	/* write overflow error detected */
 _output_error:
-	return (int) (-(((char *) ip) - source));
+	return -1;
 }
 
 int lz4_decompress(const char *src, size_t *src_len, char *dest,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 081/128] arm64: mm: Make icache synchronisation logic huge page aware
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (79 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 080/128] lz4: add overrun checks to lz4_uncompress_unknownoutputsize() Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 082/128] rtmutex: Detect changes in the pi lock chain Luis Henriques
                   ` (46 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Steve Capper, Catalin Marinas, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steve Capper <steve.capper@linaro.org>

commit 923b8f5044da753e4985ab15c1374ced2cdf616c upstream.

The __sync_icache_dcache routine will only flush the dcache for the
first page of a compound page, potentially leading to stale icache
data residing further on in a hugetlb page.

This patch addresses this issue by taking into consideration the
order of the page when flushing the dcache.

Reported-by: Mark Brown <broonie@linaro.org>
Tested-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Steve Capper <steve.capper@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/mm/flush.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index e4193e3adc7f..0d64089d28b5 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -79,7 +79,8 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr)
 		return;
 
 	if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
-		__flush_dcache_area(page_address(page), PAGE_SIZE);
+		__flush_dcache_area(page_address(page),
+				PAGE_SIZE << compound_order(page));
 		__flush_icache_all();
 	} else if (icache_is_aivivt()) {
 		__flush_icache_all();
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 082/128] rtmutex: Detect changes in the pi lock chain
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (80 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 081/128] arm64: mm: Make icache synchronisation logic huge page aware Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 083/128] rtmutex: Plug slow unlock race Luis Henriques
                   ` (45 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Gleixner, Steven Rostedt, Peter Zijlstra, Mike Galbraith,
	Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit 82084984383babe728e6e3c9a8e5c46278091315 upstream.

When we walk the lock chain, we drop all locks after each step. So the
lock chain can change under us before we reacquire the locks. That's
harmless in principle as we just follow the wrong lock path. But it
can lead to a false positive in the dead lock detection logic:

T0 holds L0
T0 blocks on L1 held by T1
T1 blocks on L2 held by T2
T2 blocks on L3 held by T3
T4 blocks on L4 held by T4

Now we walk the chain

lock T1 -> lock L2 -> adjust L2 -> unlock T1 ->
     lock T2 ->  adjust T2 ->  drop locks

T2 times out and blocks on L0

Now we continue:

lock T2 -> lock L0 -> deadlock detected, but it's not a deadlock at all.

Brad tried to work around that in the deadlock detection logic itself,
but the more I looked at it the less I liked it, because it's crystal
ball magic after the fact.

We actually can detect a chain change very simple:

lock T1 -> lock L2 -> adjust L2 -> unlock T1 -> lock T2 -> adjust T2 ->

     next_lock = T2->pi_blocked_on->lock;

drop locks

T2 times out and blocks on L0

Now we continue:

lock T2 ->

     if (next_lock != T2->pi_blocked_on->lock)
     	   return;

So if we detect that T2 is now blocked on a different lock we stop the
chain walk. That's also correct in the following scenario:

lock T1 -> lock L2 -> adjust L2 -> unlock T1 -> lock T2 -> adjust T2 ->

     next_lock = T2->pi_blocked_on->lock;

drop locks

T3 times out and drops L3
T2 acquires L3 and blocks on L4 now

Now we continue:

lock T2 ->

     if (next_lock != T2->pi_blocked_on->lock)
     	   return;

We don't have to follow up the chain at that point, because T2
propagated our priority up to T4 already.

[ Folded a cleanup patch from peterz ]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Brad Mouring <bmouring@ni.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140605152801.930031935@linutronix.de
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/rtmutex.c | 95 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 71 insertions(+), 24 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 1029a85b2c64..ff24a43f192f 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -142,27 +142,36 @@ static void rt_mutex_adjust_prio(struct task_struct *task)
  */
 int max_lock_depth = 1024;
 
+static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p)
+{
+	return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL;
+}
+
 /*
  * Adjust the priority chain. Also used for deadlock detection.
  * Decreases task's usage by one - may thus free the task.
  *
- * @task: the task owning the mutex (owner) for which a chain walk is probably
- *	  needed
+ * @task:	the task owning the mutex (owner) for which a chain walk is
+ *		probably needed
  * @deadlock_detect: do we have to carry out deadlock detection?
- * @orig_lock: the mutex (can be NULL if we are walking the chain to recheck
- * 	       things for a task that has just got its priority adjusted, and
- *	       is waiting on a mutex)
+ * @orig_lock:	the mutex (can be NULL if we are walking the chain to recheck
+ *		things for a task that has just got its priority adjusted, and
+ *		is waiting on a mutex)
+ * @next_lock:	the mutex on which the owner of @orig_lock was blocked before
+ *		we dropped its pi_lock. Is never dereferenced, only used for
+ *		comparison to detect lock chain changes.
  * @orig_waiter: rt_mutex_waiter struct for the task that has just donated
- *		 its priority to the mutex owner (can be NULL in the case
- *		 depicted above or if the top waiter is gone away and we are
- *		 actually deboosting the owner)
- * @top_task: the current top waiter
+ *		its priority to the mutex owner (can be NULL in the case
+ *		depicted above or if the top waiter is gone away and we are
+ *		actually deboosting the owner)
+ * @top_task:	the current top waiter
  *
  * Returns 0 or -EDEADLK.
  */
 static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 				      int deadlock_detect,
 				      struct rt_mutex *orig_lock,
+				      struct rt_mutex *next_lock,
 				      struct rt_mutex_waiter *orig_waiter,
 				      struct task_struct *top_task)
 {
@@ -221,6 +230,18 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 		goto out_unlock_pi;
 
 	/*
+	 * We dropped all locks after taking a refcount on @task, so
+	 * the task might have moved on in the lock chain or even left
+	 * the chain completely and blocks now on an unrelated lock or
+	 * on @orig_lock.
+	 *
+	 * We stored the lock on which @task was blocked in @next_lock,
+	 * so we can detect the chain change.
+	 */
+	if (next_lock != waiter->lock)
+		goto out_unlock_pi;
+
+	/*
 	 * Drop out, when the task has no waiters. Note,
 	 * top_waiter can be NULL, when we are in the deboosting
 	 * mode!
@@ -306,11 +327,26 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 		__rt_mutex_adjust_prio(task);
 	}
 
+	/*
+	 * Check whether the task which owns the current lock is pi
+	 * blocked itself. If yes we store a pointer to the lock for
+	 * the lock chain change detection above. After we dropped
+	 * task->pi_lock next_lock cannot be dereferenced anymore.
+	 */
+	next_lock = task_blocked_on_lock(task);
+
 	raw_spin_unlock_irqrestore(&task->pi_lock, flags);
 
 	top_waiter = rt_mutex_top_waiter(lock);
 	raw_spin_unlock(&lock->wait_lock);
 
+	/*
+	 * We reached the end of the lock chain. Stop right here. No
+	 * point to go back just to figure that out.
+	 */
+	if (!next_lock)
+		goto out_put_task;
+
 	if (!detect_deadlock && waiter != top_waiter)
 		goto out_put_task;
 
@@ -421,8 +457,9 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 {
 	struct task_struct *owner = rt_mutex_owner(lock);
 	struct rt_mutex_waiter *top_waiter = waiter;
-	unsigned long flags;
+	struct rt_mutex *next_lock;
 	int chain_walk = 0, res;
+	unsigned long flags;
 
 	/*
 	 * Early deadlock detection. We really don't want the task to
@@ -455,20 +492,28 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 	if (!owner)
 		return 0;
 
+	raw_spin_lock_irqsave(&owner->pi_lock, flags);
 	if (waiter == rt_mutex_top_waiter(lock)) {
-		raw_spin_lock_irqsave(&owner->pi_lock, flags);
 		plist_del(&top_waiter->pi_list_entry, &owner->pi_waiters);
 		plist_add(&waiter->pi_list_entry, &owner->pi_waiters);
 
 		__rt_mutex_adjust_prio(owner);
 		if (owner->pi_blocked_on)
 			chain_walk = 1;
-		raw_spin_unlock_irqrestore(&owner->pi_lock, flags);
-	}
-	else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock))
+	} else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) {
 		chain_walk = 1;
+	}
 
-	if (!chain_walk)
+	/* Store the lock on which owner is blocked or NULL */
+	next_lock = task_blocked_on_lock(owner);
+
+	raw_spin_unlock_irqrestore(&owner->pi_lock, flags);
+	/*
+	 * Even if full deadlock detection is on, if the owner is not
+	 * blocked itself, we can avoid finding this out in the chain
+	 * walk.
+	 */
+	if (!chain_walk || !next_lock)
 		return 0;
 
 	/*
@@ -480,8 +525,8 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 
 	raw_spin_unlock(&lock->wait_lock);
 
-	res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, waiter,
-					 task);
+	res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock,
+					 next_lock, waiter, task);
 
 	raw_spin_lock(&lock->wait_lock);
 
@@ -530,8 +575,8 @@ static void remove_waiter(struct rt_mutex *lock,
 {
 	int first = (waiter == rt_mutex_top_waiter(lock));
 	struct task_struct *owner = rt_mutex_owner(lock);
+	struct rt_mutex *next_lock = NULL;
 	unsigned long flags;
-	int chain_walk = 0;
 
 	raw_spin_lock_irqsave(&current->pi_lock, flags);
 	plist_del(&waiter->list_entry, &lock->wait_list);
@@ -555,15 +600,15 @@ static void remove_waiter(struct rt_mutex *lock,
 		}
 		__rt_mutex_adjust_prio(owner);
 
-		if (owner->pi_blocked_on)
-			chain_walk = 1;
+		/* Store the lock on which owner is blocked or NULL */
+		next_lock = task_blocked_on_lock(owner);
 
 		raw_spin_unlock_irqrestore(&owner->pi_lock, flags);
 	}
 
 	WARN_ON(!plist_node_empty(&waiter->pi_list_entry));
 
-	if (!chain_walk)
+	if (!next_lock)
 		return;
 
 	/* gets dropped in rt_mutex_adjust_prio_chain()! */
@@ -571,7 +616,7 @@ static void remove_waiter(struct rt_mutex *lock,
 
 	raw_spin_unlock(&lock->wait_lock);
 
-	rt_mutex_adjust_prio_chain(owner, 0, lock, NULL, current);
+	rt_mutex_adjust_prio_chain(owner, 0, lock, next_lock, NULL, current);
 
 	raw_spin_lock(&lock->wait_lock);
 }
@@ -584,6 +629,7 @@ static void remove_waiter(struct rt_mutex *lock,
 void rt_mutex_adjust_pi(struct task_struct *task)
 {
 	struct rt_mutex_waiter *waiter;
+	struct rt_mutex *next_lock;
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&task->pi_lock, flags);
@@ -593,12 +639,13 @@ void rt_mutex_adjust_pi(struct task_struct *task)
 		raw_spin_unlock_irqrestore(&task->pi_lock, flags);
 		return;
 	}
-
+	next_lock = waiter->lock;
 	raw_spin_unlock_irqrestore(&task->pi_lock, flags);
 
 	/* gets dropped in rt_mutex_adjust_prio_chain()! */
 	get_task_struct(task);
-	rt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task);
+
+	rt_mutex_adjust_prio_chain(task, 0, NULL, next_lock, NULL, task);
 }
 
 /**
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 083/128] rtmutex: Plug slow unlock race
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (81 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 082/128] rtmutex: Detect changes in the pi lock chain Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 084/128] ARC: Implement ptrace(PTRACE_GET_THREAD_AREA) Luis Henriques
                   ` (44 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Gleixner, Peter Zijlstra, Mike Galbraith, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit 27e35715df54cbc4f2d044f681802ae30479e7fb upstream.

When the rtmutex fast path is enabled the slow unlock function can
create the following situation:

spin_lock(foo->m->wait_lock);
foo->m->owner = NULL;
	    			rt_mutex_lock(foo->m); <-- fast path
				free = atomic_dec_and_test(foo->refcnt);
				rt_mutex_unlock(foo->m); <-- fast path
				if (free)
				   kfree(foo);

spin_unlock(foo->m->wait_lock); <--- Use after free.

Plug the race by changing the slow unlock to the following scheme:

     while (!rt_mutex_has_waiters(m)) {
     	    /* Clear the waiters bit in m->owner */
	    clear_rt_mutex_waiters(m);
      	    owner = rt_mutex_owner(m);
      	    spin_unlock(m->wait_lock);
      	    if (cmpxchg(m->owner, owner, 0) == owner)
      	       return;
      	    spin_lock(m->wait_lock);
     }

So in case of a new waiter incoming while the owner tries the slow
path unlock we have two situations:

 unlock(wait_lock);
					lock(wait_lock);
 cmpxchg(p, owner, 0) == owner
 	    	   			mark_rt_mutex_waiters(lock);
	 				acquire(lock);

Or:

 unlock(wait_lock);
					lock(wait_lock);
	 				mark_rt_mutex_waiters(lock);
 cmpxchg(p, owner, 0) != owner
					enqueue_waiter();
					unlock(wait_lock);
 lock(wait_lock);
 wakeup_next waiter();
 unlock(wait_lock);
					lock(wait_lock);
					acquire(lock);

If the fast path is disabled, then the simple

   m->owner = NULL;
   unlock(m->wait_lock);

is sufficient as all access to m->owner is serialized via
m->wait_lock;

Also document and clarify the wakeup_next_waiter function as suggested
by Oleg Nesterov.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140611183852.937945560@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/rtmutex.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 109 insertions(+), 6 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index ff24a43f192f..51a83343df68 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -82,6 +82,47 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
 		owner = *p;
 	} while (cmpxchg(p, owner, owner | RT_MUTEX_HAS_WAITERS) != owner);
 }
+
+/*
+ * Safe fastpath aware unlock:
+ * 1) Clear the waiters bit
+ * 2) Drop lock->wait_lock
+ * 3) Try to unlock the lock with cmpxchg
+ */
+static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock)
+	__releases(lock->wait_lock)
+{
+	struct task_struct *owner = rt_mutex_owner(lock);
+
+	clear_rt_mutex_waiters(lock);
+	raw_spin_unlock(&lock->wait_lock);
+	/*
+	 * If a new waiter comes in between the unlock and the cmpxchg
+	 * we have two situations:
+	 *
+	 * unlock(wait_lock);
+	 *					lock(wait_lock);
+	 * cmpxchg(p, owner, 0) == owner
+	 *					mark_rt_mutex_waiters(lock);
+	 *					acquire(lock);
+	 * or:
+	 *
+	 * unlock(wait_lock);
+	 *					lock(wait_lock);
+	 *					mark_rt_mutex_waiters(lock);
+	 *
+	 * cmpxchg(p, owner, 0) != owner
+	 *					enqueue_waiter();
+	 *					unlock(wait_lock);
+	 * lock(wait_lock);
+	 * wake waiter();
+	 * unlock(wait_lock);
+	 *					lock(wait_lock);
+	 *					acquire(lock);
+	 */
+	return rt_mutex_cmpxchg(lock, owner, NULL);
+}
+
 #else
 # define rt_mutex_cmpxchg(l,c,n)	(0)
 static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
@@ -89,6 +130,17 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
 	lock->owner = (struct task_struct *)
 			((unsigned long)lock->owner | RT_MUTEX_HAS_WAITERS);
 }
+
+/*
+ * Simple slow path only version: lock->owner is protected by lock->wait_lock.
+ */
+static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock)
+	__releases(lock->wait_lock)
+{
+	lock->owner = NULL;
+	raw_spin_unlock(&lock->wait_lock);
+	return true;
+}
 #endif
 
 /*
@@ -536,7 +588,8 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 /*
  * Wake up the next waiter on the lock.
  *
- * Remove the top waiter from the current tasks waiter list and wake it up.
+ * Remove the top waiter from the current tasks pi waiter list and
+ * wake it up.
  *
  * Called with lock->wait_lock held.
  */
@@ -557,10 +610,23 @@ static void wakeup_next_waiter(struct rt_mutex *lock)
 	 */
 	plist_del(&waiter->pi_list_entry, &current->pi_waiters);
 
-	rt_mutex_set_owner(lock, NULL);
+	/*
+	 * As we are waking up the top waiter, and the waiter stays
+	 * queued on the lock until it gets the lock, this lock
+	 * obviously has waiters. Just set the bit here and this has
+	 * the added benefit of forcing all new tasks into the
+	 * slow path making sure no task of lower priority than
+	 * the top waiter can steal this lock.
+	 */
+	lock->owner = (void *) RT_MUTEX_HAS_WAITERS;
 
 	raw_spin_unlock_irqrestore(&current->pi_lock, flags);
 
+	/*
+	 * It's safe to dereference waiter as it cannot go away as
+	 * long as we hold lock->wait_lock. The waiter task needs to
+	 * acquire it in order to dequeue the waiter.
+	 */
 	wake_up_process(waiter->task);
 }
 
@@ -813,12 +879,49 @@ rt_mutex_slowunlock(struct rt_mutex *lock)
 
 	rt_mutex_deadlock_account_unlock(current);
 
-	if (!rt_mutex_has_waiters(lock)) {
-		lock->owner = NULL;
-		raw_spin_unlock(&lock->wait_lock);
-		return;
+	/*
+	 * We must be careful here if the fast path is enabled. If we
+	 * have no waiters queued we cannot set owner to NULL here
+	 * because of:
+	 *
+	 * foo->lock->owner = NULL;
+	 *			rtmutex_lock(foo->lock);   <- fast path
+	 *			free = atomic_dec_and_test(foo->refcnt);
+	 *			rtmutex_unlock(foo->lock); <- fast path
+	 *			if (free)
+	 *				kfree(foo);
+	 * raw_spin_unlock(foo->lock->wait_lock);
+	 *
+	 * So for the fastpath enabled kernel:
+	 *
+	 * Nothing can set the waiters bit as long as we hold
+	 * lock->wait_lock. So we do the following sequence:
+	 *
+	 *	owner = rt_mutex_owner(lock);
+	 *	clear_rt_mutex_waiters(lock);
+	 *	raw_spin_unlock(&lock->wait_lock);
+	 *	if (cmpxchg(&lock->owner, owner, 0) == owner)
+	 *		return;
+	 *	goto retry;
+	 *
+	 * The fastpath disabled variant is simple as all access to
+	 * lock->owner is serialized by lock->wait_lock:
+	 *
+	 *	lock->owner = NULL;
+	 *	raw_spin_unlock(&lock->wait_lock);
+	 */
+	while (!rt_mutex_has_waiters(lock)) {
+		/* Drops lock->wait_lock ! */
+		if (unlock_rt_mutex_safe(lock) == true)
+			return;
+		/* Relock the rtmutex and try again */
+		raw_spin_lock(&lock->wait_lock);
 	}
 
+	/*
+	 * The wakeup next waiter path does not suffer from the above
+	 * race. See the comments there.
+	 */
 	wakeup_next_waiter(lock);
 
 	raw_spin_unlock(&lock->wait_lock);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 084/128] ARC: Implement ptrace(PTRACE_GET_THREAD_AREA)
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (82 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 083/128] rtmutex: Plug slow unlock race Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 085/128] mac80211: fix IBSS join by initializing last_scan_completed Luis Henriques
                   ` (43 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Anton Kolesov, Vineet Gupta, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Anton Kolesov <Anton.Kolesov@synopsys.com>

commit a4b6cb735b25aa84a462a1985e3e43bebaf5beb4 upstream.

This patch adds implementation of GET_THREAD_AREA ptrace request type. This
is required by GDB to debug NPTL applications.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arc/include/uapi/asm/ptrace.h | 1 +
 arch/arc/kernel/ptrace.c           | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h
index 2618cc13ba75..76a7739aab1c 100644
--- a/arch/arc/include/uapi/asm/ptrace.h
+++ b/arch/arc/include/uapi/asm/ptrace.h
@@ -11,6 +11,7 @@
 #ifndef _UAPI__ASM_ARC_PTRACE_H
 #define _UAPI__ASM_ARC_PTRACE_H
 
+#define PTRACE_GET_THREAD_AREA	25
 
 #ifndef __ASSEMBLY__
 /*
diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
index 5d76706139dd..13b3ffb27a38 100644
--- a/arch/arc/kernel/ptrace.c
+++ b/arch/arc/kernel/ptrace.c
@@ -146,6 +146,10 @@ long arch_ptrace(struct task_struct *child, long request,
 	pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data);
 
 	switch (request) {
+	case PTRACE_GET_THREAD_AREA:
+		ret = put_user(task_thread_info(child)->thr_ptr,
+			       (unsigned long __user *)data);
+		break;
 	default:
 		ret = ptrace_request(child, request, addr, data);
 		break;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 085/128] mac80211: fix IBSS join by initializing last_scan_completed
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (83 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 084/128] ARC: Implement ptrace(PTRACE_GET_THREAD_AREA) Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 086/128] [SCSI] Fix spurious request sense in error handling Luis Henriques
                   ` (42 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Hałasa, Johannes Berg, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= <khalasa@piap.pl>

commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b upstream.

Without this fix, freshly rebooted Linux creates a new IBSS
instead of joining an existing one. Only when jiffies counter
overflows after 5 minutes the IBSS can be successfully joined.

Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
[edit commit message slightly]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/ibss.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 2d45643c964e..97a4b5b9d506 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1055,6 +1055,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
 	sdata->u.ibss.privacy = params->privacy;
 	sdata->u.ibss.control_port = params->control_port;
 	sdata->u.ibss.basic_rates = params->basic_rates;
+	sdata->u.ibss.last_scan_completed = jiffies;
 	memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate,
 	       sizeof(params->mcast_rate));
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 086/128] [SCSI] Fix spurious request sense in error handling
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (84 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 085/128] mac80211: fix IBSS join by initializing last_scan_completed Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 087/128] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Luis Henriques
                   ` (41 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: James Bottomley, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Bottomley <JBottomley@Parallels.com>

commit d555a2abf3481f81303d835046a5ec2c4fb3ca8e upstream.

We unconditionally execute scsi_eh_get_sense() to make sure all failed
commands that should have sense attached, do.  However, the routine forgets
that some commands, because of the way they fail, will not have any sense code
... we should not bother them with a REQUEST_SENSE command.  Fix this by
testing to see if we actually got a CHECK_CONDITION return and skip asking for
sense if we don't.

Tested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/scsi_error.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 21505962f539..309f2e1d254d 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -933,6 +933,15 @@ int scsi_eh_get_sense(struct list_head *work_q,
 		    SCSI_SENSE_VALID(scmd))
 			continue;
 
+		if (status_byte(scmd->result) != CHECK_CONDITION)
+			/*
+			 * don't request sense if there's no check condition
+			 * status because the error we're processing isn't one
+			 * that has a sense code (and some devices get
+			 * confused by sense requests out of the blue)
+			 */
+			continue;
+
 		SCSI_LOG_ERROR_RECOVERY(2, scmd_printk(KERN_INFO, scmd,
 						  "%s: requesting sense\n",
 						  current->comm));
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 087/128] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (85 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 086/128] [SCSI] Fix spurious request sense in error handling Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 088/128] netfilter: nf_nat: fix oops on netns removal Luis Henriques
                   ` (40 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Julian Anastasov, Simon Horman, Pablo Neira Ayuso, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Julian Anastasov <ja@ssi.bg>

commit 9802d21e7a0b0d2167ef745edc1f4ea7a0fc6ea3 upstream.

The tot_stats estimator is started only when CONFIG_SYSCTL
is defined. But it is stopped without checking CONFIG_SYSCTL.
Fix the crash by moving ip_vs_stop_estimator into
ip_vs_control_net_cleanup_sysctl.

The change is needed after commit 14e405461e664b
("IPVS: Add __ip_vs_control_{init,cleanup}_sysctl()") from 2.6.39.

Reported-by: Jet Chen <jet.chen@intel.com>
Tested-by: Jet Chen <jet.chen@intel.com>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index c8148e487386..c9de95e8faa6 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3781,6 +3781,7 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net)
 	cancel_delayed_work_sync(&ipvs->defense_work);
 	cancel_work_sync(&ipvs->defense_work.work);
 	unregister_net_sysctl_table(ipvs->sysctl_hdr);
+	ip_vs_stop_estimator(net, &ipvs->tot_stats);
 }
 
 #else
@@ -3841,7 +3842,6 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
 	 */
 	rcu_barrier();
 	ip_vs_trash_cleanup(net);
-	ip_vs_stop_estimator(net, &ipvs->tot_stats);
 	ip_vs_control_net_cleanup_sysctl(net);
 	remove_proc_entry("ip_vs_stats_percpu", net->proc_net);
 	remove_proc_entry("ip_vs_stats", net->proc_net);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 088/128] netfilter: nf_nat: fix oops on netns removal
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (86 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 087/128] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 089/128] workqueue: fix dev_set_uevent_suppress() imbalance Luis Henriques
                   ` (39 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Florian Westphal, Pablo Neira Ayuso, Chris J Arges, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Westphal <fw@strlen.de>

commit 945b2b2d259d1a4364a2799e80e8ff32f8c6ee6f upstream.

Quoting Samu Kallio:

 Basically what's happening is, during netns cleanup,
 nf_nat_net_exit gets called before ipv4_net_exit. As I understand
 it, nf_nat_net_exit is supposed to kill any conntrack entries which
 have NAT context (through nf_ct_iterate_cleanup), but for some
 reason this doesn't happen (perhaps something else is still holding
 refs to those entries?).

 When ipv4_net_exit is called, conntrack entries (including those
 with NAT context) are cleaned up, but the
 nat_bysource hashtable is long gone - freed in nf_nat_net_exit. The
 bug happens when attempting to free a conntrack entry whose NAT hash
 'prev' field points to a slot in the freed hash table (head for that
 bin).

We ignore conntracks with null nat bindings.  But this is wrong,
as these are in bysource hash table as well.

Restore nat-cleaning for the netns-is-being-removed case.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=65191

Fixes: c2d421e1718 ('netfilter: nf_nat: fix race when unloading protocol modules')
Reported-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Debugged-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Tested-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Chris J Arges <chris.j.arges@canonical.com>
[ luis: backported to 3.11:
  - nf_ct_iterate_cleanup() have only 3 parameters ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nf_nat_core.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 038eee5c8f85..2bb801e3ee8c 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -487,6 +487,39 @@ static int nf_nat_proto_remove(struct nf_conn *i, void *data)
 	return i->status & IPS_NAT_MASK ? 1 : 0;
 }
 
+static int nf_nat_proto_clean(struct nf_conn *ct, void *data)
+{
+	struct nf_conn_nat *nat = nfct_nat(ct);
+
+	if (nf_nat_proto_remove(ct, data))
+		return 1;
+
+	if (!nat || !nat->ct)
+		return 0;
+
+	/* This netns is being destroyed, and conntrack has nat null binding.
+	 * Remove it from bysource hash, as the table will be freed soon.
+	 *
+	 * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack()
+	 * will delete entry from already-freed table.
+	 */
+	if (!del_timer(&ct->timeout))
+		return 1;
+
+	spin_lock_bh(&nf_nat_lock);
+	hlist_del_rcu(&nat->bysource);
+	ct->status &= ~IPS_NAT_DONE_MASK;
+	nat->ct = NULL;
+	spin_unlock_bh(&nf_nat_lock);
+
+	add_timer(&ct->timeout);
+
+	/* don't delete conntrack.  Although that would make things a lot
+	 * simpler, we'd end up flushing all conntracks on nat rmmod.
+	 */
+	return 0;
+}
+
 static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto)
 {
 	struct nf_nat_proto_clean clean = {
@@ -749,7 +782,7 @@ static void __net_exit nf_nat_net_exit(struct net *net)
 {
 	struct nf_nat_proto_clean clean = {};
 
-	nf_ct_iterate_cleanup(net, &nf_nat_proto_remove, &clean);
+	nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean);
 	synchronize_rcu();
 	nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 089/128] workqueue: fix dev_set_uevent_suppress() imbalance
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (87 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 088/128] netfilter: nf_nat: fix oops on netns removal Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 090/128] cpuset,mempolicy: fix sleeping function called from invalid context Luis Henriques
                   ` (38 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Maxime Bizon, Tejun Heo, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maxime Bizon <mbizon@freebox.fr>

commit bddbceb688c6d0decaabc7884fede319d02f96c8 upstream.

Uevents are suppressed during attributes registration, but never
restored, so kobject_uevent() does nothing.

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 226223ab3c4118ddd10688cc2c131135848371ab
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/workqueue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 23071c9acdc1..ac1336d91ba1 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3391,6 +3391,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
 		}
 	}
 
+	dev_set_uevent_suppress(&wq_dev->dev, false);
 	kobject_uevent(&wq_dev->dev.kobj, KOBJ_ADD);
 	return 0;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 090/128] cpuset,mempolicy: fix sleeping function called from invalid context
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (88 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 089/128] workqueue: fix dev_set_uevent_suppress() imbalance Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 091/128] crypto: sha512_ssse3 - fix byte count to bit count conversion Luis Henriques
                   ` (37 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Gu Zheng, Tejun Heo, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Gu Zheng <guz.fnst@cn.fujitsu.com>

commit 391acf970d21219a2a5446282d3b20eace0c0d7a 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: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/cpuset.c | 8 +++++++-
 mm/mempolicy.c  | 2 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 26e7a5da9e84..8708f0c68623 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1247,7 +1247,13 @@ done:
 
 int current_cpuset_is_being_rebound(void)
 {
-	return task_cs(current) == cpuset_being_rebound;
+	int ret;
+
+	rcu_read_lock();
+	ret = task_cs(current) == cpuset_being_rebound;
+	rcu_read_unlock();
+
+	return ret;
 }
 
 static int update_relax_domain_level(struct cpuset *cs, s64 val)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 9aec9ae2a99c..41fa5ec8a99e 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2086,7 +2086,6 @@ struct mempolicy *__mpol_dup(struct mempolicy *old)
 	} else
 		*new = *old;
 
-	rcu_read_lock();
 	if (current_cpuset_is_being_rebound()) {
 		nodemask_t mems = cpuset_mems_allowed(current);
 		if (new->flags & MPOL_F_REBINDING)
@@ -2094,7 +2093,6 @@ struct mempolicy *__mpol_dup(struct mempolicy *old)
 		else
 			mpol_rebind_policy(new, &mems, MPOL_REBIND_ONCE);
 	}
-	rcu_read_unlock();
 	atomic_set(&new->refcnt, 1);
 	return new;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 091/128] crypto: sha512_ssse3 - fix byte count to bit count conversion
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (89 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 090/128] cpuset,mempolicy: fix sleeping function called from invalid context Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 092/128] thermal: hwmon: Make the check for critical temp valid consistent Luis Henriques
                   ` (36 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jussi Kivilinna, Herbert Xu, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jussi Kivilinna <jussi.kivilinna@iki.fi>

commit cfe82d4f45c7cc39332a2be7c4c1d3bf279bbd3d 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: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Acked-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/crypto/sha512_ssse3_glue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c
index f30cd10293f0..8626b03e83b7 100644
--- a/arch/x86/crypto/sha512_ssse3_glue.c
+++ b/arch/x86/crypto/sha512_ssse3_glue.c
@@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct shash_desc *desc, u8 *out)
 
 	/* save number of bits */
 	bits[1] = cpu_to_be64(sctx->count[0] << 3);
-	bits[0] = cpu_to_be64(sctx->count[1] << 3) | sctx->count[0] >> 61;
+	bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
 
 	/* Pad out to 112 mod 128 and append length */
 	index = sctx->count[0] & 0x7f;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 092/128] thermal: hwmon: Make the check for critical temp valid consistent
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (90 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 091/128] crypto: sha512_ssse3 - fix byte count to bit count conversion Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 093/128] hwmon: (amc6821) Fix permissions for temp2_input Luis Henriques
                   ` (35 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Aaron Lu, Zhang Rui, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Aaron Lu <aaron.lu@intel.com>

commit e8db5d6736a712a3e2280c0e31f4b301d85172d8 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: [PATCH] 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: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
[ luis: backported to 3.11:
  - file rename: thermal_hwmon.c -> thermal_core.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/thermal/thermal_core.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 1f02e8edb45c..3c972c49f2cf 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -971,6 +971,12 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
 	return NULL;
 }
 
+static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
+{
+	unsigned long temp;
+	return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
+}
+
 static int
 thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 {
@@ -1021,21 +1027,18 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 	if (result)
 		goto free_temp_mem;
 
-	if (tz->ops->get_crit_temp) {
-		unsigned long temperature;
-		if (!tz->ops->get_crit_temp(tz, &temperature)) {
-			snprintf(temp->temp_crit.name,
-				 sizeof(temp->temp_crit.name),
+	if (thermal_zone_crit_temp_valid(tz)) {
+		snprintf(temp->temp_crit.name,
+				sizeof(temp->temp_crit.name),
 				"temp%d_crit", hwmon->count);
-			temp->temp_crit.attr.attr.name = temp->temp_crit.name;
-			temp->temp_crit.attr.attr.mode = 0444;
-			temp->temp_crit.attr.show = temp_crit_show;
-			sysfs_attr_init(&temp->temp_crit.attr.attr);
-			result = device_create_file(hwmon->device,
-						    &temp->temp_crit.attr);
-			if (result)
-				goto unregister_input;
-		}
+		temp->temp_crit.attr.attr.name = temp->temp_crit.name;
+		temp->temp_crit.attr.attr.mode = 0444;
+		temp->temp_crit.attr.show = temp_crit_show;
+		sysfs_attr_init(&temp->temp_crit.attr.attr);
+		result = device_create_file(hwmon->device,
+					    &temp->temp_crit.attr);
+		if (result)
+			goto unregister_input;
 	}
 
 	mutex_lock(&thermal_list_lock);
@@ -1083,7 +1086,7 @@ thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
 	}
 
 	device_remove_file(hwmon->device, &temp->temp_input.attr);
-	if (tz->ops->get_crit_temp)
+	if (thermal_zone_crit_temp_valid(tz))
 		device_remove_file(hwmon->device, &temp->temp_crit.attr);
 
 	mutex_lock(&thermal_list_lock);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 093/128] hwmon: (amc6821) Fix permissions for temp2_input
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (91 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 092/128] thermal: hwmon: Make the check for critical temp valid consistent Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 094/128] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Luis Henriques
                   ` (34 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Axel Lin, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@ingics.com>

commit df86754b746e9a0ff6f863f690b1c01d408e3cdc upstream.

temp2_input should not be writable, fix it.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hwmon/amc6821.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
index 4fe49d2bfe1d..09d2d78d482b 100644
--- a/drivers/hwmon/amc6821.c
+++ b/drivers/hwmon/amc6821.c
@@ -707,7 +707,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO,
 	get_temp_alarm, NULL, IDX_TEMP1_MAX);
 static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO,
 	get_temp_alarm, NULL, IDX_TEMP1_CRIT);
-static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO,
 	get_temp, NULL, IDX_TEMP2_INPUT);
 static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp,
 	set_temp, IDX_TEMP2_MIN);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 094/128] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (92 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 093/128] hwmon: (amc6821) Fix permissions for temp2_input Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 095/128] hwmon: (adm1021) Fix cache problem when writing temperature limits Luis Henriques
                   ` (33 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Axel Lin, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@ingics.com>

commit 1035a9e3e9c76b64a860a774f5b867d28d34acc2 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: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hwmon/adm1029.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index 9ee5e066423b..39441e5d922c 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -232,6 +232,9 @@ static ssize_t set_fan_div(struct device *dev,
 	/* Update the value */
 	reg = (reg & 0x3F) | (val << 6);
 
+	/* Update the cache */
+	data->fan_div[attr->index] = reg;
+
 	/* Write value */
 	i2c_smbus_write_byte_data(client,
 				  ADM1029_REG_FAN_DIV[attr->index], reg);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 095/128] hwmon: (adm1021) Fix cache problem when writing temperature limits
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (93 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 094/128] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 096/128] ext4: fix unjournalled bg descriptor while initializing inode bitmap Luis Henriques
                   ` (32 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Axel Lin, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@ingics.com>

commit c024044d4da2c9c3b32933b4235df1e409293b84 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: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hwmon/adm1021.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index 29dd9f746dfa..233b374334ed 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -185,7 +185,7 @@ static ssize_t set_temp_max(struct device *dev,
 	struct i2c_client *client = to_i2c_client(dev);
 	struct adm1021_data *data = i2c_get_clientdata(client);
 	long temp;
-	int err;
+	int reg_val, err;
 
 	err = kstrtol(buf, 10, &temp);
 	if (err)
@@ -193,10 +193,11 @@ static ssize_t set_temp_max(struct device *dev,
 	temp /= 1000;
 
 	mutex_lock(&data->update_lock);
-	data->temp_max[index] = clamp_val(temp, -128, 127);
+	reg_val = clamp_val(temp, -128, 127);
+	data->temp_max[index] = reg_val * 1000;
 	if (!read_only)
 		i2c_smbus_write_byte_data(client, ADM1021_REG_TOS_W(index),
-					  data->temp_max[index]);
+					  reg_val);
 	mutex_unlock(&data->update_lock);
 
 	return count;
@@ -210,7 +211,7 @@ static ssize_t set_temp_min(struct device *dev,
 	struct i2c_client *client = to_i2c_client(dev);
 	struct adm1021_data *data = i2c_get_clientdata(client);
 	long temp;
-	int err;
+	int reg_val, err;
 
 	err = kstrtol(buf, 10, &temp);
 	if (err)
@@ -218,10 +219,11 @@ static ssize_t set_temp_min(struct device *dev,
 	temp /= 1000;
 
 	mutex_lock(&data->update_lock);
-	data->temp_min[index] = clamp_val(temp, -128, 127);
+	reg_val = clamp_val(temp, -128, 127);
+	data->temp_min[index] = reg_val * 1000;
 	if (!read_only)
 		i2c_smbus_write_byte_data(client, ADM1021_REG_THYST_W(index),
-					  data->temp_min[index]);
+					  reg_val);
 	mutex_unlock(&data->update_lock);
 
 	return count;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 096/128] ext4: fix unjournalled bg descriptor while initializing inode bitmap
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (94 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 095/128] hwmon: (adm1021) Fix cache problem when writing temperature limits Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 097/128] ext4: clarify error count warning messages Luis Henriques
                   ` (31 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Theodore Ts'o, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit 61c219f5814277ecb71d64cb30297028d6665979 upstream.

The first time that we allocate from an uninitialized inode allocation
bitmap, if the block allocation bitmap is also uninitalized, we need
to get write access to the block group descriptor before we start
modifying the block group descriptor flags and updating the free block
count, etc.  Otherwise, there is the potential of a bad journal
checksum (if journal checksums are enabled), and of the file system
becoming inconsistent if we crash at exactly the wrong time.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/ialloc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 8bf5999875ee..0ecc14028477 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -781,6 +781,13 @@ got:
 		goto out;
 	}
 
+	BUFFER_TRACE(group_desc_bh, "get_write_access");
+	err = ext4_journal_get_write_access(handle, group_desc_bh);
+	if (err) {
+		ext4_std_error(sb, err);
+		goto out;
+	}
+
 	/* We may have to initialize the block bitmap if it isn't already */
 	if (ext4_has_group_desc_csum(sb) &&
 	    gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
@@ -817,13 +824,6 @@ got:
 		}
 	}
 
-	BUFFER_TRACE(group_desc_bh, "get_write_access");
-	err = ext4_journal_get_write_access(handle, group_desc_bh);
-	if (err) {
-		ext4_std_error(sb, err);
-		goto out;
-	}
-
 	/* Update the relevant bg descriptor fields */
 	if (ext4_has_group_desc_csum(sb)) {
 		int free;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 097/128] ext4: clarify error count warning messages
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (95 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 096/128] ext4: fix unjournalled bg descriptor while initializing inode bitmap Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 098/128] ext4: disable synchronous transaction batching if max_batch_time==0 Luis Henriques
                   ` (30 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pavel Machek, Theodore Ts'o, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit ae0f78de2c43b6fadd007c231a352b13b5be8ed2 upstream.

Make it clear that values printed are times, and that it is error
since last fsck. Also add note about fsck version required.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/super.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 09d4762ffe91..f9659f067147 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2725,10 +2725,11 @@ static void print_daily_error_info(unsigned long arg)
 	es = sbi->s_es;
 
 	if (es->s_error_count)
-		ext4_msg(sb, KERN_NOTICE, "error count: %u",
+		/* fsck newer than v1.41.13 is needed to clean this condition. */
+		ext4_msg(sb, KERN_NOTICE, "error count since last fsck: %u",
 			 le32_to_cpu(es->s_error_count));
 	if (es->s_first_error_time) {
-		printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d",
+		printk(KERN_NOTICE "EXT4-fs (%s): initial error at time %u: %.*s:%d",
 		       sb->s_id, le32_to_cpu(es->s_first_error_time),
 		       (int) sizeof(es->s_first_error_func),
 		       es->s_first_error_func,
@@ -2742,7 +2743,7 @@ static void print_daily_error_info(unsigned long arg)
 		printk("\n");
 	}
 	if (es->s_last_error_time) {
-		printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d",
+		printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d",
 		       sb->s_id, le32_to_cpu(es->s_last_error_time),
 		       (int) sizeof(es->s_last_error_func),
 		       es->s_last_error_func,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 098/128] ext4: disable synchronous transaction batching if max_batch_time==0
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (96 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 097/128] ext4: clarify error count warning messages Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 099/128] intel_pstate: Set CPU number before accessing MSRs Luis Henriques
                   ` (29 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Sandeen, Theodore Ts'o, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Sandeen <sandeen@redhat.com>

commit 5dd214248f94d430d70e9230bda72f2654ac88a8 upstream.

The mount manpage says of the max_batch_time option,

	This optimization can be turned off entirely
	by setting max_batch_time to 0.

But the code doesn't do that.  So fix the code to do
that.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/super.c       | 2 --
 fs/jbd2/transaction.c | 5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index f9659f067147..e38c344a521e 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1501,8 +1501,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
 			arg = JBD2_DEFAULT_MAX_COMMIT_AGE;
 		sbi->s_commit_interval = HZ * arg;
 	} else if (token == Opt_max_batch_time) {
-		if (arg == 0)
-			arg = EXT4_DEF_MAX_BATCH_TIME;
 		sbi->s_max_batch_time = arg;
 	} else if (token == Opt_min_batch_time) {
 		sbi->s_min_batch_time = arg;
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 7272cc6977ec..ab3815c856dc 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1590,9 +1590,12 @@ int jbd2_journal_stop(handle_t *handle)
 	 * to perform a synchronous write.  We do this to detect the
 	 * case where a single process is doing a stream of sync
 	 * writes.  No point in waiting for joiners in that case.
+	 *
+	 * Setting max_batch_time to 0 disables this completely.
 	 */
 	pid = current->pid;
-	if (handle->h_sync && journal->j_last_sync_writer != pid) {
+	if (handle->h_sync && journal->j_last_sync_writer != pid &&
+	    journal->j_max_batch_time) {
 		u64 commit_time, trans_time;
 
 		journal->j_last_sync_writer = pid;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 099/128] intel_pstate: Set CPU number before accessing MSRs
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (97 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 098/128] ext4: disable synchronous transaction batching if max_batch_time==0 Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 100/128] USB: cp210x: add support for Corsair usb dongle Luis Henriques
                   ` (28 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vincent Minet, Rafael J. Wysocki, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vincent Minet <vincent@vincent-minet.net>

commit 179e8471673ce0249cd4ecda796008f7757e5bad upstream.

Ensure that cpu->cpu is set before writing MSR_IA32_PERF_CTL during CPU
initialization. Otherwise only cpu0 has its P-state set and all other
cores are left with their values unchanged.

In most cases, this is not too serious because the P-states will be set
correctly when the timer function is run.  But when the default governor
is set to performance, the per-CPU current_pstate stays the same forever
and no attempts are made to write the MSRs again.

Signed-off-by: Vincent Minet <vincent@vincent-minet.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ luis: backported to 3.11:
  - moved cpu->cpu up, instead of intel_pstate_get_cpu_pstates() down ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/cpufreq/intel_pstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index e52e5420033a..96a4c6e4d526 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -550,6 +550,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 
 	cpu = all_cpu_data[cpunum];
 
+	cpu->cpu = cpunum;
 	intel_pstate_get_cpu_pstates(cpu);
 	if (!cpu->pstate.current_pstate) {
 		all_cpu_data[cpunum] = NULL;
@@ -557,7 +558,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 		return -ENODATA;
 	}
 
-	cpu->cpu = cpunum;
 	cpu->pstate_policy =
 		(struct pstate_adjust_policy *)id->driver_data;
 	init_timer_deferrable(&cpu->timer);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 100/128] USB: cp210x: add support for Corsair usb dongle
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (98 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 099/128] intel_pstate: Set CPU number before accessing MSRs Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 101/128] usb: option: Add ID for Telewell TW-LTE 4G v2 Luis Henriques
                   ` (27 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andras Kovacs, Johan Hovold, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andras Kovacs <andras@sth.sze.hu>

commit b9326057a3d8447f5d2e74a7b521ccf21add2ec0 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: Andras Kovacs <andras@sth.sze.hu>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index a26b8c77e7c5..238497e9ae7b 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -153,6 +153,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
 	{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
 	{ USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
+	{ USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */
 	{ USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
 	{ USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
 	{ USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 101/128] usb: option: Add ID for Telewell TW-LTE 4G v2
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (99 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 100/128] USB: cp210x: add support for Corsair usb dongle Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 102/128] ACPI / EC: Avoid race condition related to advance_transaction() Luis Henriques
                   ` (26 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bernd Wachter, Johan Hovold, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bernd Wachter <bernd.wachter@jolla.com>

commit 3d28bd840b2d3981cd28caf5fe1df38f1344dd60 upstream.

Add ID of the Telewell 4G v2 hardware to option driver to get legacy
serial interface working

Signed-off-by: Bernd Wachter <bernd.wachter@jolla.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/option.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e25e8ca09fe2..9da566a3f5c8 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1487,6 +1487,8 @@ static const struct usb_device_id option_ids[] = {
 		.driver_info = (kernel_ulong_t)&net_intf2_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff),  /* ZTE MF91 */
 		.driver_info = (kernel_ulong_t)&net_intf2_blacklist },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff),  /* Telewell TW-LTE 4G v2 */
+		.driver_info = (kernel_ulong_t)&net_intf2_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) },
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 102/128] ACPI / EC: Avoid race condition related to advance_transaction()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (100 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 101/128] usb: option: Add ID for Telewell TW-LTE 4G v2 Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 103/128] ACPI / EC: Add asynchronous command byte write support Luis Henriques
                   ` (25 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lv Zheng, Rafael J. Wysocki, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lv Zheng <lv.zheng@intel.com>

commit 66b42b78bc1e816f92b662e8888c89195e4199e1 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=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/ec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 3ed713698d3d..769d5a757bd1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -175,12 +175,15 @@ static void start_transaction(struct acpi_ec *ec)
 	acpi_ec_write_cmd(ec, ec->curr->command);
 }
 
-static void advance_transaction(struct acpi_ec *ec, u8 status)
+static void advance_transaction(struct acpi_ec *ec)
 {
 	unsigned long flags;
 	struct transaction *t;
+	u8 status;
 
 	spin_lock_irqsave(&ec->lock, flags);
+	pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK");
+	status = acpi_ec_read_status(ec);
 	t = ec->curr;
 	if (!t)
 		goto unlock;
@@ -243,7 +246,7 @@ static int ec_poll(struct acpi_ec *ec)
 						msecs_to_jiffies(1)))
 					return 0;
 			}
-			advance_transaction(ec, acpi_ec_read_status(ec));
+			advance_transaction(ec);
 		} while (time_before(jiffies, delay));
 		pr_debug(PREFIX "controller reset, restart transaction\n");
 		spin_lock_irqsave(&ec->lock, flags);
@@ -662,11 +665,8 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	u32 gpe_number, void *data)
 {
 	struct acpi_ec *ec = data;
-	u8 status = acpi_ec_read_status(ec);
-
-	pr_debug(PREFIX "~~~> interrupt, status:0x%02x\n", status);
 
-	advance_transaction(ec, status);
+	advance_transaction(ec);
 	if (ec_transaction_done(ec) &&
 	    (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
 		wake_up(&ec->wait);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 103/128] ACPI / EC: Add asynchronous command byte write support
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (101 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 102/128] ACPI / EC: Avoid race condition related to advance_transaction() Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 104/128] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Luis Henriques
                   ` (24 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lv Zheng, Rafael J. Wysocki, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lv Zheng <lv.zheng@intel.com>

commit f92fca0060fc4dc9227342d0072d75df98c1e5a5 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=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/ec.c | 83 ++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 35 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 769d5a757bd1..02090c6095fe 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -81,6 +81,9 @@ enum {
 	EC_FLAGS_BLOCKED,		/* Transactions are blocked */
 };
 
+#define ACPI_EC_COMMAND_POLL		0x01 /* Available for command byte */
+#define ACPI_EC_COMMAND_COMPLETE	0x02 /* Completed last byte */
+
 /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */
 static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY;
 module_param(ec_delay, uint, 0644);
@@ -116,7 +119,7 @@ struct transaction {
 	u8 ri;
 	u8 wlen;
 	u8 rlen;
-	bool done;
+	u8 flags;
 };
 
 struct acpi_ec *boot_ec, *first_ec;
@@ -157,63 +160,68 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
 	outb(data, ec->data_addr);
 }
 
-static int ec_transaction_done(struct acpi_ec *ec)
+static int ec_transaction_completed(struct acpi_ec *ec)
 {
 	unsigned long flags;
 	int ret = 0;
 	spin_lock_irqsave(&ec->lock, flags);
-	if (!ec->curr || ec->curr->done)
+	if (!ec->curr || (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE))
 		ret = 1;
 	spin_unlock_irqrestore(&ec->lock, flags);
 	return ret;
 }
 
-static void start_transaction(struct acpi_ec *ec)
-{
-	ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
-	ec->curr->done = false;
-	acpi_ec_write_cmd(ec, ec->curr->command);
-}
-
 static void advance_transaction(struct acpi_ec *ec)
 {
-	unsigned long flags;
 	struct transaction *t;
 	u8 status;
 
-	spin_lock_irqsave(&ec->lock, flags);
 	pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK");
 	status = acpi_ec_read_status(ec);
 	t = ec->curr;
 	if (!t)
-		goto unlock;
-	if (t->wlen > t->wi) {
-		if ((status & ACPI_EC_FLAG_IBF) == 0)
-			acpi_ec_write_data(ec,
-				t->wdata[t->wi++]);
-		else
-			goto err;
-	} else if (t->rlen > t->ri) {
-		if ((status & ACPI_EC_FLAG_OBF) == 1) {
-			t->rdata[t->ri++] = acpi_ec_read_data(ec);
-			if (t->rlen == t->ri)
-				t->done = true;
+		goto err;
+	if (t->flags & ACPI_EC_COMMAND_POLL) {
+		if (t->wlen > t->wi) {
+			if ((status & ACPI_EC_FLAG_IBF) == 0)
+				acpi_ec_write_data(ec, t->wdata[t->wi++]);
+			else
+				goto err;
+		} else if (t->rlen > t->ri) {
+			if ((status & ACPI_EC_FLAG_OBF) == 1) {
+				t->rdata[t->ri++] = acpi_ec_read_data(ec);
+				if (t->rlen == t->ri)
+					t->flags |= ACPI_EC_COMMAND_COMPLETE;
+			} else
+				goto err;
+		} else if (t->wlen == t->wi &&
+			   (status & ACPI_EC_FLAG_IBF) == 0)
+			t->flags |= ACPI_EC_COMMAND_COMPLETE;
+		return;
+	} else {
+		if ((status & ACPI_EC_FLAG_IBF) == 0) {
+			acpi_ec_write_cmd(ec, t->command);
+			t->flags |= ACPI_EC_COMMAND_POLL;
 		} else
 			goto err;
-	} else if (t->wlen == t->wi &&
-		   (status & ACPI_EC_FLAG_IBF) == 0)
-		t->done = true;
-	goto unlock;
+		return;
+	}
 err:
 	/*
 	 * If SCI bit is set, then don't think it's a false IRQ
 	 * otherwise will take a not handled IRQ as a false one.
 	 */
-	if (in_interrupt() && !(status & ACPI_EC_FLAG_SCI))
-		++t->irq_count;
+	if (!(status & ACPI_EC_FLAG_SCI)) {
+		if (in_interrupt() && t)
+			++t->irq_count;
+	}
+}
 
-unlock:
-	spin_unlock_irqrestore(&ec->lock, flags);
+static void start_transaction(struct acpi_ec *ec)
+{
+	ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
+	ec->curr->flags = 0;
+	advance_transaction(ec);
 }
 
 static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);
@@ -238,15 +246,17 @@ static int ec_poll(struct acpi_ec *ec)
 			/* don't sleep with disabled interrupts */
 			if (EC_FLAGS_MSI || irqs_disabled()) {
 				udelay(ACPI_EC_MSI_UDELAY);
-				if (ec_transaction_done(ec))
+				if (ec_transaction_completed(ec))
 					return 0;
 			} else {
 				if (wait_event_timeout(ec->wait,
-						ec_transaction_done(ec),
+						ec_transaction_completed(ec),
 						msecs_to_jiffies(1)))
 					return 0;
 			}
+			spin_lock_irqsave(&ec->lock, flags);
 			advance_transaction(ec);
+			spin_unlock_irqrestore(&ec->lock, flags);
 		} while (time_before(jiffies, delay));
 		pr_debug(PREFIX "controller reset, restart transaction\n");
 		spin_lock_irqsave(&ec->lock, flags);
@@ -664,10 +674,13 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
 static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	u32 gpe_number, void *data)
 {
+	unsigned long flags;
 	struct acpi_ec *ec = data;
 
+	spin_lock_irqsave(&ec->lock, flags);
 	advance_transaction(ec);
-	if (ec_transaction_done(ec) &&
+	spin_unlock_irqrestore(&ec->lock, flags);
+	if (ec_transaction_completed(ec) &&
 	    (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
 		wake_up(&ec->wait);
 		ec_check_sci(ec, acpi_ec_read_status(ec));
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 104/128] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (102 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 103/128] ACPI / EC: Add asynchronous command byte write support Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 105/128] ACPI / EC: Fix race condition in ec_transaction_completed() Luis Henriques
                   ` (23 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lv Zheng, Rafael J. Wysocki, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lv Zheng <lv.zheng@intel.com>

commit 9b80f0f73ae1583c22325ede341c74195847618c 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=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/ec.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 02090c6095fe..59bf2d016fd1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -288,23 +288,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
 	return ret;
 }
 
-static int ec_check_ibf0(struct acpi_ec *ec)
-{
-	u8 status = acpi_ec_read_status(ec);
-	return (status & ACPI_EC_FLAG_IBF) == 0;
-}
-
-static int ec_wait_ibf0(struct acpi_ec *ec)
-{
-	unsigned long delay = jiffies + msecs_to_jiffies(ec_delay);
-	/* interrupt wait manually if GPE mode is not active */
-	while (time_before(jiffies, delay))
-		if (wait_event_timeout(ec->wait, ec_check_ibf0(ec),
-					msecs_to_jiffies(1)))
-			return 0;
-	return -ETIME;
-}
-
 static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
 {
 	int status;
@@ -325,12 +308,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
 			goto unlock;
 		}
 	}
-	if (ec_wait_ibf0(ec)) {
-		pr_err(PREFIX "input buffer is not empty, "
-				"aborting transaction\n");
-		status = -ETIME;
-		goto end;
-	}
 	pr_debug(PREFIX "transaction start (cmd=0x%02x, addr=0x%02x)\n",
 			t->command, t->wdata ? t->wdata[0] : 0);
 	/* disable GPE during transaction if storm is detected */
@@ -354,7 +331,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
 		set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
 	}
 	pr_debug(PREFIX "transaction end\n");
-end:
 	if (ec->global_lock)
 		acpi_release_global_lock(glk);
 unlock:
@@ -680,8 +656,7 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	spin_lock_irqsave(&ec->lock, flags);
 	advance_transaction(ec);
 	spin_unlock_irqrestore(&ec->lock, flags);
-	if (ec_transaction_completed(ec) &&
-	    (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
+	if (ec_transaction_completed(ec)) {
 		wake_up(&ec->wait);
 		ec_check_sci(ec, acpi_ec_read_status(ec));
 	}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 105/128] ACPI / EC: Fix race condition in ec_transaction_completed()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (103 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 104/128] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 106/128] ACPI / battery: Retry to get battery information if failed during probing Luis Henriques
                   ` (22 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lv Zheng, Rafael J. Wysocki, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lv Zheng <lv.zheng@intel.com>

commit c0d653412fc8450370167a3268b78fc772ff9c87 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=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/ec.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 59bf2d016fd1..8bcc70cdb1a0 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -165,16 +165,17 @@ static int ec_transaction_completed(struct acpi_ec *ec)
 	unsigned long flags;
 	int ret = 0;
 	spin_lock_irqsave(&ec->lock, flags);
-	if (!ec->curr || (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE))
+	if (ec->curr && (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE))
 		ret = 1;
 	spin_unlock_irqrestore(&ec->lock, flags);
 	return ret;
 }
 
-static void advance_transaction(struct acpi_ec *ec)
+static bool advance_transaction(struct acpi_ec *ec)
 {
 	struct transaction *t;
 	u8 status;
+	bool wakeup = false;
 
 	pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK");
 	status = acpi_ec_read_status(ec);
@@ -190,21 +191,25 @@ static void advance_transaction(struct acpi_ec *ec)
 		} else if (t->rlen > t->ri) {
 			if ((status & ACPI_EC_FLAG_OBF) == 1) {
 				t->rdata[t->ri++] = acpi_ec_read_data(ec);
-				if (t->rlen == t->ri)
+				if (t->rlen == t->ri) {
 					t->flags |= ACPI_EC_COMMAND_COMPLETE;
+					wakeup = true;
+				}
 			} else
 				goto err;
 		} else if (t->wlen == t->wi &&
-			   (status & ACPI_EC_FLAG_IBF) == 0)
+			   (status & ACPI_EC_FLAG_IBF) == 0) {
 			t->flags |= ACPI_EC_COMMAND_COMPLETE;
-		return;
+			wakeup = true;
+		}
+		return wakeup;
 	} else {
 		if ((status & ACPI_EC_FLAG_IBF) == 0) {
 			acpi_ec_write_cmd(ec, t->command);
 			t->flags |= ACPI_EC_COMMAND_POLL;
 		} else
 			goto err;
-		return;
+		return wakeup;
 	}
 err:
 	/*
@@ -215,13 +220,14 @@ err:
 		if (in_interrupt() && t)
 			++t->irq_count;
 	}
+	return wakeup;
 }
 
 static void start_transaction(struct acpi_ec *ec)
 {
 	ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
 	ec->curr->flags = 0;
-	advance_transaction(ec);
+	(void)advance_transaction(ec);
 }
 
 static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);
@@ -255,7 +261,7 @@ static int ec_poll(struct acpi_ec *ec)
 					return 0;
 			}
 			spin_lock_irqsave(&ec->lock, flags);
-			advance_transaction(ec);
+			(void)advance_transaction(ec);
 			spin_unlock_irqrestore(&ec->lock, flags);
 		} while (time_before(jiffies, delay));
 		pr_debug(PREFIX "controller reset, restart transaction\n");
@@ -654,12 +660,10 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	struct acpi_ec *ec = data;
 
 	spin_lock_irqsave(&ec->lock, flags);
-	advance_transaction(ec);
-	spin_unlock_irqrestore(&ec->lock, flags);
-	if (ec_transaction_completed(ec)) {
+	if (advance_transaction(ec))
 		wake_up(&ec->wait);
-		ec_check_sci(ec, acpi_ec_read_status(ec));
-	}
+	spin_unlock_irqrestore(&ec->lock, flags);
+	ec_check_sci(ec, acpi_ec_read_status(ec));
 	return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 106/128] ACPI / battery: Retry to get battery information if failed during probing
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (104 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 105/128] ACPI / EC: Fix race condition in ec_transaction_completed() Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 107/128] hwmon: (adm1031) Fix writes to limit registers Luis Henriques
                   ` (21 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lan Tianyu, Rafael J. Wysocki, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lan Tianyu <tianyu.lan@intel.com>

commit 75646e758a0ecbed5024454507d5be5b9ea9dcbf upstream.

Some machines (eg. Lenovo Z480) ECs are not stable during boot up
and causes battery driver fails to be loaded due to failure of getting
battery information from EC sometimes. After several retries, the
operation will work. This patch is to retry to get battery information 5
times if the first try fails.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=75581
Reported-and-tested-by: naszar <naszar@ya.ru>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ luis: backported to 3.11:
  - acpi_battery_update() has only one parameter in 3.11 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/battery.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index cb2ba88fcac3..06523d5743b6 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -34,6 +34,7 @@
 #include <linux/dmi.h>
 #include <linux/slab.h>
 #include <linux/suspend.h>
+#include <linux/delay.h>
 #include <asm/unaligned.h>
 
 #ifdef CONFIG_ACPI_PROCFS_POWER
@@ -1081,6 +1082,28 @@ static struct dmi_system_id bat_dmi_table[] = {
 	{},
 };
 
+/*
+ * Some machines'(E,G Lenovo Z480) ECs are not stable
+ * during boot up and this causes battery driver fails to be
+ * probed due to failure of getting battery information
+ * from EC sometimes. After several retries, the operation
+ * may work. So add retry code here and 20ms sleep between
+ * every retries.
+ */
+static int acpi_battery_update_retry(struct acpi_battery *battery)
+{
+	int retry, ret;
+
+	for (retry = 5; retry; retry--) {
+		ret = acpi_battery_update(battery);
+		if (!ret)
+			break;
+
+		msleep(20);
+	}
+	return ret;
+}
+
 static int acpi_battery_add(struct acpi_device *device)
 {
 	int result = 0;
@@ -1100,9 +1123,11 @@ static int acpi_battery_add(struct acpi_device *device)
 	if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle,
 			"_BIX", &handle)))
 		set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
-	result = acpi_battery_update(battery);
+
+	result = acpi_battery_update_retry(battery);
 	if (result)
 		goto fail;
+
 #ifdef CONFIG_ACPI_PROCFS_POWER
 	result = acpi_battery_add_fs(device);
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 107/128] hwmon: (adm1031) Fix writes to limit registers
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (105 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 106/128] ACPI / battery: Retry to get battery information if failed during probing Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 108/128] workqueue: zero cpumask of wq_numa_possible_cpumask on init Luis Henriques
                   ` (20 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Axel Lin, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit 145e74a4e5022225adb84f4e5d4fff7938475c35 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: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hwmon/adm1031.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 253ea396106d..bdceca0d7e22 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -365,6 +365,7 @@ set_auto_temp_min(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
+	val = clamp_val(val, 0, 127000);
 	mutex_lock(&data->update_lock);
 	data->auto_temp[nr] = AUTO_TEMP_MIN_TO_REG(val, data->auto_temp[nr]);
 	adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr),
@@ -394,6 +395,7 @@ set_auto_temp_max(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
+	val = clamp_val(val, 0, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_max[nr] = AUTO_TEMP_MAX_TO_REG(val, data->auto_temp[nr],
 						  data->pwm[nr]);
@@ -696,7 +698,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
-	val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875);
+	val = clamp_val(val, -55000, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_min[nr] = TEMP_TO_REG(val);
 	adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr),
@@ -717,7 +719,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
-	val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875);
+	val = clamp_val(val, -55000, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_max[nr] = TEMP_TO_REG(val);
 	adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr),
@@ -738,7 +740,7 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
-	val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875);
+	val = clamp_val(val, -55000, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_crit[nr] = TEMP_TO_REG(val);
 	adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 108/128] workqueue: zero cpumask of wq_numa_possible_cpumask on init
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (106 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 107/128] hwmon: (adm1031) Fix writes to limit registers Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 109/128] hwmon: (emc2103) Fix return value Luis Henriques
                   ` (19 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yasuaki Ishimatsu, Tejun Heo, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>

commit 5a6024f1604eef119cf3a6fa413fe0261a81a8f3 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: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: bce903809ab3 ("workqueue: add wq_numa_tbl_len and wq_numa_possible_cpumask[]")
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ac1336d91ba1..7ae565366ba9 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4997,7 +4997,7 @@ static void __init wq_numa_init(void)
 	BUG_ON(!tbl);
 
 	for_each_node(node)
-		BUG_ON(!alloc_cpumask_var_node(&tbl[node], GFP_KERNEL,
+		BUG_ON(!zalloc_cpumask_var_node(&tbl[node], GFP_KERNEL,
 				node_online(node) ? node : NUMA_NO_NODE));
 
 	for_each_possible_cpu(cpu) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 109/128] hwmon: (emc2103) Fix return value
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (107 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 108/128] workqueue: zero cpumask of wq_numa_possible_cpumask on init Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:45 ` [PATCH 3.11 110/128] hwmon: (emc2103) Clamp limits instead of bailing out Luis Henriques
                   ` (18 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sachin Kamat, Steve Glendinning, Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sachin Kamat <sachin.kamat@linaro.org>

commit 1a3abbd0b9a16e40fd4718f99896c437a193c0a1 upstream.

kstrtol() returns appropriate error values. Use those instead of
hardcoding. Silences several sparse messages of following type:
"why not propagate 'result' from kstrtol() instead of (-22)?"

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hwmon/emc2103.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
index b07305622087..2c137b26acb4 100644
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -248,7 +248,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da,
 
 	int result = kstrtol(buf, 10, &val);
 	if (result < 0)
-		return -EINVAL;
+		return result;
 
 	val = DIV_ROUND_CLOSEST(val, 1000);
 	if ((val < -63) || (val > 127))
@@ -272,7 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da,
 
 	int result = kstrtol(buf, 10, &val);
 	if (result < 0)
-		return -EINVAL;
+		return result;
 
 	val = DIV_ROUND_CLOSEST(val, 1000);
 	if ((val < -63) || (val > 127))
@@ -320,7 +320,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *da,
 
 	int status = kstrtol(buf, 10, &new_div);
 	if (status < 0)
-		return -EINVAL;
+		return status;
 
 	if (new_div == old_div) /* No change */
 		return count;
@@ -394,7 +394,7 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da,
 
 	int result = kstrtol(buf, 10, &rpm_target);
 	if (result < 0)
-		return -EINVAL;
+		return result;
 
 	/* Datasheet states 16384 as maximum RPM target (table 3.2) */
 	if ((rpm_target < 0) || (rpm_target > 16384))
@@ -440,7 +440,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da,
 
 	int result = kstrtol(buf, 10, &new_value);
 	if (result < 0)
-		return -EINVAL;
+		return result;
 
 	mutex_lock(&data->update_lock);
 	switch (new_value) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 110/128] hwmon: (emc2103) Clamp limits instead of bailing out
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (108 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 109/128] hwmon: (emc2103) Fix return value Luis Henriques
@ 2014-07-24  9:45 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 111/128] arm64: implement TASK_SIZE_OF Luis Henriques
                   ` (17 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Guenter Roeck, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit f6c2dd20108c35e30e2c1f3c6142d189451a626b 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: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hwmon/emc2103.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
index 2c137b26acb4..5790246a7e1d 100644
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -250,9 +250,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da,
 	if (result < 0)
 		return result;
 
-	val = DIV_ROUND_CLOSEST(val, 1000);
-	if ((val < -63) || (val > 127))
-		return -EINVAL;
+	val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127);
 
 	mutex_lock(&data->update_lock);
 	data->temp_min[nr] = val;
@@ -274,9 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da,
 	if (result < 0)
 		return result;
 
-	val = DIV_ROUND_CLOSEST(val, 1000);
-	if ((val < -63) || (val > 127))
-		return -EINVAL;
+	val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127);
 
 	mutex_lock(&data->update_lock);
 	data->temp_max[nr] = val;
@@ -390,15 +386,14 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da,
 {
 	struct emc2103_data *data = emc2103_update_device(dev);
 	struct i2c_client *client = to_i2c_client(dev);
-	long rpm_target;
+	unsigned long rpm_target;
 
-	int result = kstrtol(buf, 10, &rpm_target);
+	int result = kstrtoul(buf, 10, &rpm_target);
 	if (result < 0)
 		return result;
 
 	/* Datasheet states 16384 as maximum RPM target (table 3.2) */
-	if ((rpm_target < 0) || (rpm_target > 16384))
-		return -EINVAL;
+	rpm_target = clamp_val(rpm_target, 0, 16384);
 
 	mutex_lock(&data->update_lock);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 111/128] arm64: implement TASK_SIZE_OF
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (109 preceding siblings ...)
  2014-07-24  9:45 ` [PATCH 3.11 110/128] hwmon: (emc2103) Clamp limits instead of bailing out Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 112/128] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Luis Henriques
                   ` (16 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Colin Cross, Catalin Marinas, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Colin Cross <ccross@android.com>

commit fa2ec3ea10bd377f9d55772b1dab65178425a1a2 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: Colin Cross <ccross@android.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/include/asm/memory.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 20925bcf4e2a..e1134d04e07e 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -51,6 +51,8 @@
 #define TASK_SIZE_32		UL(0x100000000)
 #define TASK_SIZE		(test_thread_flag(TIF_32BIT) ? \
 				TASK_SIZE_32 : TASK_SIZE_64)
+#define TASK_SIZE_OF(tsk)	(test_tsk_thread_flag(tsk, TIF_32BIT) ? \
+				TASK_SIZE_32 : TASK_SIZE_64)
 #else
 #define TASK_SIZE		TASK_SIZE_64
 #endif /* CONFIG_COMPAT */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 112/128] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (110 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 111/128] arm64: implement TASK_SIZE_OF Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-25 11:13   ` [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch Jan Kardell
  2014-07-24  9:46 ` [PATCH 3.11 113/128] cpufreq: Makefile: fix compilation for davinci platform Luis Henriques
                   ` (15 subsequent siblings)
  127 siblings, 1 reply; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kardell, Jonathan Cameron, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kardell <jan.kardell@telliq.com>

commit baa3c65298c089a9014b4e523a14ec2885cca1bc 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: Jan Kardell <jan.kardell@telliq.com>
Tested-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 3ceac3e91dde..9dd72d05abc3 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -155,7 +155,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
 		if (time_after(jiffies, timeout))
 			return -EAGAIN;
 		}
-	map_val = chan->channel + TOTAL_CHANNELS;
+	map_val = adc_dev->channel_step[chan->scan_index];
 
 	/*
 	 * When the sub-system is first enabled,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 113/128] cpufreq: Makefile: fix compilation for davinci platform
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (111 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 112/128] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 114/128] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code Luis Henriques
                   ` (14 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lad, Prabhakar, Rafael J. Wysocki, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Prabhakar Lad <prabhakar.csengg@gmail.com>

commit 5a90af67c2126fe1d04ebccc1f8177e6ca70d3a9 upstream.

Since commtit 8a7b1227e303 (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: 8a7b1227e303 (cpufreq: davinci: move cpufreq driver to drivers/cpufreq)
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/cpufreq/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index d345b5a7aa71..5a782e35c2e9 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -50,7 +50,7 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ)	+= arm_big_little.o
 # LITTLE drivers, so that it is probed last.
 obj-$(CONFIG_ARM_DT_BL_CPUFREQ)		+= arm_big_little_dt.o
 
-obj-$(CONFIG_ARCH_DAVINCI_DA850)	+= davinci-cpufreq.o
+obj-$(CONFIG_ARCH_DAVINCI)		+= davinci-cpufreq.o
 obj-$(CONFIG_UX500_SOC_DB8500)		+= dbx500-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS_CPUFREQ)	+= exynos-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ)	+= exynos4210-cpufreq.o
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 114/128] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (112 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 113/128] cpufreq: Makefile: fix compilation for davinci platform Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 115/128] USB: ftdi_sio: Add extra PID Luis Henriques
                   ` (13 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "K. Y. Srinivasan" <kys@microsoft.com>

commit affb1aff300ddee54df307812b38f166e8a865ef upstream.

Starting with Win8, we have implemented several optimizations to improve the
scalability and performance of the VMBUS transport between the Host and the
Guest. Some of the non-performance critical services cannot leverage these
optimization since they only read and process one message at a time.
Make adjustments to the callback dispatch code to account for the way
non-performance critical drivers handle reading of the channel.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hv/connection.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 8e8522d85509..f4ebce7a897e 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -317,9 +317,13 @@ static void process_chn_event(u32 relid)
 		 */
 
 		do {
-			hv_begin_read(&channel->inbound);
+			if (read_state)
+				hv_begin_read(&channel->inbound);
 			channel->onchannel_callback(arg);
-			bytes_to_read = hv_end_read(&channel->inbound);
+			if (read_state)
+				bytes_to_read = hv_end_read(&channel->inbound);
+			else
+				bytes_to_read = 0;
 		} while (read_state && (bytes_to_read != 0));
 	} else {
 		pr_err("no channel callback for relid - %u\n", relid);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 115/128] USB: ftdi_sio: Add extra PID.
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (113 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 114/128] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 116/128] dm io: fix a race condition in the wake up code for sync_io Luis Henriques
                   ` (12 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bert Vermeulen, Johan Hovold, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bert Vermeulen <bert@biot.com>

commit 5a7fbe7e9ea0b1b9d7ffdba64db1faa3a259164c 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: Bert Vermeulen <bert@biot.com>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     | 3 ++-
 drivers/usb/serial/ftdi_sio_ids.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 3e315de9bbd4..3ff453947e41 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -723,7 +723,8 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
-	{ USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) },
+	{ USB_DEVICE(TESTO_VID, TESTO_1_PID) },
+	{ USB_DEVICE(TESTO_VID, TESTO_3_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 500474c48f4b..106cc16cc6ed 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -798,7 +798,8 @@
  * Submitted by Colin Leroy
  */
 #define TESTO_VID			0x128D
-#define TESTO_USB_INTERFACE_PID		0x0001
+#define TESTO_1_PID			0x0001
+#define TESTO_3_PID			0x0003
 
 /*
  * Mobility Electronics products.
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 116/128] dm io: fix a race condition in the wake up code for sync_io
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (114 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 115/128] USB: ftdi_sio: Add extra PID Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 117/128] drm/radeon: fix typo in golden register setup on evergreen Luis Henriques
                   ` (11 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joe Thornber, Mike Snitzer, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Joe Thornber <thornber@redhat.com>

commit 10f1d5d111e8aed46a0f1179faf9a3cf422f689e upstream.

There's a race condition between the atomic_dec_and_test(&io->count)
in dec_count() and the waking of the sync_io() thread.  If the thread
is spuriously woken immediately after the decrement it may exit,
making the on stack io struct invalid, yet the dec_count could still
be using it.

Fix this race by using a completion in sync_io() and dec_count().

Reported-by: Minfei Huang <huangminfei@ucloud.cn>
Signed-off-by: Joe Thornber <thornber@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-io.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index ea49834377c8..d1de1626a9d2 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -10,6 +10,7 @@
 #include <linux/device-mapper.h>
 
 #include <linux/bio.h>
+#include <linux/completion.h>
 #include <linux/mempool.h>
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -34,7 +35,7 @@ struct dm_io_client {
 struct io {
 	unsigned long error_bits;
 	atomic_t count;
-	struct task_struct *sleeper;
+	struct completion *wait;
 	struct dm_io_client *client;
 	io_notify_fn callback;
 	void *context;
@@ -122,8 +123,8 @@ static void dec_count(struct io *io, unsigned int region, int error)
 			invalidate_kernel_vmap_range(io->vma_invalidate_address,
 						     io->vma_invalidate_size);
 
-		if (io->sleeper)
-			wake_up_process(io->sleeper);
+		if (io->wait)
+			complete(io->wait);
 
 		else {
 			unsigned long r = io->error_bits;
@@ -386,6 +387,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions,
 	 */
 	volatile char io_[sizeof(struct io) + __alignof__(struct io) - 1];
 	struct io *io = (struct io *)PTR_ALIGN(&io_, __alignof__(struct io));
+	DECLARE_COMPLETION_ONSTACK(wait);
 
 	if (num_regions > 1 && (rw & RW_MASK) != WRITE) {
 		WARN_ON(1);
@@ -394,7 +396,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions,
 
 	io->error_bits = 0;
 	atomic_set(&io->count, 1); /* see dispatch_io() */
-	io->sleeper = current;
+	io->wait = &wait;
 	io->client = client;
 
 	io->vma_invalidate_address = dp->vma_invalidate_address;
@@ -402,15 +404,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions,
 
 	dispatch_io(rw, num_regions, where, dp, io, 1);
 
-	while (1) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-
-		if (!atomic_read(&io->count))
-			break;
-
-		io_schedule();
-	}
-	set_current_state(TASK_RUNNING);
+	wait_for_completion_io(&wait);
 
 	if (error_bits)
 		*error_bits = io->error_bits;
@@ -433,7 +427,7 @@ static int async_io(struct dm_io_client *client, unsigned int num_regions,
 	io = mempool_alloc(client->pool, GFP_NOIO);
 	io->error_bits = 0;
 	atomic_set(&io->count, 1); /* see dispatch_io() */
-	io->sleeper = NULL;
+	io->wait = NULL;
 	io->client = client;
 	io->callback = fn;
 	io->context = context;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 117/128] drm/radeon: fix typo in golden register setup on evergreen
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (115 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 116/128] dm io: fix a race condition in the wake up code for sync_io Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 118/128] drm/radeon/dpm: Reenabling SS on Cayman Luis Henriques
                   ` (10 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 6abafb78f9881b4891baf74ab4e9f090ae45230e upstream.

Fixes hangs on driver load on some cards.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=76998

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/evergreen.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index f5eb157f69cd..a34e20921711 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -183,7 +183,7 @@ static const u32 evergreen_golden_registers[] =
 	0x8c1c, 0xffffffff, 0x00001010,
 	0x28350, 0xffffffff, 0x00000000,
 	0xa008, 0xffffffff, 0x00010000,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x9508, 0xffffffff, 0x00000002,
 	0x913c, 0x0000000f, 0x0000000a
 };
@@ -470,7 +470,7 @@ static const u32 cedar_golden_registers[] =
 	0x8c1c, 0xffffffff, 0x00001010,
 	0x28350, 0xffffffff, 0x00000000,
 	0xa008, 0xffffffff, 0x00010000,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x9508, 0xffffffff, 0x00000002
 };
 
@@ -629,7 +629,7 @@ static const u32 juniper_mgcg_init[] =
 static const u32 supersumo_golden_registers[] =
 {
 	0x5eb4, 0xffffffff, 0x00000002,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x7030, 0xffffffff, 0x00000011,
 	0x7c30, 0xffffffff, 0x00000011,
 	0x6104, 0x01000300, 0x00000000,
@@ -713,7 +713,7 @@ static const u32 sumo_golden_registers[] =
 static const u32 wrestler_golden_registers[] =
 {
 	0x5eb4, 0xffffffff, 0x00000002,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x7030, 0xffffffff, 0x00000011,
 	0x7c30, 0xffffffff, 0x00000011,
 	0x6104, 0x01000300, 0x00000000,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 118/128] drm/radeon/dpm: Reenabling SS on Cayman
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (116 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 117/128] drm/radeon: fix typo in golden register setup on evergreen Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 119/128] powerpc/perf: Add PPMU_ARCH_207S define Luis Henriques
                   ` (9 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexandre Demers, Alex Deucher, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexandre Demers <alexandre.f.demers@gmail.com>

commit 41959341ac7e33dd360c7a881d13566f9eca37b2 upstream.

It reverts commit c745fe611ca42295c9d91d8e305d27983e9132ef now that
Cayman is stable since VDDCI fix. Spread spectrum was not the culprit.

This depends on b0880e87c1fd038b84498944f52e52c3e86ebe59
(drm/radeon/dpm: fix vddci setup typo on cayman).

Signed-off-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/rv770_dpm.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index a923ba966a78..a4c4f25c93e6 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -2333,12 +2333,6 @@ void rv770_get_engine_memory_ss(struct radeon_device *rdev)
 	pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss,
 						       ASIC_INTERNAL_MEMORY_SS, 0);
 
-	/* disable ss, causes hangs on some cayman boards */
-	if (rdev->family == CHIP_CAYMAN) {
-		pi->sclk_ss = false;
-		pi->mclk_ss = false;
-	}
-
 	if (pi->sclk_ss || pi->mclk_ss)
 		pi->dynamic_ss = true;
 	else
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 119/128] powerpc/perf: Add PPMU_ARCH_207S define
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (117 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 118/128] drm/radeon/dpm: Reenabling SS on Cayman Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 120/128] powerpc/perf: Clear MMCR2 when enabling PMU Luis Henriques
                   ` (8 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joel Stanley, Benjamin Herrenschmidt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Joel Stanley <joel@jms.id.au>

commit 4d9690dd56b0d18f2af8a9d4a279cb205aae3345 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: Joel Stanley <joel@jms.id.au>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[ luis: backported to 3.11:
  - dropped changes to function perf_event_print_debug() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/include/asm/perf_event_server.h | 3 +--
 arch/powerpc/perf/core-book3s.c              | 4 ++--
 arch/powerpc/perf/power8-pmu.c               | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index 8b2492644754..10d37ae9ab5b 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -60,8 +60,7 @@ struct power_pmu {
 #define PPMU_SIAR_VALID		0x00000010 /* Processor has SIAR Valid bit */
 #define PPMU_HAS_SSLOT		0x00000020 /* Has sampled slot in MMCRA */
 #define PPMU_HAS_SIER		0x00000040 /* Has SIER */
-#define PPMU_BHRB		0x00000080 /* has BHRB feature enabled */
-#define PPMU_EBB		0x00000100 /* supports event based branch */
+#define PPMU_ARCH_207S		0x00000080 /* PMC is architecture v2.07S */
 
 /*
  * Values for flags to get_alternatives()
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index eeae308cf982..fb91ed0db590 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -483,7 +483,7 @@ static bool is_ebb_event(struct perf_event *event)
 	 * check that the PMU supports EBB, meaning those that don't can still
 	 * use bit 63 of the event code for something else if they wish.
 	 */
-	return (ppmu->flags & PPMU_EBB) &&
+	return (ppmu->flags & PPMU_ARCH_207S) &&
 	       ((event->attr.config >> PERF_EVENT_CONFIG_EBB_SHIFT) & 1);
 }
 
@@ -1547,7 +1547,7 @@ static int power_pmu_event_init(struct perf_event *event)
 
 	if (has_branch_stack(event)) {
 	        /* PMU has BHRB enabled */
-		if (!(ppmu->flags & PPMU_BHRB))
+		if (!(ppmu->flags & PPMU_ARCH_207S))
 			return -EOPNOTSUPP;
 	}
 
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index a3f7abd2f13f..79b7e200c0e7 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -608,7 +608,7 @@ static struct power_pmu power8_pmu = {
 	.get_constraint		= power8_get_constraint,
 	.get_alternatives	= power8_get_alternatives,
 	.disable_pmc		= power8_disable_pmc,
-	.flags			= PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB,
+	.flags			= PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_ARCH_207S,
 	.n_generic		= ARRAY_SIZE(power8_generic_events),
 	.generic_events		= power8_generic_events,
 	.attr_groups		= power8_pmu_attr_groups,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 120/128] powerpc/perf: Clear MMCR2 when enabling PMU
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (118 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 119/128] powerpc/perf: Add PPMU_ARCH_207S define Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 121/128] powerpc/perf: Never program book3s PMCs with values >= 0x80000000 Luis Henriques
                   ` (7 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joel Stanley, Benjamin Herrenschmidt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Joel Stanley <joel@jms.id.au>

commit b50a6c584bb47b370f84bfd746770c0bbe7129b7 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: e05b9b9e5c10 ("powerpc/perf: Power8 PMU support")
Signed-off-by: Joel Stanley <joel@jms.id.au>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/perf/core-book3s.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index fb91ed0db590..8b9b9ac6005d 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1149,6 +1149,9 @@ static void power_pmu_enable(struct pmu *pmu)
 	mb();
 	write_mmcr0(cpuhw, mmcr0);
 
+	if (ppmu->flags & PPMU_ARCH_207S)
+		mtspr(SPRN_MMCR2, 0);
+
 	/*
 	 * Enable instruction sampling if necessary
 	 */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 121/128] powerpc/perf: Never program book3s PMCs with values >= 0x80000000
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (119 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 120/128] powerpc/perf: Clear MMCR2 when enabling PMU Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 122/128] USB: serial: ftdi_sio: Add Infineon Triboard Luis Henriques
                   ` (6 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Anton Blanchard, Benjamin Herrenschmidt, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Anton Blanchard <anton@samba.org>

commit f56029410a13cae3652d1f34788045c40a13ffc7 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: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/perf/core-book3s.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 8b9b9ac6005d..c05f10e95a9e 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -851,7 +851,22 @@ static void power_pmu_read(struct perf_event *event)
 	} while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
 
 	local64_add(delta, &event->count);
-	local64_sub(delta, &event->hw.period_left);
+
+	/*
+	 * A number of places program the PMC with (0x80000000 - period_left).
+	 * We never want period_left to be less than 1 because we will program
+	 * the PMC with a value >= 0x800000000 and an edge detected PMC will
+	 * roll around to 0 before taking an exception. We have seen this
+	 * on POWER8.
+	 *
+	 * To fix this, clamp the minimum value of period_left to 1.
+	 */
+	do {
+		prev = local64_read(&event->hw.period_left);
+		val = prev - delta;
+		if (val < 1)
+			val = 1;
+	} while (local64_cmpxchg(&event->hw.period_left, prev, val) != prev);
 }
 
 /*
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 122/128] USB: serial: ftdi_sio: Add Infineon Triboard
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (120 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 121/128] powerpc/perf: Never program book3s PMCs with values >= 0x80000000 Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 123/128] clk: spear3xx: Use proper control register offset Luis Henriques
                   ` (5 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Sojka, Johan Hovold, Greg Kroah-Hartman, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michal Sojka <sojkam1@fel.cvut.cz>

commit d8279a40e50ad55539780aa617a32a53d7f0953e upstream.

This adds support for Infineon TriBoard TC1798 [1]. Only interface 1
is used as serial line (see [2], Figure 8-6).

[1] http://www.infineon.com/cms/de/product/microcontroller/development-tools-software-and-kits/tricore-tm-development-tools-software-and-kits/starterkits-and-evaluation-boards/starter-kit-tc1798/channel.html?channel=db3a304333b8a7ca0133cfa3d73e4268
[2] http://www.infineon.com/dgdl/TriBoardManual-TC1798-V10.pdf?folderId=db3a304412b407950112b409ae7c0343&fileId=db3a304333b8a7ca0133cfae99fe426a

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     | 2 ++
 drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 3ff453947e41..9e75e3eaea4f 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -948,6 +948,8 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) },
 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) },
 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },
+	/* Infineon Devices */
+	{ USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
 	{ },					/* Optional parameter entry */
 	{ }					/* Terminating entry */
 };
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 106cc16cc6ed..c4777bc6aee0 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -584,6 +584,12 @@
 #define RATOC_PRODUCT_ID_USB60F	0xb020
 
 /*
+ * Infineon Technologies
+ */
+#define INFINEON_VID		0x058b
+#define INFINEON_TRIBOARD_PID	0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */
+
+/*
  * Acton Research Corp.
  */
 #define ACTON_VID		0x0647	/* Vendor ID */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 123/128] clk: spear3xx: Use proper control register offset
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (121 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 122/128] USB: serial: ftdi_sio: Add Infineon Triboard Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 124/128] x86, ioremap: Speed up check for RAM pages Luis Henriques
                   ` (4 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Gleixner, Mike Turquette, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit 15ebb05248d025534773c9ef64915bd888f04e4b upstream.

The control register is at offset 0x10, not 0x0. This is wreckaged
since commit 5df33a62c (SPEAr: Switch to common clock framework).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clk/spear/spear3xx_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c
index 080c3c5e33f6..1fe259021747 100644
--- a/drivers/clk/spear/spear3xx_clock.c
+++ b/drivers/clk/spear/spear3xx_clock.c
@@ -211,7 +211,7 @@ static inline void spear310_clk_init(void) { }
 /* array of all spear 320 clock lookups */
 #ifdef CONFIG_MACH_SPEAR320
 
-#define SPEAR320_CONTROL_REG		(soc_config_base + 0x0000)
+#define SPEAR320_CONTROL_REG		(soc_config_base + 0x0010)
 #define SPEAR320_EXT_CTRL_REG		(soc_config_base + 0x0018)
 
 	#define SPEAR320_UARTX_PCLK_MASK		0x1
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 124/128] x86, ioremap: Speed up check for RAM pages
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (122 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 123/128] clk: spear3xx: Use proper control register offset Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 125/128] rbd: use reference counts for image requests Luis Henriques
                   ` (3 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roland Dreier, H. Peter Anvin, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Roland Dreier <roland@purestorage.com>

commit c81c8a1eeede61e92a15103748c23d100880cc8a upstream.

In __ioremap_caller() (the guts of ioremap), we loop over the range of
pfns being remapped and checks each one individually with page_is_ram().
For large ioremaps, this can be very slow.  For example, we have a
device with a 256 GiB PCI BAR, and ioremapping this BAR can take 20+
seconds -- sometimes long enough to trigger the soft lockup detector!

Internally, page_is_ram() calls walk_system_ram_range() on a single
page.  Instead, we can make a single call to walk_system_ram_range()
from __ioremap_caller(), and do our further checks only for any RAM
pages that we find.  For the common case of MMIO, this saves an enormous
amount of work, since the range being ioremapped doesn't intersect
system RAM at all.

With this change, ioremap on our 256 GiB BAR takes less than 1 second.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Link: http://lkml.kernel.org/r/1399054721-1331-1-git-send-email-roland@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/mm/ioremap.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 0215e2c563ef..6c0262a44524 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -50,6 +50,21 @@ int ioremap_change_attr(unsigned long vaddr, unsigned long size,
 	return err;
 }
 
+static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
+			       void *arg)
+{
+	unsigned long i;
+
+	for (i = 0; i < nr_pages; ++i)
+		if (pfn_valid(start_pfn + i) &&
+		    !PageReserved(pfn_to_page(start_pfn + i)))
+			return 1;
+
+	WARN_ONCE(1, "ioremap on RAM pfn 0x%lx\n", start_pfn);
+
+	return 0;
+}
+
 /*
  * Remap an arbitrary physical address space into the kernel virtual
  * address space. Needed when the kernel wants to access high addresses
@@ -93,14 +108,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
 	/*
 	 * Don't allow anybody to remap normal RAM that we're using..
 	 */
+	pfn      = phys_addr >> PAGE_SHIFT;
 	last_pfn = last_addr >> PAGE_SHIFT;
-	for (pfn = phys_addr >> PAGE_SHIFT; pfn <= last_pfn; pfn++) {
-		int is_ram = page_is_ram(pfn);
-
-		if (is_ram && pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn)))
-			return NULL;
-		WARN_ON_ONCE(is_ram);
-	}
+	if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
+				  __ioremap_check_ram) == 1)
+		return NULL;
 
 	/*
 	 * Mappings have to be page-aligned
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 125/128] rbd: use reference counts for image requests
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (123 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 124/128] x86, ioremap: Speed up check for RAM pages Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 126/128] Don't trigger congestion wait on dirty-but-not-writeout pages Luis Henriques
                   ` (2 subsequent siblings)
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Elder, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Elder <elder@linaro.org>

commit 0f2d5be792b0466b06797f637cfbb0f64dbb408c upstream.

Each image request contains a reference count, but to date it has
not actually been used.  (I think this was just an oversight.) A
recent report involving rbd failing an assertion shed light on why
and where we need to use these reference counts.

Every OSD request associated with an object request uses
rbd_osd_req_callback() as its callback function.  That function will
call a helper function (dependent on the type of OSD request) that
will set the object request's "done" flag if the object request if
appropriate.  If that "done" flag is set, the object request is
passed to rbd_obj_request_complete().

In rbd_obj_request_complete(), requests are processed in sequential
order.  So if an object request completes before one of its
predecessors in the image request, the completion is deferred.
Otherwise, if it's a completing object's "turn" to be completed, it
is passed to rbd_img_obj_end_request(), which records the result of
the operation, accumulates transferred bytes, and so on.  Next, the
successor to this request is checked and if it is marked "done",
(deferred) completion processing is performed on that request, and
so on.  If the last object request in an image request is completed,
rbd_img_request_complete() is called, which (typically) destroys
the image request.

There is a race here, however.  The instant an object request is
marked "done" it can be provided (by a thread handling completion of
one of its predecessor operations) to rbd_img_obj_end_request(),
which (for the last request) can then lead to the image request
getting torn down.  And this can happen *before* that object has
itself entered rbd_img_obj_end_request().  As a result, once it
*does* enter that function, the image request (and even the object
request itself) may have been freed and become invalid.

All that's necessary to avoid this is to properly count references
to the image requests.  We tear down an image request's object
requests all at once--only when the entire image request has
completed.  So there's no need for an image request to count
references for its object requests.  However, we don't want an
image request to go away until the last of its object requests
has passed through rbd_img_obj_callback().  In other words,
we don't want rbd_img_request_complete() to necessarily
result in the image request being destroyed, because it may
get called before we've finished processing on all of its
object requests.

So the fix is to add a reference to an image request for
each of its object requests.  The reference can be viewed
as representing an object request that has not yet finished
its call to rbd_img_obj_callback().  That is emphasized by
getting the reference right after assigning that as the image
object's callback function.  The corresponding release of that
reference is done at the end of rbd_img_obj_callback(), which
every image object request passes through exactly once.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/block/rbd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index cabe12e8390b..9568cacdd6a4 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1399,6 +1399,13 @@ static void rbd_obj_request_put(struct rbd_obj_request *obj_request)
 	kref_put(&obj_request->kref, rbd_obj_request_destroy);
 }
 
+static void rbd_img_request_get(struct rbd_img_request *img_request)
+{
+	dout("%s: img %p (was %d)\n", __func__, img_request,
+	     atomic_read(&img_request->kref.refcount));
+	kref_get(&img_request->kref);
+}
+
 static bool img_request_child_test(struct rbd_img_request *img_request);
 static void rbd_parent_request_destroy(struct kref *kref);
 static void rbd_img_request_destroy(struct kref *kref);
@@ -2152,6 +2159,7 @@ static void rbd_img_obj_callback(struct rbd_obj_request *obj_request)
 	img_request->next_completion = which;
 out:
 	spin_unlock_irq(&img_request->completion_lock);
+	rbd_img_request_put(img_request);
 
 	if (!more)
 		rbd_img_request_complete(img_request);
@@ -2248,6 +2256,7 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
 			goto out_partial;
 		obj_request->osd_req = osd_req;
 		obj_request->callback = rbd_img_obj_callback;
+		rbd_img_request_get(img_request);
 
 		osd_req_op_extent_init(osd_req, 0, opcode, offset, length,
 						0, 0);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 126/128] Don't trigger congestion wait on dirty-but-not-writeout pages
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (124 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 125/128] rbd: use reference counts for image requests Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 127/128] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 128/128] mm: hugetlb: fix copy_hugetlb_page_range() Luis Henriques
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Hocko, Andrew Morton, Mel Gorman, Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Linus Torvalds <torvalds@linux-foundation.org>

commit b738d764652dc5aab1c8939f637112981fce9e0e upstream.

shrink_inactive_list() used to wait 0.1s to avoid congestion when all
the pages that were isolated from the inactive list were dirty but not
under active writeback.  That makes no real sense, and apparently causes
major interactivity issues under some loads since 3.11.

The ostensible reason for it was to wait for kswapd to start writing
pages, but that seems questionable as well, since the congestion wait
code seems to trigger for kswapd itself as well.  Also, the logic behind
delaying anything when we haven't actually started writeback is not
clear - it only delays actually starting that writeback.

We'll still trigger the congestion waiting if

 (a) the process is kswapd, and we hit pages flagged for immediate
     reclaim

 (b) the process is not kswapd, and the zone backing dev writeback is
     actually congested.

This probably needs to be revisited, but as it is this fixes a reported
regression.

[mhocko@suse.cz: backport to 3.12 stable tree]
Fixes: e2be15f6c3ee ('mm: vmscan: stall page reclaim and writeback pages based on dirty/writepage pages encountered')
Reported-by: Felipe Contreras <felipe.contreras@gmail.com>
Pinpointed-by: Hillf Danton <dhillf@gmail.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/vmscan.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index b4241b7d7f07..370c16d21fb2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1468,19 +1468,18 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
 		 * If dirty pages are scanned that are not queued for IO, it
 		 * implies that flushers are not keeping up. In this case, flag
 		 * the zone ZONE_TAIL_LRU_DIRTY and kswapd will start writing
-		 * pages from reclaim context. It will forcibly stall in the
-		 * next check.
+		 * pages from reclaim context.
 		 */
 		if (nr_unqueued_dirty == nr_taken)
 			zone_set_flag(zone, ZONE_TAIL_LRU_DIRTY);
 
 		/*
-		 * In addition, if kswapd scans pages marked marked for
-		 * immediate reclaim and under writeback (nr_immediate), it
-		 * implies that pages are cycling through the LRU faster than
+		 * If kswapd scans pages marked marked for immediate
+		 * reclaim and under writeback (nr_immediate), it implies
+		 * that pages are cycling through the LRU faster than
 		 * they are written so also forcibly stall.
 		 */
-		if (nr_unqueued_dirty == nr_taken || nr_immediate)
+		if (nr_immediate)
 			congestion_wait(BLK_RW_ASYNC, HZ/10);
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 127/128] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (125 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 126/128] Don't trigger congestion wait on dirty-but-not-writeout pages Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  2014-07-24  9:46 ` [PATCH 3.11 128/128] mm: hugetlb: fix copy_hugetlb_page_range() Luis Henriques
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, Christoph Lameter, Andrew Morton,
	Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit 4a705fef986231a3e7a6b1a6d3c37025f021f49f upstream.

There's a race between fork() and hugepage migration, as a result we try
to "dereference" a swap entry as a normal pte, causing kernel panic.
The cause of the problem is that copy_hugetlb_page_range() can't handle
"swap entry" family (migration entry and hwpoisoned entry) so let's fix
it.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ luis: backported to 3.11: based on hughd's backport to 3.10.48 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/hugetlb.c | 71 ++++++++++++++++++++++++++++++++++++------------------------
 1 file changed, 43 insertions(+), 28 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f8e292add228..16c25a39939f 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2321,6 +2321,31 @@ static void set_huge_ptep_writable(struct vm_area_struct *vma,
 		update_mmu_cache(vma, address, ptep);
 }
 
+static int is_hugetlb_entry_migration(pte_t pte)
+{
+	swp_entry_t swp;
+
+	if (huge_pte_none(pte) || pte_present(pte))
+		return 0;
+	swp = pte_to_swp_entry(pte);
+	if (non_swap_entry(swp) && is_migration_entry(swp))
+		return 1;
+	else
+		return 0;
+}
+
+static int is_hugetlb_entry_hwpoisoned(pte_t pte)
+{
+	swp_entry_t swp;
+
+	if (huge_pte_none(pte) || pte_present(pte))
+		return 0;
+	swp = pte_to_swp_entry(pte);
+	if (non_swap_entry(swp) && is_hwpoison_entry(swp))
+		return 1;
+	else
+		return 0;
+}
 
 int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 			    struct vm_area_struct *vma)
@@ -2348,10 +2373,26 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 
 		spin_lock(&dst->page_table_lock);
 		spin_lock_nested(&src->page_table_lock, SINGLE_DEPTH_NESTING);
-		if (!huge_pte_none(huge_ptep_get(src_pte))) {
+		entry = huge_ptep_get(src_pte);
+		if (huge_pte_none(entry)) { /* skip none entry */
+			;
+		} else if (unlikely(is_hugetlb_entry_migration(entry) ||
+				    is_hugetlb_entry_hwpoisoned(entry))) {
+			swp_entry_t swp_entry = pte_to_swp_entry(entry);
+
+			if (is_write_migration_entry(swp_entry) && cow) {
+				/*
+				 * COW mappings require pages in both
+				 * parent and child to be set to read.
+				 */
+				make_migration_entry_read(&swp_entry);
+				entry = swp_entry_to_pte(swp_entry);
+				set_huge_pte_at(src, addr, src_pte, entry);
+			}
+			set_huge_pte_at(dst, addr, dst_pte, entry);
+		} else {
 			if (cow)
 				huge_ptep_set_wrprotect(src, addr, src_pte);
-			entry = huge_ptep_get(src_pte);
 			ptepage = pte_page(entry);
 			get_page(ptepage);
 			page_dup_rmap(ptepage);
@@ -2366,32 +2407,6 @@ nomem:
 	return -ENOMEM;
 }
 
-static int is_hugetlb_entry_migration(pte_t pte)
-{
-	swp_entry_t swp;
-
-	if (huge_pte_none(pte) || pte_present(pte))
-		return 0;
-	swp = pte_to_swp_entry(pte);
-	if (non_swap_entry(swp) && is_migration_entry(swp))
-		return 1;
-	else
-		return 0;
-}
-
-static int is_hugetlb_entry_hwpoisoned(pte_t pte)
-{
-	swp_entry_t swp;
-
-	if (huge_pte_none(pte) || pte_present(pte))
-		return 0;
-	swp = pte_to_swp_entry(pte);
-	if (non_swap_entry(swp) && is_hwpoison_entry(swp))
-		return 1;
-	else
-		return 0;
-}
-
 void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
 			    unsigned long start, unsigned long end,
 			    struct page *ref_page)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH 3.11 128/128] mm: hugetlb: fix copy_hugetlb_page_range()
  2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
                   ` (126 preceding siblings ...)
  2014-07-24  9:46 ` [PATCH 3.11 127/128] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Luis Henriques
@ 2014-07-24  9:46 ` Luis Henriques
  127 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-24  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, Andrew Morton, Linus Torvalds, Luis Henriques

3.11.10.14 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit 0253d634e0803a8376a0d88efee0bf523d8673f9 upstream.

Commit 4a705fef9862 ("hugetlb: fix copy_hugetlb_page_range() to handle
migration/hwpoisoned entry") changed the order of
huge_ptep_set_wrprotect() and huge_ptep_get(), which leads to breakage
in some workloads like hugepage-backed heap allocation via libhugetlbfs.
This patch fixes it.

The test program for the problem is shown below:

  $ cat heap.c
  #include <unistd.h>
  #include <stdlib.h>
  #include <string.h>

  #define HPS 0x200000

  int main() {
  	int i;
  	char *p = malloc(HPS);
  	memset(p, '1', HPS);
  	for (i = 0; i < 5; i++) {
  		if (!fork()) {
  			memset(p, '2', HPS);
  			p = malloc(HPS);
  			memset(p, '3', HPS);
  			free(p);
  			return 0;
  		}
  	}
  	sleep(1);
  	free(p);
  	return 0;
  }

  $ export HUGETLB_MORECORE=yes ; export HUGETLB_NO_PREFAULT= ; hugectl --heap ./heap

Fixes 4a705fef9862 ("hugetlb: fix copy_hugetlb_page_range() to handle
migration/hwpoisoned entry"), so is applicable to -stable kernels which
include it.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reported-by: Guillaume Morin <guillaume@morinfr.org>
Suggested-by: Guillaume Morin <guillaume@morinfr.org>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/hugetlb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 16c25a39939f..7c574fb35df3 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2393,6 +2393,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 		} else {
 			if (cow)
 				huge_ptep_set_wrprotect(src, addr, src_pte);
+			entry = huge_ptep_get(src_pte);
 			ptepage = pte_page(entry);
 			get_page(ptepage);
 			page_dup_rmap(ptepage);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch
  2014-07-24  9:46 ` [PATCH 3.11 112/128] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Luis Henriques
@ 2014-07-25 11:13   ` Jan Kardell
  2014-07-28 10:05       ` Luis Henriques
  0 siblings, 1 reply; 134+ messages in thread
From: Jan Kardell @ 2014-07-25 11:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jonathan Cameron, Luis Henriques, Jiri Slaby, Jan Kardell

Kernel series 3.11 and 3.12 does not initialize scan_index in the
iio_chan_spec structure as 3.13 and newer does. This is necessary
for the stepid patch to work, otherwise it even breaks the cases
that worked before the stepid patch.

Unfortunately the stepid patch seems to already be in 3.12.25,
must have missed that inclusion.

Signed-off-by: Jan Kardell <jan.kardell@telliq.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 3ceac3e..6c56418 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -120,6 +120,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
 		chan->channel = adc_dev->channel_line[i];
 		chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
 		chan->datasheet_name = chan_name_ain[chan->channel];
+		chan->scan_index = i;
 		chan->scan_type.sign = 'u';
 		chan->scan_type.realbits = 12;
 		chan->scan_type.storagebits = 32;
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 134+ messages in thread

* Re: [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch
  2014-07-25 11:13   ` [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch Jan Kardell
@ 2014-07-28 10:05       ` Luis Henriques
  0 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-28 10:05 UTC (permalink / raw)
  To: Jan Kardell
  Cc: linux-kernel, stable, kernel-team, Jonathan Cameron, Jiri Slaby

On Fri, Jul 25, 2014 at 01:13:46PM +0200, Jan Kardell wrote:
> Kernel series 3.11 and 3.12 does not initialize scan_index in the
> iio_chan_spec structure as 3.13 and newer does. This is necessary
> for the stepid patch to work, otherwise it even breaks the cases
> that worked before the stepid patch.
> 
> Unfortunately the stepid patch seems to already be in 3.12.25,
> must have missed that inclusion.
> 
> Signed-off-by: Jan Kardell <jan.kardell@telliq.com>
> ---
>  drivers/iio/adc/ti_am335x_adc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index 3ceac3e..6c56418 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -120,6 +120,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
>  		chan->channel = adc_dev->channel_line[i];
>  		chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
>  		chan->datasheet_name = chan_name_ain[chan->channel];
> +		chan->scan_index = i;
>  		chan->scan_type.sign = 'u';
>  		chan->scan_type.realbits = 12;
>  		chan->scan_type.storagebits = 32;
> -- 
> 1.8.4.5
> 

Ah, nice catch!

Ideally, I would pick commit ca9a563805f7ae821e3303b1bdbc65d3a3c783ff
("iio: ti_am335x_adc: Add continuous sampling support"), which adds
this scan_index initialisation.  However, this commit doesn't seem be
suitable for a stable kernel, so I'll add this patch to the 3.11.10.14
queue branch.  Thanks a lot, Jan.

Cheers,
--
Luís

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch
@ 2014-07-28 10:05       ` Luis Henriques
  0 siblings, 0 replies; 134+ messages in thread
From: Luis Henriques @ 2014-07-28 10:05 UTC (permalink / raw)
  To: Jan Kardell
  Cc: linux-kernel, stable, kernel-team, Jonathan Cameron, Jiri Slaby

On Fri, Jul 25, 2014 at 01:13:46PM +0200, Jan Kardell wrote:
> Kernel series 3.11 and 3.12 does not initialize scan_index in the
> iio_chan_spec structure as 3.13 and newer does. This is necessary
> for the stepid patch to work, otherwise it even breaks the cases
> that worked before the stepid patch.
> 
> Unfortunately the stepid patch seems to already be in 3.12.25,
> must have missed that inclusion.
> 
> Signed-off-by: Jan Kardell <jan.kardell@telliq.com>
> ---
>  drivers/iio/adc/ti_am335x_adc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index 3ceac3e..6c56418 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -120,6 +120,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
>  		chan->channel = adc_dev->channel_line[i];
>  		chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
>  		chan->datasheet_name = chan_name_ain[chan->channel];
> +		chan->scan_index = i;
>  		chan->scan_type.sign = 'u';
>  		chan->scan_type.realbits = 12;
>  		chan->scan_type.storagebits = 32;
> -- 
> 1.8.4.5
> 

Ah, nice catch!

Ideally, I would pick commit ca9a563805f7ae821e3303b1bdbc65d3a3c783ff
("iio: ti_am335x_adc: Add continuous sampling support"), which adds
this scan_index initialisation.  However, this commit doesn't seem be
suitable for a stable kernel, so I'll add this patch to the 3.11.10.14
queue branch.  Thanks a lot, Jan.

Cheers,
--
Lu�s

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch
  2014-07-28 10:05       ` Luis Henriques
@ 2014-08-08  8:24         ` Jonathan Cameron
  -1 siblings, 0 replies; 134+ messages in thread
From: Jonathan Cameron @ 2014-08-08  8:24 UTC (permalink / raw)
  To: Luis Henriques, Jan Kardell
  Cc: linux-kernel, stable, kernel-team, Jonathan Cameron, Jiri Slaby

On 28/07/14 11:05, Luis Henriques wrote:
> On Fri, Jul 25, 2014 at 01:13:46PM +0200, Jan Kardell wrote:
>> Kernel series 3.11 and 3.12 does not initialize scan_index in the
>> iio_chan_spec structure as 3.13 and newer does. This is necessary
>> for the stepid patch to work, otherwise it even breaks the cases
>> that worked before the stepid patch.
>>
>> Unfortunately the stepid patch seems to already be in 3.12.25,
>> must have missed that inclusion.
>>
>> Signed-off-by: Jan Kardell <jan.kardell@telliq.com>
>> ---
>>  drivers/iio/adc/ti_am335x_adc.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
>> index 3ceac3e..6c56418 100644
>> --- a/drivers/iio/adc/ti_am335x_adc.c
>> +++ b/drivers/iio/adc/ti_am335x_adc.c
>> @@ -120,6 +120,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
>>  		chan->channel = adc_dev->channel_line[i];
>>  		chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
>>  		chan->datasheet_name = chan_name_ain[chan->channel];
>> +		chan->scan_index = i;
>>  		chan->scan_type.sign = 'u';
>>  		chan->scan_type.realbits = 12;
>>  		chan->scan_type.storagebits = 32;
>> -- 
>> 1.8.4.5
>>
> Ah, nice catch!
>
> Ideally, I would pick commit ca9a563805f7ae821e3303b1bdbc65d3a3c783ff
> ("iio: ti_am335x_adc: Add continuous sampling support"), which adds
> this scan_index initialisation.  However, this commit doesn't seem be
> suitable for a stable kernel, so I'll add this patch to the 3.11.10.14
> queue branch.  Thanks a lot, Jan.
Indeed, thanks for picking this up.
Acked-by: Jonathan Cameron <jic23@kernel.org>
for any other stable trees where it is relevant (won't do any harm on any where
it isn't!)
>
> Cheers,
> --
> Luís


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch
@ 2014-08-08  8:24         ` Jonathan Cameron
  0 siblings, 0 replies; 134+ messages in thread
From: Jonathan Cameron @ 2014-08-08  8:24 UTC (permalink / raw)
  To: Luis Henriques, Jan Kardell
  Cc: linux-kernel, stable, kernel-team, Jonathan Cameron, Jiri Slaby

On 28/07/14 11:05, Luis Henriques wrote:
> On Fri, Jul 25, 2014 at 01:13:46PM +0200, Jan Kardell wrote:
>> Kernel series 3.11 and 3.12 does not initialize scan_index in the
>> iio_chan_spec structure as 3.13 and newer does. This is necessary
>> for the stepid patch to work, otherwise it even breaks the cases
>> that worked before the stepid patch.
>>
>> Unfortunately the stepid patch seems to already be in 3.12.25,
>> must have missed that inclusion.
>>
>> Signed-off-by: Jan Kardell <jan.kardell@telliq.com>
>> ---
>>  drivers/iio/adc/ti_am335x_adc.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
>> index 3ceac3e..6c56418 100644
>> --- a/drivers/iio/adc/ti_am335x_adc.c
>> +++ b/drivers/iio/adc/ti_am335x_adc.c
>> @@ -120,6 +120,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
>>  		chan->channel = adc_dev->channel_line[i];
>>  		chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
>>  		chan->datasheet_name = chan_name_ain[chan->channel];
>> +		chan->scan_index = i;
>>  		chan->scan_type.sign = 'u';
>>  		chan->scan_type.realbits = 12;
>>  		chan->scan_type.storagebits = 32;
>> -- 
>> 1.8.4.5
>>
> Ah, nice catch!
>
> Ideally, I would pick commit ca9a563805f7ae821e3303b1bdbc65d3a3c783ff
> ("iio: ti_am335x_adc: Add continuous sampling support"), which adds
> this scan_index initialisation.  However, this commit doesn't seem be
> suitable for a stable kernel, so I'll add this patch to the 3.11.10.14
> queue branch.  Thanks a lot, Jan.
Indeed, thanks for picking this up.
Acked-by: Jonathan Cameron <jic23@kernel.org>
for any other stable trees where it is relevant (won't do any harm on any where
it isn't!)
>
> Cheers,
> --
> Lu�s


^ permalink raw reply	[flat|nested] 134+ messages in thread

end of thread, other threads:[~2014-08-08  8:24 UTC | newest]

Thread overview: 134+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 001/128] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 002/128] MIPS: KVM: Remove redundant NULL checks before kfree() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 003/128] MIPS: KVM: Fix memory leak on VCPU Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 004/128] btrfs: Add ctime/mtime update for btrfs device add/remove Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 005/128] Btrfs: output warning instead of error when loading free space cache failed Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 006/128] Btrfs: make sure there are not any read requests before stopping workers Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 007/128] Btrfs: fix NULL pointer crash of deleting a seed device Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 008/128] Btrfs: mark mapping with error flag to report errors to userspace Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 009/128] Btrfs: set right total device count for seeding support Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 010/128] Btrfs: send, don't error in the presence of subvols/snapshots Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 011/128] fs: btrfs: volumes.c: Fix for possible null pointer dereference Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 012/128] Btrfs: use right type to get real comparison Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 013/128] Btrfs: fix scrub_print_warning to handle skinny metadata extents Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 014/128] btrfs: fix use of uninit "ret" in end_extent_writepage() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 015/128] Bluetooth: Fix check for connection encryption Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 016/128] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 017/128] Bluetooth: Fix indicating discovery state when canceling inquiry Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 018/128] Bluetooth: Fix locking of hdev when calling into SMP code Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 019/128] Bluetooth: Allow change security level on ATT_CID in slave role Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 020/128] rt2x00: disable TKIP on USB Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 021/128] b43: fix frequency reported on G-PHY with /new/ firmware Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 022/128] rt2x00: fix rfkill regression on rt2500pci Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 023/128] tracing: Fix syscall_*regfunc() vs copy_process() race Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 024/128] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 025/128] rbd: handle parent_overlap on writes correctly Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 026/128] lz4: ensure length does not wrap Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 027/128] mm, pcp: allow restoring percpu_pagelist_fraction default Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 028/128] mm: fix crashes from mbind() merging vmas Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 029/128] [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 030/128] drm: fix NULL pointer access by wrong ioctl Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 031/128] net: allwinner: emac: Add missing free_irq Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 032/128] ALSA: usb-audio: Fix races at disconnection and PCM closing Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 033/128] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 034/128] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 035/128] target: Fix left-over se_lun->lun_sep pointer OOPs Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 036/128] iscsi-target: Explicily clear login response PDU in exception path Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 037/128] efi-pstore: Fix an overflow on 32-bit builds Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 038/128] lz4: fix another possible overrun Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 039/128] iscsi-target: Avoid rejecting incorrect ITT for Data-Out Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 040/128] powerpc: fix typo 'CONFIG_PPC_CPU' Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 041/128] powerpc: fix typo 'CONFIG_PMAC' Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 042/128] PCI: Fix incorrect vgaarb conditional in WARN_ON() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 043/128] ptrace,x86: force IRET path after a ptrace_stop() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 044/128] mei: me: fix hw ready reset flow Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 045/128] tracing: Try again for saved cmdline if failed due to locking Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 046/128] ring-buffer: Check if buffer exists before polling Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 047/128] Score: Implement the function csum_ipv6_magic Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 048/128] Score: The commit is for compiling successfully Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 049/128] Score: Modify the Makefile of Score, remove -mlong-calls for compiling Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 050/128] ext4: Fix buffer double free in ext4_alloc_branch() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 051/128] ARM: OMAP2+: Fix parser-bug in platform muxing code Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 052/128] KVM: x86: Increase the number of fixed MTRR regs to 10 Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 053/128] KVM: x86: preserve the high 32-bits of the PAT register Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 054/128] usb: musb: ux500: don't propagate the OF node Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 055/128] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 056/128] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 057/128] irqchip: spear_shirq: Fix interrupt offset Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 058/128] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 059/128] USB: ftdi_sio: fix null deref at port probe Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 060/128] usb: option: add/modify Olivetti Olicard modems Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 061/128] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 062/128] xhci: clear root port wake on bits if controller isn't wake-up capable Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 063/128] xhci: Fix runtime suspended xhci from blocking system suspend Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 064/128] ibmvscsi: Abort init sequence during error recovery Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 065/128] ibmvscsi: Add memory barriers for send / receive Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 066/128] virtio-scsi: avoid cancelling uninitialized work items Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 067/128] virtio-scsi: fix various bad behavior on aborted requests Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 068/128] ext4: Fix hole punching for files with indirect blocks Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 069/128] nfsd: fix rare symlink decoding bug Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 070/128] tools: ffs-test: fix header values endianess Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 071/128] drm/radeon/dpm: fix typo in vddci setup for eg/btc Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 072/128] drm/radeon/dpm: fix vddci setup typo on cayman Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 073/128] tracing: Remove ftrace_stop/start() from reading the trace file Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 074/128] usb: chipidea: udc: delete td from req's td list at ep_dequeue Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 075/128] drm/radeon/cik: fix typo in EOP packet Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 076/128] md: flush writes before starting a recovery Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 077/128] drm/vmwgfx: Fix incorrect write to read-only register v2: Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 078/128] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 079/128] /proc/stat: convert to single_open_size() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 080/128] lz4: add overrun checks to lz4_uncompress_unknownoutputsize() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 081/128] arm64: mm: Make icache synchronisation logic huge page aware Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 082/128] rtmutex: Detect changes in the pi lock chain Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 083/128] rtmutex: Plug slow unlock race Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 084/128] ARC: Implement ptrace(PTRACE_GET_THREAD_AREA) Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 085/128] mac80211: fix IBSS join by initializing last_scan_completed Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 086/128] [SCSI] Fix spurious request sense in error handling Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 087/128] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 088/128] netfilter: nf_nat: fix oops on netns removal Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 089/128] workqueue: fix dev_set_uevent_suppress() imbalance Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 090/128] cpuset,mempolicy: fix sleeping function called from invalid context Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 091/128] crypto: sha512_ssse3 - fix byte count to bit count conversion Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 092/128] thermal: hwmon: Make the check for critical temp valid consistent Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 093/128] hwmon: (amc6821) Fix permissions for temp2_input Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 094/128] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 095/128] hwmon: (adm1021) Fix cache problem when writing temperature limits Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 096/128] ext4: fix unjournalled bg descriptor while initializing inode bitmap Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 097/128] ext4: clarify error count warning messages Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 098/128] ext4: disable synchronous transaction batching if max_batch_time==0 Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 099/128] intel_pstate: Set CPU number before accessing MSRs Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 100/128] USB: cp210x: add support for Corsair usb dongle Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 101/128] usb: option: Add ID for Telewell TW-LTE 4G v2 Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 102/128] ACPI / EC: Avoid race condition related to advance_transaction() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 103/128] ACPI / EC: Add asynchronous command byte write support Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 104/128] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 105/128] ACPI / EC: Fix race condition in ec_transaction_completed() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 106/128] ACPI / battery: Retry to get battery information if failed during probing Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 107/128] hwmon: (adm1031) Fix writes to limit registers Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 108/128] workqueue: zero cpumask of wq_numa_possible_cpumask on init Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 109/128] hwmon: (emc2103) Fix return value Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 110/128] hwmon: (emc2103) Clamp limits instead of bailing out Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 111/128] arm64: implement TASK_SIZE_OF Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 112/128] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Luis Henriques
2014-07-25 11:13   ` [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch Jan Kardell
2014-07-28 10:05     ` Luis Henriques
2014-07-28 10:05       ` Luis Henriques
2014-08-08  8:24       ` Jonathan Cameron
2014-08-08  8:24         ` Jonathan Cameron
2014-07-24  9:46 ` [PATCH 3.11 113/128] cpufreq: Makefile: fix compilation for davinci platform Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 114/128] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 115/128] USB: ftdi_sio: Add extra PID Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 116/128] dm io: fix a race condition in the wake up code for sync_io Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 117/128] drm/radeon: fix typo in golden register setup on evergreen Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 118/128] drm/radeon/dpm: Reenabling SS on Cayman Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 119/128] powerpc/perf: Add PPMU_ARCH_207S define Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 120/128] powerpc/perf: Clear MMCR2 when enabling PMU Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 121/128] powerpc/perf: Never program book3s PMCs with values >= 0x80000000 Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 122/128] USB: serial: ftdi_sio: Add Infineon Triboard Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 123/128] clk: spear3xx: Use proper control register offset Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 124/128] x86, ioremap: Speed up check for RAM pages Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 125/128] rbd: use reference counts for image requests Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 126/128] Don't trigger congestion wait on dirty-but-not-writeout pages Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 127/128] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 128/128] mm: hugetlb: fix copy_hugetlb_page_range() Luis Henriques

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.