linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review
@ 2015-04-21 15:29 Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 001/144] fuse: notify: don't move pages Luis Henriques
                   ` (143 more replies)
  0 siblings, 144 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Luis Henriques

This is the start of the review cycle for the Linux 3.16.7-ckt10 stable kernel.

This version contains 144 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.16.y-review;a=shortlog

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

The review period for version 3.16.7-ckt10 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.16.y-ckt extended stable kernel version,
see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .

 -Luis

--
 Documentation/usb/usb-serial.txt               |   2 +-
 arch/arc/kernel/signal.c                       |   4 +-
 arch/arm/crypto/aesbs-core.S_shipped           |  12 +-
 arch/arm/crypto/bsaes-armv7.pl                 |  12 +-
 arch/arm/mach-sunxi/Kconfig                    |   4 +-
 arch/arm64/include/asm/mmu_context.h           |   9 ++
 arch/arm64/mm/dma-mapping.c                    |   6 +-
 arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi    |   1 +
 arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi    |   1 +
 arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi    |   1 +
 arch/powerpc/include/asm/iommu.h               |   6 +
 arch/powerpc/kernel/exceptions-64s.S           |   2 +-
 arch/powerpc/kernel/iommu.c                    |  26 +++++
 arch/powerpc/kernel/smp.c                      |   4 +-
 arch/powerpc/platforms/powernv/pci.c           |  27 -----
 arch/powerpc/platforms/pseries/iommu.c         |   2 +
 arch/powerpc/platforms/pseries/mobility.c      |  44 +++----
 arch/x86/crypto/aesni-intel_glue.c             |   4 +-
 arch/x86/include/asm/fpu-internal.h            |   2 +-
 arch/x86/kernel/cpu/microcode/intel_early.c    |   2 +-
 arch/x86/kernel/reboot.c                       |  10 ++
 arch/x86/kernel/traps.c                        |   2 +-
 arch/x86/kernel/xsave.c                        |   7 +-
 arch/x86/kvm/vmx.c                             |   7 +-
 arch/x86/vdso/vdso32/sigreturn.S               |   1 +
 block/blk-merge.c                              |   2 +-
 drivers/base/regmap/internal.h                 |   8 ++
 drivers/base/regmap/regcache-rbtree.c          |   2 +-
 drivers/base/regmap/regcache.c                 |  16 +--
 drivers/base/regmap/regmap.c                   |  32 +++--
 drivers/block/nbd.c                            |   8 +-
 drivers/char/virtio_console.c                  |  19 ++-
 drivers/clocksource/time-efm32.c               |   4 +-
 drivers/clocksource/timer-sun5i.c              |   8 +-
 drivers/cpuidle/cpuidle-armada-370-xp.c        |   4 +-
 drivers/dma/dw/platform.c                      |   5 +-
 drivers/dma/edma.c                             |   6 +
 drivers/dma/omap-dma.c                         |   1 +
 drivers/edac/sb_edac.c                         |  46 ++++----
 drivers/gpu/drm/i915/i915_drv.h                |   1 +
 drivers/gpu/drm/radeon/radeon.h                |   1 +
 drivers/gpu/drm/radeon/radeon_bios.c           |  10 +-
 drivers/gpu/drm/radeon/radeon_pm.c             |  22 +++-
 drivers/iio/accel/bma180.c                     |   2 +-
 drivers/iio/adc/at91_adc.c                     |   5 +-
 drivers/iio/adc/ti_am335x_adc.c                |   3 +-
 drivers/iio/adc/vf610_adc.c                    |  91 ++++++++++-----
 drivers/iio/imu/adis_trigger.c                 |   2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c     |  25 ++--
 drivers/iio/industrialio-core.c                |   5 +-
 drivers/iio/industrialio-event.c               |   1 +
 drivers/infiniband/core/umem.c                 |   8 ++
 drivers/infiniband/core/uverbs_main.c          |   1 +
 drivers/infiniband/hw/mlx4/mad.c               |  20 +++-
 drivers/input/mouse/psmouse-base.c             |  14 +++
 drivers/input/mouse/psmouse.h                  |   1 +
 drivers/input/mouse/synaptics.c                | 156 +++++++++++++++++--------
 drivers/md/dm-io.c                             |  15 ++-
 drivers/md/dm-snap.c                           | 120 +++++++++++++++++--
 drivers/md/dm-thin.c                           |  11 --
 drivers/md/dm.c                                |  21 ++++
 drivers/mfd/kempld-core.c                      |   2 +-
 drivers/net/can/flexcan.c                      |  11 +-
 drivers/net/can/usb/kvaser_usb.c               |  83 ++++++++-----
 drivers/net/ethernet/amd/pcnet32.c             |  31 ++++-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |  15 +--
 drivers/net/wireless/iwlwifi/dvm/dev.h         |   1 -
 drivers/net/wireless/iwlwifi/dvm/ucode.c       |   5 -
 drivers/net/xen-netfront.c                     |   5 +-
 drivers/of/irq.c                               |  10 +-
 drivers/phy/phy-core.c                         |   4 +-
 drivers/regulator/core.c                       |  34 +++---
 drivers/scsi/hpsa.c                            |  54 ++++++---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c             |   2 +-
 drivers/spi/spi-qup.c                          |   9 +-
 drivers/spi/spi.c                              |   5 +-
 drivers/staging/vt6655/rf.c                    |   1 +
 drivers/staging/vt6656/rf.c                    |   1 +
 drivers/target/iscsi/iscsi_target.c            |  14 ++-
 drivers/target/target_core_device.c            |   4 +-
 drivers/target/target_core_pscsi.c             |   2 +-
 drivers/target/target_core_transport.c         |   4 +
 drivers/target/tcm_fc/tfc_io.c                 |   3 +-
 drivers/tty/serial/8250/8250_dw.c              |  10 +-
 drivers/tty/serial/fsl_lpuart.c                |   3 +
 drivers/usb/chipidea/udc.c                     |  11 ++
 drivers/usb/common/usb-otg-fsm.c               |   4 +-
 drivers/usb/host/xhci-hub.c                    |   9 +-
 drivers/usb/host/xhci-pci.c                    |   2 +-
 drivers/usb/phy/phy-am335x-control.c           |   3 +
 drivers/usb/serial/Kconfig                     |   4 +-
 drivers/usb/serial/ftdi_sio.c                  |   9 +-
 drivers/usb/serial/ftdi_sio_ids.h              |   6 +
 drivers/usb/serial/keyspan_pda.c               |  19 +--
 drivers/usb/storage/unusual_uas.h              |   7 ++
 drivers/xen/balloon.c                          |  23 ++++
 fs/btrfs/ctree.c                               |   2 +-
 fs/btrfs/ctree.h                               |   5 +
 fs/btrfs/dir-item.c                            |  10 +-
 fs/btrfs/tree-log.c                            |  16 +--
 fs/btrfs/xattr.c                               | 150 +++++++++++++++---------
 fs/cifs/file.c                                 |   1 +
 fs/cifs/smb2ops.c                              |   3 +-
 fs/fuse/dev.c                                  |   7 +-
 fs/hfsplus/brec.c                              |  20 ++--
 fs/open.c                                      |   2 +-
 fs/proc/task_mmu.c                             |   3 +
 include/drm/i915_pciids.h                      |   4 +-
 include/linux/device-mapper.h                  |   1 +
 include/net/dst.h                              |   1 +
 include/trace/events/regmap.h                  | 123 ++++++++++---------
 kernel/events/core.c                           |  10 ++
 kernel/sched/core.c                            |   2 +
 kernel/time/tick-broadcast-hrtimer.c           |  11 +-
 mm/memory_hotplug.c                            |  13 +--
 mm/mmap.c                                      |   4 +-
 mm/page-writeback.c                            |   7 +-
 mm/rmap.c                                      |   7 ++
 net/core/rtnetlink.c                           |   4 +-
 net/ipv4/tcp_input.c                           |   7 +-
 net/ipv4/tcp_output.c                          |   1 +
 net/ipv6/ndisc.c                               |   9 +-
 net/mac80211/agg-rx.c                          |   8 +-
 net/mac80211/ieee80211_i.h                     |  23 +++-
 net/mac80211/rx.c                              |  10 +-
 net/mac80211/sta_info.h                        |   2 +
 net/mac80211/util.c                            |   2 +-
 net/wireless/nl80211.c                         |  10 ++
 net/xfrm/xfrm_policy.c                         |  12 +-
 security/selinux/selinuxfs.c                   |   2 +-
 sound/pci/hda/hda_generic.c                    |  21 +++-
 sound/pci/hda/hda_proc.c                       |  38 ++++--
 sound/pci/hda/patch_realtek.c                  |   3 +-
 sound/soc/codecs/adav80x.c                     |   4 +-
 sound/soc/codecs/ak4641.c                      |   4 +-
 sound/soc/codecs/ak4671.c                      |  44 +++----
 sound/soc/codecs/cs4271.c                      |   4 +-
 sound/soc/codecs/da732x.c                      |   8 +-
 sound/soc/codecs/pcm1681.c                     |   4 +-
 sound/soc/codecs/sgtl5000.c                    |   8 +-
 sound/soc/codecs/sn95031.c                     |   4 +-
 sound/soc/codecs/tas5086.c                     |   4 +-
 sound/soc/codecs/wm2000.c                      |   8 +-
 sound/soc/codecs/wm8731.c                      |   4 +-
 sound/soc/codecs/wm8903.c                      |   4 +-
 sound/soc/codecs/wm8904.c                      |   4 +-
 sound/soc/codecs/wm8955.c                      |   4 +-
 sound/soc/codecs/wm8960.c                      |   4 +-
 virt/kvm/kvm_main.c                            |  41 +++----
 149 files changed, 1321 insertions(+), 690 deletions(-)

Ahmed S. Darwish (1):
      can: kvaser_usb: Fix tx queue start/stop race conditions

Alex Deucher (1):
      drm/radeon/dpm: fix 120hz handling harder

Ameya Palande (1):
      mfd: kempld-core: Fix callback return value check

Andreas Werner (1):
      can: flexcan: Deferred on Regulator return EPROBE_DEFER

Andrei Otcheretianski (1):
      mac80211: count interfaces correctly for combination checks

Andrew Elble (1):
      NFS: fix BUG() crash in notify_change() with patch to chown_common()

Andy Lutomirski (1):
      x86/asm/entry/32: Fix user_mode() misuses

Andy Shevchenko (1):
      dmaengine: dw: append MODULE_ALIAS for platform driver

Ard Biesheuvel (1):
      crypto: arm/aes update NEON AES module to latest OpenSSL version

Bart Van Assche (2):
      tcm_qla2xxx: Fix incorrect use of __transport_register_session
      target: Fix reference leak in target_get_sess_cmd() error path

Ben Hutchings (1):
      tcp: Fix crash in TCP Fast Open

Benjamin Tissoires (3):
      Input: synaptics - skip quirks when post-2013 dimensions
      Input: synaptics - handle spurious release of trackstick buttons
      Input: synaptics - do not retrieve the board id on old firmwares

Bob Copeland (1):
      mac80211: drop unencrypted frames in mesh fwding

Brian Silverman (1):
      sched: Fix RLIMIT_RTTIME when PI-boosting to RT

Catalin Marinas (1):
      arm64: Use the reserved TTBR0 if context switching to the init_mm

Chen-Yu Tsai (1):
      ARM: sunxi: Have ARCH_SUNXI select RESET_CONTROLLER for clock driver usage

Christian Borntraeger (1):
      KVM: remove redundant assignments in __kvm_set_memory_region

D.S. Ljungmark (1):
      ipv6: Don't reduce hop limit for an interface

Dan Carpenter (1):
      tcm_fc: missing curly braces in ft_invl_hw_context()

Daniel Martin (5):
      Input: synaptics - split synaptics_resolution(), query first
      Input: synaptics - log queried and quirked dimension values
      Input: synaptics - query min dimensions for fw v8.1
      Input: synaptics - remove obsolete min/max quirk for X240
      Input: synaptics - support min/max board id in min_max_pnpid_table

Darrick J. Wong (1):
      dm io: deal with wandering queue limits when handling REQ_DISCARD and REQ_WRITE_SAME

Darshana Padmadas (1):
      iio: imu: Use iio_trigger_get for indio_dev->trig assignment

David Disseldorp (1):
      cifs: fix use-after-free bug in find_writable_file

David Dueck (1):
      usb: phy: am335x-control: check return value of bus_find_device

David Miller (1):
      radeon: Do not directly dereference pointers to BIOS area.

David Sterba (1):
      btrfs: simplify insert_orphan_item

Dmitry Torokhov (1):
      Input: synaptics - fix middle button on Lenovo 2015 products

Doug Anderson (1):
      regulator: core: Fix enable GPIO reference counting

Doug Goldstein (2):
      USB: ftdi_sio: Added custom PID for Synapse Wireless product
      USB: ftdi_sio: Use jtag quirk for SNAP Connect E10

Eli Cohen (1):
      IB/core: Avoid leakage from kernel to user space

Emmanuel Grumbach (1):
      iwlwifi: dvm: run INIT firmware again upon .start()

Eric Nelson (1):
      ASoC: sgtl5000: remove useless register write clearing CHRGPUMP_POWERUP

Filipe Manana (1):
      Btrfs: make xattr replace operations atomic

Gregory CLEMENT (1):
      cpuidle: mvebu: Fix the CPU PM notifier usage

Gu Zheng (1):
      mm/memory hotplug: postpone the reset of obsolete pgdat

Hans de Goede (2):
      Input: psmouse - add psmouse_matches_pnp_id helper function
      uas: Add US_FL_NO_ATA_1X for Initio Corporation controllers / devices

Hui Wang (1):
      ALSA: hda - Add one more node in the EAPD supporting candidate list

Ido Shamay (1):
      net/mlx4_en: Call register_netdevice in the proper location

Igor Mammedov (1):
      kvm: avoid page allocation failure in kvm_set_memory_region()

Ivan T. Ivanov (1):
      spi: qup: Fix cs-num DT property parsing

Javier Martinez Canillas (1):
      regulator: Only enable disabled regulators on resume

Jim Snow (1):
      sb_edac: Fix erroneous bytes->gigabytes conversion

Jiri Slaby (1):
      x86/vdso: Fix the build on GCC5

Joe Perches (1):
      selinux: fix sel_write_enforce broken return value

Joe Thornber (1):
      dm thin: fix to consistently zero-fill reads to unprovisioned blocks

Johannes Berg (2):
      nl80211: ignore HT/VHT capabilities without QoS/WMM
      mac80211: fix RX A-MPDU session reorder timer deletion

Jonathan Davies (1):
      xen-netfront: transmit fully GSO-sized packets

Juergen Gross (1):
      xen/balloon: before adding hotplugged memory, set frames to invalid

Kirill A. Shutemov (1):
      pagemap: do not leak physical addresses to non-privileged userspace

Lars-Peter Clausen (4):
      ASoC: ak4671: Fix control-less DAPM routes
      ASoC: da732x: Fix control-less DAPM routes
      ASoC: sn95031: Fix control-less DAPM routes
      regmap: regcache-rbtree: Fix present bitmap resize

Laurent Pinchart (1):
      of/irq: Fix of_irq_parse_one() returned error codes

Leon Yu (1):
      mm: fix anon_vma->degree underflow in anon_vma endless growing prevention

Li Jun (1):
      usb: chipidea: otg: add a_alt_hnp_support response for B device

Lu Baolu (2):
      usb: xhci: handle Config Error Change (CEC) in xhci driver
      usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers

Mahesh Salgaonkar (1):
      powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER

Majd Dibbiny (1):
      IB/mlx4: Saturate RoCE port PMA counters in case of overflow

Malcolm Priestley (2):
      vt6655: RFbSetPower fix missing rate RATE_12M
      staging: vt6656: vnt_rf_setpower: fix missing rate RATE_12M

Mark Knibbs (1):
      USB: serial: keyspan_pda: fix Entrega company name spelling

Markos Chandras (1):
      net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5}

Martin Fuzzey (1):
      iio: core: Fix double free.

Michael Ellerman (1):
      powerpc/smp: Wait until secondaries are active & online

Michael S. Tsirkin (2):
      virtio_console: init work unconditionally
      virtio_console: avoid config access from irq

Michal Kazior (1):
      mac80211: disable u-APSD queues by default

Miklos Szeredi (2):
      fuse: notify: don't move pages
      fuse: set stolen page uptodate

Mikulas Patocka (3):
      dm: hold suspend_lock while suspending device during device deletion
      dm snapshot: suspend origin when doing exception handover
      dm snapshot: suspend merging snapshot when doing exception handover

Nathaniel W Filardo (1):
      USB: keyspan_pda: add new device id

Neal Cardwell (1):
      tcp: fix FRTO undo on cumulative ACK of SACKed range

Nicholas Bellinger (3):
      iscsi-target: Avoid early conn_logout_comp for iser connections
      target/pscsi: Fix NULL pointer dereference in get_device_type
      target: Fix virtual LUN=0 target_configure_device failure OOPs

Nishanth Aravamudan (1):
      powerpc/iommu: Remove IOMMU device references via bus notifier

Octavian Purdila (1):
      iio: fix drivers that check buffer->scan_mask

Oleg Nesterov (2):
      x86/fpu: Avoid math_state_restore() without used_math() in __restore_xstate_sig()
      x86/fpu: Drop_fpu() should not assume that tsk equals current

Paolo Bonzini (1):
      kvm: commonize allocation of the new memory slots

Peter Chen (1):
      usb: common: otg-fsm: only signal connect after switching to peripheral

Peter Hurley (1):
      serial: 8250_dw: Fix deadlock in LCR workaround

Peter Ujfalusi (1):
      dmaengine: omap-dma: Fix memory leak when terminating running transfer

Peter Zijlstra (1):
      perf: Fix irq_work 'tail' recursion

Petr Kulhavy (1):
      dmaengine: edma: fix memory leak when terminating running transfers

Philipp Zabel (1):
      regmap: introduce regmap_name to fix syscon regmap trace events

Preeti U Murthy (1):
      timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop

Quentin Casasnovas (1):
      x86/microcode/intel: Guard against stack overflow in the loader

Radim Krčmář (1):
      KVM: nVMX: mask unrestricted_guest if disabled on L0

Rodrigo Vivi (1):
      drm/i915/bdw: PCI IDs ending in 0xb are ULT.

Sachin Prabhu (1):
      cifs: smb2_clone_range() - exit on unhandled error

Scott Wood (1):
      powerpc/mpc85xx: Add ranges to etsec2 nodes

Sebastian Wicki (1):
      ALSA: hda - Add dock support for Thinkpad T450s (17aa:5036)

Sergei Antonov (1):
      hfsplus: fix B-tree corruption after insertion at position 0

Seth Jennings (1):
      sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel

Shachar Raindel (1):
      IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic

Stefan Agner (2):
      tty: serial: fsl_lpuart: clear receive flag on FIFO flush
      iio: adc: vf610: use ADC clock within specification

Stefan Lippers-Hollmann (1):
      x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk

Stephan Mueller (1):
      crypto: aesni - fix memory usage in GCM decryption

Sudip Mukherjee (1):
      nbd: fix possible memory leak

Suzuki K. Poulose (1):
      arm64: Honor __GFP_ZERO in dma allocations

Takashi Iwai (12):
      ASoC: adav80x: Fix wrong value references for boolean kctl
      ASoC: ak4641: Fix wrong value references for boolean kctl
      ASoC: cs4271: Fix wrong value references for boolean kctl
      ASoC: pcm1681: Fix wrong value references for boolean kctl
      ASoC: tas5086: Fix wrong value references for boolean kctl
      ASoC: wm2000: Fix wrong value references for boolean kctl
      ASoC: wm8731: Fix wrong value references for boolean kctl
      ASoC: wm8903: Fix wrong value references for boolean kctl
      ASoC: wm8904: Fix wrong value references for boolean kctl
      ASoC: wm8955: Fix wrong value references for boolean kctl
      ASoC: wm8960: Fix wrong value references for boolean kctl
      ALSA: hda - Treat stereo-to-mono mix properly

Tejun Heo (2):
      writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth()
      writeback: fix possible underflow in write bandwidth calculation

Thierry Reding (1):
      phy: Find the right match in devm_phy_destroy()

Tomas Henzl (4):
      hpsa: refine the pci enable/disable handling
      hpsa: add missing pci_set_master in kdump path
      hpsa: fix memory leak in kdump hard reset
      hpsa: turn off interrupts when kdump starts

Tyrel Datwyler (1):
      powerpc/pseries: Little endian fixes for post mobility device tree update

Uwe Kleine-König (1):
      spi: trigger trace event for message-done before mesg->complete

Vineet Gupta (1):
      ARC: SA_SIGINFO ucontext regs off-by-one

Viorel Suman (1):
      iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo

WANG Cong (1):
      net: use for_each_netdev_safe() in rtnl_group_changelink()

Wenbo Wang (1):
      Fix bug in blk_rq_merge_ok

Yongbae Park (2):
      clocksource: efm32: Fix a NULL pointer dereference
      clockevents: sun5i: Fix setup_irq init sequence

huaibin Wang (1):
      xfrm: release dst_orig in case of error in xfrm_lookup()

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

* [PATCH 3.16.y-ckt 001/144] fuse: notify: don't move pages
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 002/144] fuse: set stolen page uptodate Luis Henriques
                   ` (142 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Miklos Szeredi, Luis Henriques

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

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

From: Miklos Szeredi <mszeredi@suse.cz>

commit 0d2783626a53d4c922f82d51fa675cb5d13f0d36 upstream.

fuse_try_move_page() is not prepared for replacing pages that have already
been read.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/fuse/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index ca887314aba9..a221901813a1 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1721,6 +1721,9 @@ copy_finish:
 static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
 		       unsigned int size, struct fuse_copy_state *cs)
 {
+	/* Don't try to move pages (yet) */
+	cs->move_pages = 0;
+
 	switch (code) {
 	case FUSE_NOTIFY_POLL:
 		return fuse_notify_poll(fc, size, cs);

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

* [PATCH 3.16.y-ckt 002/144] fuse: set stolen page uptodate
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 001/144] fuse: notify: don't move pages Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 003/144] dm thin: fix to consistently zero-fill reads to unprovisioned blocks Luis Henriques
                   ` (141 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Miklos Szeredi, Luis Henriques

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

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

From: Miklos Szeredi <mszeredi@suse.cz>

commit aa991b3b267e24f578bac7b09cc57579b660304b upstream.

Regular pipe buffers' ->steal method (generic_pipe_buf_steal()) doesn't set
PG_uptodate.

Don't warn on this condition, just set the uptodate flag.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/fuse/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index a221901813a1..f2bbb8513360 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -814,8 +814,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
 
 	newpage = buf->page;
 
-	if (WARN_ON(!PageUptodate(newpage)))
-		return -EIO;
+	if (!PageUptodate(newpage))
+		SetPageUptodate(newpage);
 
 	ClearPageMappedToDisk(newpage);
 

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

* [PATCH 3.16.y-ckt 003/144] dm thin: fix to consistently zero-fill reads to unprovisioned blocks
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 001/144] fuse: notify: don't move pages Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 002/144] fuse: set stolen page uptodate Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 004/144] dm: hold suspend_lock while suspending device during device deletion Luis Henriques
                   ` (140 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joe Thornber, Mike Snitzer, Luis Henriques

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

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

From: Joe Thornber <ejt@redhat.com>

commit 5f027a3bf184d1d36e68745f7cd3718a8b879cc0 upstream.

It was always intended that a read to an unprovisioned block will return
zeroes regardless of whether the pool is in read-only or read-write
mode.  thin_bio_map() was inconsistent with its handling of such reads
when the pool is in read-only mode, it now properly zero-fills the bios
it returns in response to unprovisioned block reads.

Eliminate thin_bio_map()'s special read-only mode handling of -ENODATA
and just allow the IO to be deferred to the worker which will result in
pool->process_bio() handling the IO (which already properly zero-fills
reads to unprovisioned blocks).

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-thin.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index add44f5a87b1..7924c3987cde 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1938,17 +1938,6 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio)
 		return DM_MAPIO_REMAPPED;
 
 	case -ENODATA:
-		if (get_pool_mode(tc->pool) == PM_READ_ONLY) {
-			/*
-			 * This block isn't provisioned, and we have no way
-			 * of doing so.
-			 */
-			handle_unserviceable_bio(tc->pool, bio);
-			cell_defer_no_holder_no_free(tc, &cell1);
-			return DM_MAPIO_SUBMITTED;
-		}
-		/* fall through */
-
 	case -EWOULDBLOCK:
 		/*
 		 * In future, the failed dm_thin_find_block above could

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

* [PATCH 3.16.y-ckt 004/144] dm: hold suspend_lock while suspending device during device deletion
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (2 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 003/144] dm thin: fix to consistently zero-fill reads to unprovisioned blocks Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 005/144] dm snapshot: suspend origin when doing exception handover Luis Henriques
                   ` (139 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Mike Snitzer, Luis Henriques

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit ab7c7bb6f4ab95dbca96fcfc4463cd69843e3e24 upstream.

__dm_destroy() must take the suspend_lock so that its presuspend and
postsuspend calls do not race with an internal suspend.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index e705042a997c..bd7c5c810214 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2405,10 +2405,16 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
 	set_bit(DMF_FREEING, &md->flags);
 	spin_unlock(&_minor_lock);
 
+	/*
+	 * Take suspend_lock so that presuspend and postsuspend methods
+	 * do not race with internal suspend.
+	 */
+	mutex_lock(&md->suspend_lock);
 	if (!dm_suspended_md(md)) {
 		dm_table_presuspend_targets(map);
 		dm_table_postsuspend_targets(map);
 	}
+	mutex_unlock(&md->suspend_lock);
 
 	/* dm_put_live_table must be before msleep, otherwise deadlock is possible */
 	dm_put_live_table(md, srcu_idx);

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

* [PATCH 3.16.y-ckt 005/144] dm snapshot: suspend origin when doing exception handover
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (3 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 004/144] dm: hold suspend_lock while suspending device during device deletion Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 006/144] dm snapshot: suspend merging snapshot " Luis Henriques
                   ` (138 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Mike Snitzer, Luis Henriques

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit b735fede8d957d9d255e9c5cf3964cfa59799637 upstream.

In the function snapshot_resume we perform exception store handover.  If
there is another active snapshot target, the exception store is moved
from this target to the target that is being resumed.

The problem is that if there is some pending exception, it will point to
an incorrect exception store after that handover, causing a crash due to
dm-snap-persistent.c:get_exception()'s BUG_ON.

This bug can be triggered by repeatedly changing snapshot permissions
with "lvchange -p r" and "lvchange -p rw" while there are writes on the
associated origin device.

To fix this bug, we must suspend the origin device when doing the
exception store handover to make sure that there are no pending
exceptions:
- introduce _origin_hash that keeps track of dm_origin structures.
- introduce functions __lookup_dm_origin, __insert_dm_origin and
  __remove_dm_origin that manipulate the origin hash.
- modify snapshot_resume so that it calls dm_internal_suspend_fast() and
  dm_internal_resume_fast() on the origin device.

NOTE to stable@ people:

When backporting to kernels 3.12-3.18, use dm_internal_suspend and
dm_internal_resume instead of dm_internal_suspend_fast and
dm_internal_resume_fast.

When backporting to kernels older than 3.12, you need to pick functions
dm_internal_suspend and dm_internal_resume from the commit
fd2ed4d252701d3bbed4cd3e3d267ad469bb832a.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[ luis: backported to 3.16: as suggested by the author:
  - replaced dm_internal_suspend_fast by dm_internal_suspend
  - replaced dm_internal_resume_fast by dm_internal_resume ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-snap.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++-----
 drivers/md/dm.c      |  2 ++
 2 files changed, 86 insertions(+), 9 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 8380d036eec3..1adf4bb21797 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -20,6 +20,8 @@
 #include <linux/log2.h>
 #include <linux/dm-kcopyd.h>
 
+#include "dm.h"
+
 #include "dm-exception-store.h"
 
 #define DM_MSG_PREFIX "snapshots"
@@ -291,12 +293,23 @@ struct origin {
 };
 
 /*
+ * This structure is allocated for each origin target
+ */
+struct dm_origin {
+	struct dm_dev *dev;
+	struct dm_target *ti;
+	unsigned split_boundary;
+	struct list_head hash_list;
+};
+
+/*
  * Size of the hash table for origin volumes. If we make this
  * the size of the minors list then it should be nearly perfect
  */
 #define ORIGIN_HASH_SIZE 256
 #define ORIGIN_MASK      0xFF
 static struct list_head *_origins;
+static struct list_head *_dm_origins;
 static struct rw_semaphore _origins_lock;
 
 static DECLARE_WAIT_QUEUE_HEAD(_pending_exceptions_done);
@@ -310,12 +323,22 @@ static int init_origin_hash(void)
 	_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
 			   GFP_KERNEL);
 	if (!_origins) {
-		DMERR("unable to allocate memory");
+		DMERR("unable to allocate memory for _origins");
 		return -ENOMEM;
 	}
-
 	for (i = 0; i < ORIGIN_HASH_SIZE; i++)
 		INIT_LIST_HEAD(_origins + i);
+
+	_dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
+			      GFP_KERNEL);
+	if (!_dm_origins) {
+		DMERR("unable to allocate memory for _dm_origins");
+		kfree(_origins);
+		return -ENOMEM;
+	}
+	for (i = 0; i < ORIGIN_HASH_SIZE; i++)
+		INIT_LIST_HEAD(_dm_origins + i);
+
 	init_rwsem(&_origins_lock);
 
 	return 0;
@@ -324,6 +347,7 @@ static int init_origin_hash(void)
 static void exit_origin_hash(void)
 {
 	kfree(_origins);
+	kfree(_dm_origins);
 }
 
 static unsigned origin_hash(struct block_device *bdev)
@@ -350,6 +374,30 @@ static void __insert_origin(struct origin *o)
 	list_add_tail(&o->hash_list, sl);
 }
 
+static struct dm_origin *__lookup_dm_origin(struct block_device *origin)
+{
+	struct list_head *ol;
+	struct dm_origin *o;
+
+	ol = &_dm_origins[origin_hash(origin)];
+	list_for_each_entry (o, ol, hash_list)
+		if (bdev_equal(o->dev->bdev, origin))
+			return o;
+
+	return NULL;
+}
+
+static void __insert_dm_origin(struct dm_origin *o)
+{
+	struct list_head *sl = &_dm_origins[origin_hash(o->dev->bdev)];
+	list_add_tail(&o->hash_list, sl);
+}
+
+static void __remove_dm_origin(struct dm_origin *o)
+{
+	list_del(&o->hash_list);
+}
+
 /*
  * _origins_lock must be held when calling this function.
  * Returns number of snapshots registered using the supplied cow device, plus:
@@ -1849,8 +1897,20 @@ static void snapshot_resume(struct dm_target *ti)
 {
 	struct dm_snapshot *s = ti->private;
 	struct dm_snapshot *snap_src = NULL, *snap_dest = NULL;
+	struct dm_origin *o;
+	struct mapped_device *origin_md = NULL;
 
 	down_read(&_origins_lock);
+
+	o = __lookup_dm_origin(s->origin->bdev);
+	if (o)
+		origin_md = dm_table_get_md(o->ti->table);
+	if (origin_md == dm_table_get_md(ti->table))
+		origin_md = NULL;
+
+	if (origin_md)
+		dm_internal_suspend(origin_md);
+
 	(void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest, NULL);
 	if (snap_src && snap_dest) {
 		down_write(&snap_src->lock);
@@ -1859,6 +1919,10 @@ static void snapshot_resume(struct dm_target *ti)
 		up_write(&snap_dest->lock);
 		up_write(&snap_src->lock);
 	}
+
+	if (origin_md)
+		dm_internal_resume(origin_md);
+
 	up_read(&_origins_lock);
 
 	/* Now we have correct chunk size, reregister */
@@ -2141,11 +2205,6 @@ static int origin_write_extent(struct dm_snapshot *merging_snap,
  * Origin: maps a linear range of a device, with hooks for snapshotting.
  */
 
-struct dm_origin {
-	struct dm_dev *dev;
-	unsigned split_boundary;
-};
-
 /*
  * Construct an origin mapping: <dev_path>
  * The context for an origin is merely a 'struct dm_dev *'
@@ -2174,6 +2233,7 @@ static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto bad_open;
 	}
 
+	o->ti = ti;
 	ti->private = o;
 	ti->num_flush_bios = 1;
 
@@ -2188,6 +2248,7 @@ bad_alloc:
 static void origin_dtr(struct dm_target *ti)
 {
 	struct dm_origin *o = ti->private;
+
 	dm_put_device(ti, o->dev);
 	kfree(o);
 }
@@ -2224,6 +2285,19 @@ static void origin_resume(struct dm_target *ti)
 	struct dm_origin *o = ti->private;
 
 	o->split_boundary = get_origin_minimum_chunksize(o->dev->bdev);
+
+	down_write(&_origins_lock);
+	__insert_dm_origin(o);
+	up_write(&_origins_lock);
+}
+
+static void origin_postsuspend(struct dm_target *ti)
+{
+	struct dm_origin *o = ti->private;
+
+	down_write(&_origins_lock);
+	__remove_dm_origin(o);
+	up_write(&_origins_lock);
 }
 
 static void origin_status(struct dm_target *ti, status_type_t type,
@@ -2266,12 +2340,13 @@ static int origin_iterate_devices(struct dm_target *ti,
 
 static struct target_type origin_target = {
 	.name    = "snapshot-origin",
-	.version = {1, 8, 1},
+	.version = {1, 9, 0},
 	.module  = THIS_MODULE,
 	.ctr     = origin_ctr,
 	.dtr     = origin_dtr,
 	.map     = origin_map,
 	.resume  = origin_resume,
+	.postsuspend = origin_postsuspend,
 	.status  = origin_status,
 	.merge	 = origin_merge,
 	.iterate_devices = origin_iterate_devices,
@@ -2279,7 +2354,7 @@ static struct target_type origin_target = {
 
 static struct target_type snapshot_target = {
 	.name    = "snapshot",
-	.version = {1, 12, 0},
+	.version = {1, 13, 0},
 	.module  = THIS_MODULE,
 	.ctr     = snapshot_ctr,
 	.dtr     = snapshot_dtr,
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index bd7c5c810214..87791fc992ac 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2766,6 +2766,7 @@ void dm_internal_suspend(struct mapped_device *md)
 	flush_workqueue(md->wq);
 	dm_wait_for_completion(md, TASK_UNINTERRUPTIBLE);
 }
+EXPORT_SYMBOL_GPL(dm_internal_suspend);
 
 void dm_internal_resume(struct mapped_device *md)
 {
@@ -2777,6 +2778,7 @@ void dm_internal_resume(struct mapped_device *md)
 done:
 	mutex_unlock(&md->suspend_lock);
 }
+EXPORT_SYMBOL_GPL(dm_internal_resume);
 
 /*-----------------------------------------------------------------
  * Event notification.

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

* [PATCH 3.16.y-ckt 006/144] dm snapshot: suspend merging snapshot when doing exception handover
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (4 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 005/144] dm snapshot: suspend origin when doing exception handover Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 007/144] dm io: deal with wandering queue limits when handling REQ_DISCARD and REQ_WRITE_SAME Luis Henriques
                   ` (137 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Mike Snitzer, Luis Henriques

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit 09ee96b21456883e108c3b00597bb37ec512151b upstream.

The "dm snapshot: suspend origin when doing exception handover" commit
fixed a exception store handover bug associated with pending exceptions
to the "snapshot-origin" target.

However, a similar problem exists in snapshot merging.  When snapshot
merging is in progress, we use the target "snapshot-merge" instead of
"snapshot-origin".  Consequently, during exception store handover, we
must find the snapshot-merge target and suspend its associated
mapped_device.

To avoid lockdep warnings, the target must be suspended and resumed
without holding _origins_lock.

Introduce a dm_hold() function that grabs a reference on a
mapped_device, but unlike dm_get(), it doesn't crash if the device has
the DMF_FREEING flag set, it returns an error in this case.

In snapshot_resume() we grab the reference to the origin device using
dm_hold() while holding _origins_lock (_origins_lock guarantees that the
device won't disappear).  Then we release _origins_lock, suspend the
device and grab _origins_lock again.

NOTE to stable@ people:
When backporting to kernels 3.18 and older, use dm_internal_suspend and
dm_internal_resume instead of dm_internal_suspend_fast and
dm_internal_resume_fast.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[ luis: backported to 3.16: as suggested by the author:
  - replaced dm_internal_suspend_fast by dm_internal_suspend
  - replaced dm_internal_resume_fast by dm_internal_resume ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-snap.c          | 35 +++++++++++++++++++++++++++++------
 drivers/md/dm.c               | 13 +++++++++++++
 include/linux/device-mapper.h |  1 +
 3 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 1adf4bb21797..3363fa199a19 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1896,20 +1896,39 @@ static int snapshot_preresume(struct dm_target *ti)
 static void snapshot_resume(struct dm_target *ti)
 {
 	struct dm_snapshot *s = ti->private;
-	struct dm_snapshot *snap_src = NULL, *snap_dest = NULL;
+	struct dm_snapshot *snap_src = NULL, *snap_dest = NULL, *snap_merging = NULL;
 	struct dm_origin *o;
 	struct mapped_device *origin_md = NULL;
+	bool must_restart_merging = false;
 
 	down_read(&_origins_lock);
 
 	o = __lookup_dm_origin(s->origin->bdev);
 	if (o)
 		origin_md = dm_table_get_md(o->ti->table);
+	if (!origin_md) {
+		(void) __find_snapshots_sharing_cow(s, NULL, NULL, &snap_merging);
+		if (snap_merging)
+			origin_md = dm_table_get_md(snap_merging->ti->table);
+	}
 	if (origin_md == dm_table_get_md(ti->table))
 		origin_md = NULL;
+	if (origin_md) {
+		if (dm_hold(origin_md))
+			origin_md = NULL;
+	}
 
-	if (origin_md)
+	up_read(&_origins_lock);
+
+	if (origin_md) {
 		dm_internal_suspend(origin_md);
+		if (snap_merging && test_bit(RUNNING_MERGE, &snap_merging->state_bits)) {
+			must_restart_merging = true;
+			stop_merge(snap_merging);
+		}
+	}
+
+	down_read(&_origins_lock);
 
 	(void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest, NULL);
 	if (snap_src && snap_dest) {
@@ -1920,11 +1939,15 @@ static void snapshot_resume(struct dm_target *ti)
 		up_write(&snap_src->lock);
 	}
 
-	if (origin_md)
-		dm_internal_resume(origin_md);
-
 	up_read(&_origins_lock);
 
+	if (origin_md) {
+		if (must_restart_merging)
+			start_merge(snap_merging);
+		dm_internal_resume(origin_md);
+		dm_put(origin_md);
+	}
+
 	/* Now we have correct chunk size, reregister */
 	reregister_snapshot(s);
 
@@ -2368,7 +2391,7 @@ static struct target_type snapshot_target = {
 
 static struct target_type merge_target = {
 	.name    = dm_snapshot_merge_target_name,
-	.version = {1, 2, 0},
+	.version = {1, 3, 0},
 	.module  = THIS_MODULE,
 	.ctr     = snapshot_ctr,
 	.dtr     = snapshot_dtr,
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 87791fc992ac..b3fdf9cfbeb9 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2386,6 +2386,19 @@ void dm_get(struct mapped_device *md)
 	BUG_ON(test_bit(DMF_FREEING, &md->flags));
 }
 
+int dm_hold(struct mapped_device *md)
+{
+	spin_lock(&_minor_lock);
+	if (test_bit(DMF_FREEING, &md->flags)) {
+		spin_unlock(&_minor_lock);
+		return -EBUSY;
+	}
+	dm_get(md);
+	spin_unlock(&_minor_lock);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dm_hold);
+
 const char *dm_device_name(struct mapped_device *md)
 {
 	return md->name;
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index e1707de043ae..c51706b7a36e 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -366,6 +366,7 @@ int dm_create(int minor, struct mapped_device **md);
  */
 struct mapped_device *dm_get_md(dev_t dev);
 void dm_get(struct mapped_device *md);
+int dm_hold(struct mapped_device *md);
 void dm_put(struct mapped_device *md);
 
 /*

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

* [PATCH 3.16.y-ckt 007/144] dm io: deal with wandering queue limits when handling REQ_DISCARD and REQ_WRITE_SAME
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (5 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 006/144] dm snapshot: suspend merging snapshot " Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 008/144] crypto: arm/aes update NEON AES module to latest OpenSSL version Luis Henriques
                   ` (136 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Darrick J. Wong, Mikulas Patocka, Mike Snitzer, Luis Henriques

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

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

From: "Darrick J. Wong" <darrick.wong@oracle.com>

commit e5db29806b99ce2b2640d2e4d4fcb983cea115c5 upstream.

Since it's possible for the discard and write same queue limits to
change while the upper level command is being sliced and diced, fix up
both of them (a) to reject IO if the special command is unsupported at
the start of the function and (b) read the limits once and let the
commands error out on their own if the status happens to change.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-io.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index d2a8d64f8526..080e767250d3 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -291,9 +291,16 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
 	struct request_queue *q = bdev_get_queue(where->bdev);
 	unsigned short logical_block_size = queue_logical_block_size(q);
 	sector_t num_sectors;
+	unsigned int uninitialized_var(special_cmd_max_sectors);
 
-	/* Reject unsupported discard requests */
-	if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) {
+	/*
+	 * Reject unsupported discard and write same requests.
+	 */
+	if (rw & REQ_DISCARD)
+		special_cmd_max_sectors = q->limits.max_discard_sectors;
+	else if (rw & REQ_WRITE_SAME)
+		special_cmd_max_sectors = q->limits.max_write_same_sectors;
+	if ((rw & (REQ_DISCARD | REQ_WRITE_SAME)) && special_cmd_max_sectors == 0) {
 		dec_count(io, region, -EOPNOTSUPP);
 		return;
 	}
@@ -319,7 +326,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
 		store_io_and_region_in_bio(bio, io, region);
 
 		if (rw & REQ_DISCARD) {
-			num_sectors = min_t(sector_t, q->limits.max_discard_sectors, remaining);
+			num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining);
 			bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT;
 			remaining -= num_sectors;
 		} else if (rw & REQ_WRITE_SAME) {
@@ -328,7 +335,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
 			 */
 			dp->get_page(dp, &page, &len, &offset);
 			bio_add_page(bio, page, logical_block_size, offset);
-			num_sectors = min_t(sector_t, q->limits.max_write_same_sectors, remaining);
+			num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining);
 			bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT;
 
 			offset = 0;

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

* [PATCH 3.16.y-ckt 008/144] crypto: arm/aes update NEON AES module to latest OpenSSL version
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (6 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 007/144] dm io: deal with wandering queue limits when handling REQ_DISCARD and REQ_WRITE_SAME Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 009/144] mac80211: drop unencrypted frames in mesh fwding Luis Henriques
                   ` (135 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ard Biesheuvel, Herbert Xu, Luis Henriques

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

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

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 001eabfd54c0cbf9d7d16264ddc8cc0bee67e3ed upstream.

This updates the bit sliced AES module to the latest version in the
upstream OpenSSL repository (e620e5ae37bc). This is needed to fix a
bug in the XTS decryption path, where data chunked in a certain way
could trigger the ciphertext stealing code, which is not supposed to
be active in the kernel build (The kernel implementation of XTS only
supports round multiples of the AES block size of 16 bytes, whereas
the conformant OpenSSL implementation of XTS supports inputs of
arbitrary size by applying ciphertext stealing). This is fixed in
the upstream version by adding the missing #ifndef XTS_CHAIN_TWEAK
around the offending instructions.

The upstream code also contains the change applied by Russell to
build the code unconditionally, i.e., even if __LINUX_ARM_ARCH__ < 7,
but implemented slightly differently.

Fixes: e4e7f10bfc40 ("ARM: add support for bit sliced AES using NEON instructions")
Reported-by: Adrian Kotelba <adrian.kotelba@gmail.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/crypto/aesbs-core.S_shipped | 12 ++++++++----
 arch/arm/crypto/bsaes-armv7.pl       | 12 ++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/arch/arm/crypto/aesbs-core.S_shipped b/arch/arm/crypto/aesbs-core.S_shipped
index 71e5fc7cfb18..1d1800f71c5b 100644
--- a/arch/arm/crypto/aesbs-core.S_shipped
+++ b/arch/arm/crypto/aesbs-core.S_shipped
@@ -58,14 +58,18 @@
 # define VFP_ABI_FRAME	0
 # define BSAES_ASM_EXTENDED_KEY
 # define XTS_CHAIN_TWEAK
-# define __ARM_ARCH__	7
+# define __ARM_ARCH__ __LINUX_ARM_ARCH__
+# define __ARM_MAX_ARCH__ 7
 #endif
 
 #ifdef __thumb__
 # define adrl adr
 #endif
 
-#if __ARM_ARCH__>=7
+#if __ARM_MAX_ARCH__>=7
+.arch	armv7-a
+.fpu	neon
+
 .text
 .syntax	unified 	@ ARMv7-capable assembler is expected to handle this
 #ifdef __thumb2__
@@ -74,8 +78,6 @@
 .code   32
 #endif
 
-.fpu	neon
-
 .type	_bsaes_decrypt8,%function
 .align	4
 _bsaes_decrypt8:
@@ -2095,9 +2097,11 @@ bsaes_xts_decrypt:
 	vld1.8	{q8}, [r0]			@ initial tweak
 	adr	r2, .Lxts_magic
 
+#ifndef	XTS_CHAIN_TWEAK
 	tst	r9, #0xf			@ if not multiple of 16
 	it	ne				@ Thumb2 thing, sanity check in ARM
 	subne	r9, #0x10			@ subtract another 16 bytes
+#endif
 	subs	r9, #0x80
 
 	blo	.Lxts_dec_short
diff --git a/arch/arm/crypto/bsaes-armv7.pl b/arch/arm/crypto/bsaes-armv7.pl
index be068db960ee..a4d3856e7d24 100644
--- a/arch/arm/crypto/bsaes-armv7.pl
+++ b/arch/arm/crypto/bsaes-armv7.pl
@@ -701,14 +701,18 @@ $code.=<<___;
 # define VFP_ABI_FRAME	0
 # define BSAES_ASM_EXTENDED_KEY
 # define XTS_CHAIN_TWEAK
-# define __ARM_ARCH__	7
+# define __ARM_ARCH__ __LINUX_ARM_ARCH__
+# define __ARM_MAX_ARCH__ 7
 #endif
 
 #ifdef __thumb__
 # define adrl adr
 #endif
 
-#if __ARM_ARCH__>=7
+#if __ARM_MAX_ARCH__>=7
+.arch	armv7-a
+.fpu	neon
+
 .text
 .syntax	unified 	@ ARMv7-capable assembler is expected to handle this
 #ifdef __thumb2__
@@ -717,8 +721,6 @@ $code.=<<___;
 .code   32
 #endif
 
-.fpu	neon
-
 .type	_bsaes_decrypt8,%function
 .align	4
 _bsaes_decrypt8:
@@ -2076,9 +2078,11 @@ bsaes_xts_decrypt:
 	vld1.8	{@XMM[8]}, [r0]			@ initial tweak
 	adr	$magic, .Lxts_magic
 
+#ifndef	XTS_CHAIN_TWEAK
 	tst	$len, #0xf			@ if not multiple of 16
 	it	ne				@ Thumb2 thing, sanity check in ARM
 	subne	$len, #0x10			@ subtract another 16 bytes
+#endif
 	subs	$len, #0x80
 
 	blo	.Lxts_dec_short

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

* [PATCH 3.16.y-ckt 009/144] mac80211: drop unencrypted frames in mesh fwding
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (7 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 008/144] crypto: arm/aes update NEON AES module to latest OpenSSL version Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 010/144] mac80211: disable u-APSD queues by default Luis Henriques
                   ` (134 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bob Copeland, Johannes Berg, Luis Henriques

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

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

From: Bob Copeland <me@bobcopeland.com>

commit d0c22119f574b851e63360c6b8660fe9593bbc3c upstream.

The mesh forwarding path was not checking that data
frames were protected when running an encrypted network;
add the necessary check.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/rx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 247b41be695b..a70f4ce4f652 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2076,6 +2076,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	hdr = (struct ieee80211_hdr *) skb->data;
 	mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
 
+	if (ieee80211_drop_unencrypted(rx, hdr->frame_control))
+		return RX_DROP_MONITOR;
+
 	/* frame is in RMC, don't forward */
 	if (ieee80211_is_data(hdr->frame_control) &&
 	    is_multicast_ether_addr(hdr->addr1) &&

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

* [PATCH 3.16.y-ckt 010/144] mac80211: disable u-APSD queues by default
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (8 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 009/144] mac80211: drop unencrypted frames in mesh fwding Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 011/144] ASoC: ak4671: Fix control-less DAPM routes Luis Henriques
                   ` (133 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kazior, Johannes Berg, Luis Henriques

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

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

From: Michal Kazior <michal.kazior@tieto.com>

commit aa75ebc275b2a91b193654a177daf900ad6703f0 upstream.

Some APs experience problems when working with
U-APSD. Decreasing the probability of that
happening by using legacy mode for all ACs but VO
isn't enough.

Cisco 4410N originally forced us to enable VO by
default only because it treated non-VO ACs as
legacy.

However some APs (notably Netgear R7000) silently
reclassify packets to different ACs. Since u-APSD
ACs require trigger frames for frame retrieval
clients would never see some frames (e.g. ARP
responses) or would fetch them accidentally after
a long time.

It makes little sense to enable u-APSD queues by
default because it needs userspace applications to
be aware of it to actually take advantage of the
possible additional powersavings. Implicitly
depending on driver autotrigger frame support
doesn't make much sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/ieee80211_i.h | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 5ed8c78d6f68..6b943c29937b 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -57,13 +57,24 @@ struct ieee80211_local;
 #define IEEE80211_UNSET_POWER_LEVEL	INT_MIN
 
 /*
- * Some APs experience problems when working with U-APSD. Decrease the
- * probability of that happening by using legacy mode for all ACs but VO.
- * The AP that caused us trouble was a Cisco 4410N. It ignores our
- * setting, and always treats non-VO ACs as legacy.
+ * Some APs experience problems when working with U-APSD. Decreasing the
+ * probability of that happening by using legacy mode for all ACs but VO isn't
+ * enough.
+ *
+ * Cisco 4410N originally forced us to enable VO by default only because it
+ * treated non-VO ACs as legacy.
+ *
+ * However some APs (notably Netgear R7000) silently reclassify packets to
+ * different ACs. Since u-APSD ACs require trigger frames for frame retrieval
+ * clients would never see some frames (e.g. ARP responses) or would fetch them
+ * accidentally after a long time.
+ *
+ * It makes little sense to enable u-APSD queues by default because it needs
+ * userspace applications to be aware of it to actually take advantage of the
+ * possible additional powersavings. Implicitly depending on driver autotrigger
+ * frame support doesn't make much sense.
  */
-#define IEEE80211_DEFAULT_UAPSD_QUEUES \
-	IEEE80211_WMM_IE_STA_QOSINFO_AC_VO
+#define IEEE80211_DEFAULT_UAPSD_QUEUES 0
 
 #define IEEE80211_DEFAULT_MAX_SP_LEN		\
 	IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL

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

* [PATCH 3.16.y-ckt 011/144] ASoC: ak4671: Fix control-less DAPM routes
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (9 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 010/144] mac80211: disable u-APSD queues by default Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 012/144] ASoC: da732x: " Luis Henriques
                   ` (132 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Mark Brown, Luis Henriques

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

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

From: Lars-Peter Clausen <lars@metafoo.de>

commit ce9594c6b332fd6fe464e22a83b0e6e0a287aac6 upstream.

Routes without a control must use NULL for the control name. The ak4671
driver uses "NULL" instead in a few places. Previous to commit 5fe5b767dc6f
("ASoC: dapm: Do not pretend to support controls for non mixer/mux widgets")
the DAPM core silently ignored non-NULL controls on non-mixer and non-mux
routes. But starting with that commit it will complain and not add the
route breaking the ak4671 driver in the process.

This patch replaces the incorrect "NULL" control name with NULL to fix the
issue.

Fixes: 5fe5b767dc6f ("ASoC: dapm: Do not pretend to support controls for non mixer/mux widgets")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/ak4671.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c
index 998fa0c5a0b9..61a31802cf79 100644
--- a/sound/soc/codecs/ak4671.c
+++ b/sound/soc/codecs/ak4671.c
@@ -343,25 +343,25 @@ static const struct snd_soc_dapm_widget ak4671_dapm_widgets[] = {
 };
 
 static const struct snd_soc_dapm_route ak4671_intercon[] = {
-	{"DAC Left", "NULL", "PMPLL"},
-	{"DAC Right", "NULL", "PMPLL"},
-	{"ADC Left", "NULL", "PMPLL"},
-	{"ADC Right", "NULL", "PMPLL"},
+	{"DAC Left", NULL, "PMPLL"},
+	{"DAC Right", NULL, "PMPLL"},
+	{"ADC Left", NULL, "PMPLL"},
+	{"ADC Right", NULL, "PMPLL"},
 
 	/* Outputs */
-	{"LOUT1", "NULL", "LOUT1 Mixer"},
-	{"ROUT1", "NULL", "ROUT1 Mixer"},
-	{"LOUT2", "NULL", "LOUT2 Mix Amp"},
-	{"ROUT2", "NULL", "ROUT2 Mix Amp"},
-	{"LOUT3", "NULL", "LOUT3 Mixer"},
-	{"ROUT3", "NULL", "ROUT3 Mixer"},
+	{"LOUT1", NULL, "LOUT1 Mixer"},
+	{"ROUT1", NULL, "ROUT1 Mixer"},
+	{"LOUT2", NULL, "LOUT2 Mix Amp"},
+	{"ROUT2", NULL, "ROUT2 Mix Amp"},
+	{"LOUT3", NULL, "LOUT3 Mixer"},
+	{"ROUT3", NULL, "ROUT3 Mixer"},
 
 	{"LOUT1 Mixer", "DACL", "DAC Left"},
 	{"ROUT1 Mixer", "DACR", "DAC Right"},
 	{"LOUT2 Mixer", "DACHL", "DAC Left"},
 	{"ROUT2 Mixer", "DACHR", "DAC Right"},
-	{"LOUT2 Mix Amp", "NULL", "LOUT2 Mixer"},
-	{"ROUT2 Mix Amp", "NULL", "ROUT2 Mixer"},
+	{"LOUT2 Mix Amp", NULL, "LOUT2 Mixer"},
+	{"ROUT2 Mix Amp", NULL, "ROUT2 Mixer"},
 	{"LOUT3 Mixer", "DACSL", "DAC Left"},
 	{"ROUT3 Mixer", "DACSR", "DAC Right"},
 
@@ -381,18 +381,18 @@ static const struct snd_soc_dapm_route ak4671_intercon[] = {
 	{"LIN2", NULL, "Mic Bias"},
 	{"RIN2", NULL, "Mic Bias"},
 
-	{"ADC Left", "NULL", "LIN MUX"},
-	{"ADC Right", "NULL", "RIN MUX"},
+	{"ADC Left", NULL, "LIN MUX"},
+	{"ADC Right", NULL, "RIN MUX"},
 
 	/* Analog Loops */
-	{"LIN1 Mixing Circuit", "NULL", "LIN1"},
-	{"RIN1 Mixing Circuit", "NULL", "RIN1"},
-	{"LIN2 Mixing Circuit", "NULL", "LIN2"},
-	{"RIN2 Mixing Circuit", "NULL", "RIN2"},
-	{"LIN3 Mixing Circuit", "NULL", "LIN3"},
-	{"RIN3 Mixing Circuit", "NULL", "RIN3"},
-	{"LIN4 Mixing Circuit", "NULL", "LIN4"},
-	{"RIN4 Mixing Circuit", "NULL", "RIN4"},
+	{"LIN1 Mixing Circuit", NULL, "LIN1"},
+	{"RIN1 Mixing Circuit", NULL, "RIN1"},
+	{"LIN2 Mixing Circuit", NULL, "LIN2"},
+	{"RIN2 Mixing Circuit", NULL, "RIN2"},
+	{"LIN3 Mixing Circuit", NULL, "LIN3"},
+	{"RIN3 Mixing Circuit", NULL, "RIN3"},
+	{"LIN4 Mixing Circuit", NULL, "LIN4"},
+	{"RIN4 Mixing Circuit", NULL, "RIN4"},
 
 	{"LOUT1 Mixer", "LINL1", "LIN1 Mixing Circuit"},
 	{"ROUT1 Mixer", "RINR1", "RIN1 Mixing Circuit"},

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

* [PATCH 3.16.y-ckt 012/144] ASoC: da732x: Fix control-less DAPM routes
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (10 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 011/144] ASoC: ak4671: Fix control-less DAPM routes Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 013/144] ASoC: sn95031: " Luis Henriques
                   ` (131 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Mark Brown, Luis Henriques

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

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

From: Lars-Peter Clausen <lars@metafoo.de>

commit 8e6a75c102f8e232b599a06e06731d8c5d5f2c5d upstream.

Routes without a control must use NULL for the control name. The da732x
driver uses "NULL" instead in a few places. Previous to commit 5fe5b767dc6f
("ASoC: dapm: Do not pretend to support controls for non mixer/mux widgets")
the DAPM core silently ignored non-NULL controls on non-mixer and non-mux
routes. But starting with that commit it will complain and not add the
route breaking the da732x driver in the process.

This patch replaces the incorrect "NULL" control name with NULL to fix the
issue.

Fixes: 5fe5b767dc6f ("ASoC: dapm: Do not pretend to support controls for non mixer/mux widgets")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/da732x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c
index 2fae31cb0067..4ef7998357fd 100644
--- a/sound/soc/codecs/da732x.c
+++ b/sound/soc/codecs/da732x.c
@@ -877,11 +877,11 @@ static const struct snd_soc_dapm_widget da732x_dapm_widgets[] = {
 
 static const struct snd_soc_dapm_route da732x_dapm_routes[] = {
 	/* Inputs */
-	{"AUX1L PGA", "NULL", "AUX1L"},
-	{"AUX1R PGA", "NULL", "AUX1R"},
+	{"AUX1L PGA", NULL, "AUX1L"},
+	{"AUX1R PGA", NULL, "AUX1R"},
 	{"MIC1 PGA", NULL, "MIC1"},
-	{"MIC2 PGA", "NULL", "MIC2"},
-	{"MIC3 PGA", "NULL", "MIC3"},
+	{"MIC2 PGA", NULL, "MIC2"},
+	{"MIC3 PGA", NULL, "MIC3"},
 
 	/* Capture Path */
 	{"ADC1 Left MUX", "MIC1", "MIC1 PGA"},

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

* [PATCH 3.16.y-ckt 013/144] ASoC: sn95031: Fix control-less DAPM routes
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (11 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 012/144] ASoC: da732x: " Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 014/144] virtio_console: init work unconditionally Luis Henriques
                   ` (130 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Mark Brown, Luis Henriques

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

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

From: Lars-Peter Clausen <lars@metafoo.de>

commit cdd3d2a93f08823a0b9802147dc28c99029dfdfd upstream.

Routes without a control must use NULL for the control name. The sn95031
driver uses "NULL" instead in a few places. Previous to commit 5fe5b767dc6f
("ASoC: dapm: Do not pretend to support controls for non mixer/mux widgets")
the DAPM core silently ignored non-NULL controls on non-mixer and non-mux
routes. But starting with that commit it will complain and not add the
route breaking the sn95031 driver in the process.

This patch replaces the incorrect "NULL" control name with NULL to fix the
issue.

Fixes: 5fe5b767dc6f ("ASoC: dapm: Do not pretend to support controls for non mixer/mux widgets")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/sn95031.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c
index 42dff26b3a2a..6a708055aa15 100644
--- a/sound/soc/codecs/sn95031.c
+++ b/sound/soc/codecs/sn95031.c
@@ -531,8 +531,8 @@ static const struct snd_soc_dapm_route sn95031_audio_map[] = {
 	/* speaker map */
 	{ "IHFOUTL", NULL, "Speaker Rail"},
 	{ "IHFOUTR", NULL, "Speaker Rail"},
-	{ "IHFOUTL", "NULL", "Speaker Left Playback"},
-	{ "IHFOUTR", "NULL", "Speaker Right Playback"},
+	{ "IHFOUTL", NULL, "Speaker Left Playback"},
+	{ "IHFOUTR", NULL, "Speaker Right Playback"},
 	{ "Speaker Left Playback", NULL, "Speaker Left Filter"},
 	{ "Speaker Right Playback", NULL, "Speaker Right Filter"},
 	{ "Speaker Left Filter", NULL, "IHFDAC Left"},

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

* [PATCH 3.16.y-ckt 014/144] virtio_console: init work unconditionally
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (12 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 013/144] ASoC: sn95031: " Luis Henriques
@ 2015-04-21 15:29 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 015/144] virtio_console: avoid config access from irq Luis Henriques
                   ` (129 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:29 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael S. Tsirkin, Rusty Russell, Luis Henriques

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

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

From: "Michael S. Tsirkin" <mst@redhat.com>

commit 4f6e24ed9de8634d6471ef86b382cba6d4e57ca8 upstream.

when multiport is off, we don't initialize config work,
but we then cancel uninitialized control_work on freeze.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/char/virtio_console.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 60aafb8a1f2e..5f6dce6c20fb 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -2024,12 +2024,13 @@ static int virtcons_probe(struct virtio_device *vdev)
 	spin_lock_init(&portdev->ports_lock);
 	INIT_LIST_HEAD(&portdev->ports);
 
+	INIT_WORK(&portdev->control_work, &control_work_handler);
+
 	if (multiport) {
 		unsigned int nr_added_bufs;
 
 		spin_lock_init(&portdev->c_ivq_lock);
 		spin_lock_init(&portdev->c_ovq_lock);
-		INIT_WORK(&portdev->control_work, &control_work_handler);
 
 		nr_added_bufs = fill_queue(portdev->c_ivq,
 					   &portdev->c_ivq_lock);

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

* [PATCH 3.16.y-ckt 015/144] virtio_console: avoid config access from irq
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (13 preceding siblings ...)
  2015-04-21 15:29 ` [PATCH 3.16.y-ckt 014/144] virtio_console: init work unconditionally Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 016/144] clocksource: efm32: Fix a NULL pointer dereference Luis Henriques
                   ` (128 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael S. Tsirkin, Rusty Russell, Luis Henriques

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

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

From: "Michael S. Tsirkin" <mst@redhat.com>

commit eeb8a7e8bb123e84daeef84f5a2eab99ad2839a2 upstream.

when multiport is off, virtio console invokes config access from irq
context, config access is blocking on s390.
Fix this up by scheduling work from config irq - similar to what we do
for multiport configs.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/char/virtio_console.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 5f6dce6c20fb..73294b270b93 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -142,6 +142,7 @@ struct ports_device {
 	 * notification
 	 */
 	struct work_struct control_work;
+	struct work_struct config_work;
 
 	struct list_head ports;
 
@@ -1832,10 +1833,21 @@ static void config_intr(struct virtio_device *vdev)
 
 	portdev = vdev->priv;
 
+	if (!use_multiport(portdev))
+		schedule_work(&portdev->config_work);
+}
+
+static void config_work_handler(struct work_struct *work)
+{
+	struct ports_device *portdev;
+
+	portdev = container_of(work, struct ports_device, control_work);
 	if (!use_multiport(portdev)) {
+		struct virtio_device *vdev;
 		struct port *port;
 		u16 rows, cols;
 
+		vdev = portdev->vdev;
 		virtio_cread(vdev, struct virtio_console_config, cols, &cols);
 		virtio_cread(vdev, struct virtio_console_config, rows, &rows);
 
@@ -2024,6 +2036,7 @@ static int virtcons_probe(struct virtio_device *vdev)
 	spin_lock_init(&portdev->ports_lock);
 	INIT_LIST_HEAD(&portdev->ports);
 
+	INIT_WORK(&portdev->config_work, &config_work_handler);
 	INIT_WORK(&portdev->control_work, &control_work_handler);
 
 	if (multiport) {
@@ -2098,6 +2111,8 @@ static void virtcons_remove(struct virtio_device *vdev)
 	/* Finish up work that's lined up */
 	if (use_multiport(portdev))
 		cancel_work_sync(&portdev->control_work);
+	else
+		cancel_work_sync(&portdev->config_work);
 
 	list_for_each_entry_safe(port, port2, &portdev->ports, list)
 		unplug_port(port);
@@ -2149,6 +2164,7 @@ static int virtcons_freeze(struct virtio_device *vdev)
 
 	virtqueue_disable_cb(portdev->c_ivq);
 	cancel_work_sync(&portdev->control_work);
+	cancel_work_sync(&portdev->config_work);
 	/*
 	 * Once more: if control_work_handler() was running, it would
 	 * enable the cb as the last step.

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

* [PATCH 3.16.y-ckt 016/144] clocksource: efm32: Fix a NULL pointer dereference
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (14 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 015/144] virtio_console: avoid config access from irq Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 017/144] clockevents: sun5i: Fix setup_irq init sequence Luis Henriques
                   ` (127 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yongbae Park, Daniel Lezcano, Luis Henriques

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

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

From: Yongbae Park <yongbae2@gmail.com>

commit 7b8f10da3bf1056546133c9f54f49ce389fd95ab upstream.

The initialisation of the efm32 clocksource first sets up the irq and only
after that initialises the data needed for irq handling. In case this
initialisation is delayed the irq handler would dereference a NULL pointer.

I'm not aware of anything that could delay the process in such a way, but it's
better to be safe than sorry, so setup the irq only when the clock event device
is ready.

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yongbae Park <yongbae2@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clocksource/time-efm32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/time-efm32.c b/drivers/clocksource/time-efm32.c
index bba62f9deefb..ec57ba2bbd87 100644
--- a/drivers/clocksource/time-efm32.c
+++ b/drivers/clocksource/time-efm32.c
@@ -225,12 +225,12 @@ static int __init efm32_clockevent_init(struct device_node *np)
 	clock_event_ddata.base = base;
 	clock_event_ddata.periodic_top = DIV_ROUND_CLOSEST(rate, 1024 * HZ);
 
-	setup_irq(irq, &efm32_clock_event_irq);
-
 	clockevents_config_and_register(&clock_event_ddata.evtdev,
 					DIV_ROUND_CLOSEST(rate, 1024),
 					0xf, 0xffff);
 
+	setup_irq(irq, &efm32_clock_event_irq);
+
 	return 0;
 
 err_get_irq:

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

* [PATCH 3.16.y-ckt 017/144] clockevents: sun5i: Fix setup_irq init sequence
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (15 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 016/144] clocksource: efm32: Fix a NULL pointer dereference Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 018/144] x86/vdso: Fix the build on GCC5 Luis Henriques
                   ` (126 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yongbae Park, Daniel Lezcano, Luis Henriques

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

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

From: Yongbae Park <yongbae2@gmail.com>

commit 1096be084ac59927158ce80ff1d31c33eed0e565 upstream.

The interrupt is enabled before the handler is set. Even this bug
did not appear, it is potentially dangerous as it can lead to a
NULL pointer dereference.

Fix the error by enabling the interrupt after
clockevents_config_and_register() is called.

Signed-off-by: Yongbae Park <yongbae2@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clocksource/timer-sun5i.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c
index 02268448dc85..5dcbf90b8015 100644
--- a/drivers/clocksource/timer-sun5i.c
+++ b/drivers/clocksource/timer-sun5i.c
@@ -178,10 +178,6 @@ static void __init sun5i_timer_init(struct device_node *node)
 
 	ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
 
-	ret = setup_irq(irq, &sun5i_timer_irq);
-	if (ret)
-		pr_warn("failed to setup irq %d\n", irq);
-
 	/* Enable timer0 interrupt */
 	val = readl(timer_base + TIMER_IRQ_EN_REG);
 	writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG);
@@ -191,6 +187,10 @@ static void __init sun5i_timer_init(struct device_node *node)
 
 	clockevents_config_and_register(&sun5i_clockevent, rate,
 					TIMER_SYNC_TICKS, 0xffffffff);
+
+	ret = setup_irq(irq, &sun5i_timer_irq);
+	if (ret)
+		pr_warn("failed to setup irq %d\n", irq);
 }
 CLOCKSOURCE_OF_DECLARE(sun5i_a13, "allwinner,sun5i-a13-hstimer",
 		       sun5i_timer_init);

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

* [PATCH 3.16.y-ckt 018/144] x86/vdso: Fix the build on GCC5
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (16 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 017/144] clockevents: sun5i: Fix setup_irq init sequence Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 019/144] ASoC: sgtl5000: remove useless register write clearing CHRGPUMP_POWERUP Luis Henriques
                   ` (125 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Slaby, Borislav Petkov, H. Peter Anvin, Linus Torvalds,
	Thomas Gleixner, Ingo Molnar, Luis Henriques

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

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

From: Jiri Slaby <jslaby@suse.cz>

commit e893286918d2cde3a94850d8f7101cd1039e0c62 upstream.

On gcc5 the kernel does not link:

  ld: .eh_frame_hdr table[4] FDE at 0000000000000648 overlaps table[5] FDE at 0000000000000670.

Because prior GCC versions always emitted NOPs on ALIGN directives, but
gcc5 started omitting them.

.LSTARTFDEDLSI1 says:

        /* HACK: The dwarf2 unwind routines will subtract 1 from the
           return address to get an address in the middle of the
           presumed call instruction.  Since we didn't get here via
           a call, we need to include the nop before the real start
           to make up for it.  */
        .long .LSTART_sigreturn-1-.     /* PC-relative start address */

But commit 69d0627a7f6e ("x86 vDSO: reorder vdso32 code") from 2.6.25
replaced .org __kernel_vsyscall+32,0x90 by ALIGN right before
__kernel_sigreturn.

Of course, ALIGN need not generate any NOP in there. Esp. gcc5 collapses
vclock_gettime.o and int80.o together with no generated NOPs as "ALIGN".

So fix this by adding to that point at least a single NOP and make the
function ALIGN possibly with more NOPs then.

Kudos for reporting and diagnosing should go to Richard.

Reported-by: Richard Biener <rguenther@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1425543211-12542-1-git-send-email-jslaby@suse.cz
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/vdso/vdso32/sigreturn.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S
index 31776d0efc8c..d7ec4e251c0a 100644
--- a/arch/x86/vdso/vdso32/sigreturn.S
+++ b/arch/x86/vdso/vdso32/sigreturn.S
@@ -17,6 +17,7 @@
 	.text
 	.globl __kernel_sigreturn
 	.type __kernel_sigreturn,@function
+	nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
 	ALIGN
 __kernel_sigreturn:
 .LSTART_sigreturn:

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

* [PATCH 3.16.y-ckt 019/144] ASoC: sgtl5000: remove useless register write clearing CHRGPUMP_POWERUP
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (17 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 018/144] x86/vdso: Fix the build on GCC5 Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 020/144] regmap: regcache-rbtree: Fix present bitmap resize Luis Henriques
                   ` (124 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eric Nelson, Mark Brown, Luis Henriques

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

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

From: Eric Nelson <eric.nelson@boundarydevices.com>

commit c7d910b87d3c8e9fcf4077089ca4327c12eee099 upstream.

The SGTL5000_CHIP_ANA_POWER register is cached. Update the cached
value instead of writing it directly.

Patch inspired by Russell King's more colorful remarks in this
patch:
	https://github.com/SolidRun/linux-imx6-3.14/commit/dd4bf6a

Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/sgtl5000.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index a62d340aa98a..31281d24e009 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1155,13 +1155,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
 		/* Enable VDDC charge pump */
 		ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP;
 	} else if (vddio >= 3100 && vdda >= 3100) {
-		/*
-		 * if vddio and vddd > 3.1v,
-		 * charge pump should be clean before set ana_pwr
-		 */
-		snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
-				SGTL5000_VDDC_CHRGPMP_POWERUP, 0);
-
+		ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP;
 		/* VDDC use VDDIO rail */
 		lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;
 		lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO <<

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

* [PATCH 3.16.y-ckt 020/144] regmap: regcache-rbtree: Fix present bitmap resize
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (18 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 019/144] ASoC: sgtl5000: remove useless register write clearing CHRGPUMP_POWERUP Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 021/144] regulator: Only enable disabled regulators on resume Luis Henriques
                   ` (123 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Mark Brown, Luis Henriques

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

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

From: Lars-Peter Clausen <lars@metafoo.de>

commit 328f494d95aac8bd4896aea2328bc281053bcb71 upstream.

When inserting a new register into a block at the lower end the present
bitmap is currently shifted into the wrong direction. The effect of this is
that the bitmap becomes corrupted and registers which are present might be
reported as not present and vice versa.

Fix this by shifting left rather than right.

Fixes: 472fdec7380c("regmap: rbtree: Reduce number of nodes, take 2")
Reported-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/base/regmap/regcache-rbtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index f3e8fe0cc650..9d09c5bb5874 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -307,7 +307,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
 	if (pos == 0) {
 		memmove(blk + offset * map->cache_word_size,
 			blk, rbnode->blklen * map->cache_word_size);
-		bitmap_shift_right(present, present, offset, blklen);
+		bitmap_shift_left(present, present, offset, blklen);
 	}
 
 	/* update the rbnode block, its size and the base register */

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

* [PATCH 3.16.y-ckt 021/144] regulator: Only enable disabled regulators on resume
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (19 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 020/144] regmap: regcache-rbtree: Fix present bitmap resize Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 022/144] regulator: core: Fix enable GPIO reference counting Luis Henriques
                   ` (122 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Javier Martinez Canillas, Mark Brown, Luis Henriques

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

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

From: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

commit 0548bf4f5ad6fc3bd93c4940fa48078b34609682 upstream.

The _regulator_do_enable() call ought to be a no-op when called on an
already-enabled regulator.  However, as an optimization
_regulator_enable() doesn't call _regulator_do_enable() on an already
enabled regulator.  That means we never test the case of calling
_regulator_do_enable() during normal usage and there may be hidden
bugs or warnings.  We have seen warnings issued by the tps65090 driver
and bugs when using the GPIO enable pin.

Let's match the same optimization that _regulator_enable() in
regulator_suspend_finish().  That may speed up suspend/resume and also
avoids exposing hidden bugs.

[Use much clearer commit message from Doug Anderson]

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/regulator/core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b4686ea6d66b..0d3723797fbd 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3657,9 +3657,11 @@ int regulator_suspend_finish(void)
 	list_for_each_entry(rdev, &regulator_list, list) {
 		mutex_lock(&rdev->mutex);
 		if (rdev->use_count > 0  || rdev->constraints->always_on) {
-			error = _regulator_do_enable(rdev);
-			if (error)
-				ret = error;
+			if (!_regulator_is_enabled(rdev)) {
+				error = _regulator_do_enable(rdev);
+				if (error)
+					ret = error;
+			}
 		} else {
 			if (!have_full_constraints())
 				goto unlock;

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

* [PATCH 3.16.y-ckt 022/144] regulator: core: Fix enable GPIO reference counting
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (20 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 021/144] regulator: Only enable disabled regulators on resume Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 023/144] Input: psmouse - add psmouse_matches_pnp_id helper function Luis Henriques
                   ` (121 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Doug Anderson, Mark Brown, Luis Henriques

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

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

From: Doug Anderson <dianders@chromium.org>

commit 29d62ec5f87fbeec8413e2215ddad12e7f972e4c upstream.

Normally _regulator_do_enable() isn't called on an already-enabled
rdev.  That's because the main caller, _regulator_enable() always
calls _regulator_is_enabled() and only calls _regulator_do_enable() if
the rdev was not already enabled.

However, there is one caller of _regulator_do_enable() that doesn't
check: regulator_suspend_finish().  While we might want to make
regulator_suspend_finish() behave more like _regulator_enable(), it's
probably also a good idea to make _regulator_do_enable() robust if it
is called on an already enabled rdev.

At the moment, _regulator_do_enable() is _not_ robust for already
enabled rdevs if we're using an ena_pin.  Each time
_regulator_do_enable() is called for an rdev using an ena_pin the
reference count of the ena_pin is incremented even if the rdev was
already enabled.  This is not as intended because the ena_pin is for
something else: for keeping track of how many active rdevs there are
sharing the same ena_pin.

Here's how the reference counting works here:

* Each time _regulator_enable() is called we increment
  rdev->use_count, so _regulator_enable() calls need to be balanced
  with _regulator_disable() calls.

* There is no explicit reference counting in _regulator_do_enable()
  which is normally just a warapper around rdev->desc->ops->enable()
  with code for supporting delays.  It's not expected that the
  "ops->enable()" call do reference counting.

* Since regulator_ena_gpio_ctrl() does have reference counting
  (handling the sharing of the pin amongst multiple rdevs), we
  shouldn't call it if the current rdev is already enabled.

Note that as part of this we cleanup (remove) the initting of
ena_gpio_state in regulator_register().  In _regulator_do_enable(),
_regulator_do_disable() and _regulator_is_enabled() is is clear that
ena_gpio_state should be the state of whether this particular rdev has
requested the GPIO be enabled.  regulator_register() was initting it
as the actual state of the pin.

Fixes: 967cfb18c0e3 ("regulator: core: manage enable GPIO list")
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/regulator/core.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0d3723797fbd..efeb4b42c5ed 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1771,10 +1771,12 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
 	trace_regulator_enable(rdev_get_name(rdev));
 
 	if (rdev->ena_pin) {
-		ret = regulator_ena_gpio_ctrl(rdev, true);
-		if (ret < 0)
-			return ret;
-		rdev->ena_gpio_state = 1;
+		if (!rdev->ena_gpio_state) {
+			ret = regulator_ena_gpio_ctrl(rdev, true);
+			if (ret < 0)
+				return ret;
+			rdev->ena_gpio_state = 1;
+		}
 	} else if (rdev->desc->ops->enable) {
 		ret = rdev->desc->ops->enable(rdev);
 		if (ret < 0)
@@ -1904,10 +1906,12 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
 	trace_regulator_disable(rdev_get_name(rdev));
 
 	if (rdev->ena_pin) {
-		ret = regulator_ena_gpio_ctrl(rdev, false);
-		if (ret < 0)
-			return ret;
-		rdev->ena_gpio_state = 0;
+		if (rdev->ena_gpio_state) {
+			ret = regulator_ena_gpio_ctrl(rdev, false);
+			if (ret < 0)
+				return ret;
+			rdev->ena_gpio_state = 0;
+		}
 
 	} else if (rdev->desc->ops->disable) {
 		ret = rdev->desc->ops->disable(rdev);
@@ -3479,12 +3483,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
 				 config->ena_gpio, ret);
 			goto wash;
 		}
-
-		if (config->ena_gpio_flags & GPIOF_OUT_INIT_HIGH)
-			rdev->ena_gpio_state = 1;
-
-		if (config->ena_gpio_invert)
-			rdev->ena_gpio_state = !rdev->ena_gpio_state;
 	}
 
 	/* set regulator constraints */

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

* [PATCH 3.16.y-ckt 023/144] Input: psmouse - add psmouse_matches_pnp_id helper function
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (21 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 022/144] regulator: core: Fix enable GPIO reference counting Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 024/144] Input: synaptics - split synaptics_resolution(), query first Luis Henriques
                   ` (120 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Luis Henriques

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

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

From: Hans de Goede <hdegoede@redhat.com>

commit 2c75ada6250990ea859b0b5498cb0b7c2823a9d7 upstream.

The matches_pnp_id function from the synaptics driver is useful for other
drivers too. Make it a generic psmouse helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ luis: 3.16-stable prereq for:
  8b04baba10b0 "Input: synaptics - split synaptics_resolution(), query first" ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/psmouse-base.c | 14 ++++++++++++++
 drivers/input/mouse/psmouse.h      |  1 +
 drivers/input/mouse/synaptics.c    | 17 +++--------------
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index cff065f6261c..bc1bc2653f15 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -462,6 +462,20 @@ static int psmouse_poll(struct psmouse *psmouse)
 			   PSMOUSE_CMD_POLL | (psmouse->pktsize << 8));
 }
 
+/*
+ * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids.
+ */
+bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
+{
+	int i;
+
+	if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
+		for (i = 0; ids[i]; i++)
+			if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
+				return true;
+
+	return false;
+}
 
 /*
  * Genius NetMouse magic init.
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 2f0b39d59a9b..f4cf664c7db3 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -108,6 +108,7 @@ void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution);
 psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse);
 int psmouse_activate(struct psmouse *psmouse);
 int psmouse_deactivate(struct psmouse *psmouse);
+bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]);
 
 struct psmouse_attribute {
 	struct device_attribute dattr;
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index e5feafb0949f..30eabf9f7086 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -188,18 +188,6 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	NULL
 };
 
-static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
-{
-	int i;
-
-	if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
-		for (i = 0; ids[i]; i++)
-			if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
-				return true;
-
-	return false;
-}
-
 /*****************************************************************************
  *	Synaptics communications functions
  ****************************************************************************/
@@ -365,7 +353,8 @@ static int synaptics_resolution(struct psmouse *psmouse)
 	}
 
 	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
-		if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
+		if (psmouse_matches_pnp_id(psmouse,
+					   min_max_pnpid_table[i].pnp_ids)) {
 			priv->x_min = min_max_pnpid_table[i].x_min;
 			priv->x_max = min_max_pnpid_table[i].x_max;
 			priv->y_min = min_max_pnpid_table[i].y_min;
@@ -1448,7 +1437,7 @@ static void set_input_params(struct psmouse *psmouse,
 
 	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
 		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
-		if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
+		if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
 			__set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
 		/* Clickpads report only left button */
 		__clear_bit(BTN_RIGHT, dev->keybit);

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

* [PATCH 3.16.y-ckt 024/144] Input: synaptics - split synaptics_resolution(), query first
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (22 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 023/144] Input: psmouse - add psmouse_matches_pnp_id helper function Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 025/144] Input: synaptics - log queried and quirked dimension values Luis Henriques
                   ` (119 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Luis Henriques

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

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

From: Daniel Martin <consume.noise@gmail.com>

commit 8b04baba10b007f8b6c245a50be73cf09cc3a414 upstream.

Split the function synaptics_resolution() into synaptics_resolution() and
synaptics_quirks().  synaptics_resolution() will be called before
synaptics_quirks() to query dimensions and resolutions before overwriting
them with quirks.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 30eabf9f7086..bb097facf7f1 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -340,7 +340,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
 {
 	struct synaptics_data *priv = psmouse->private;
 	unsigned char resp[3];
-	int i;
 
 	if (SYN_ID_MAJOR(priv->identity) < 4)
 		return 0;
@@ -352,17 +351,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
 		}
 	}
 
-	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
-		if (psmouse_matches_pnp_id(psmouse,
-					   min_max_pnpid_table[i].pnp_ids)) {
-			priv->x_min = min_max_pnpid_table[i].x_min;
-			priv->x_max = min_max_pnpid_table[i].x_max;
-			priv->y_min = min_max_pnpid_table[i].y_min;
-			priv->y_max = min_max_pnpid_table[i].y_max;
-			return 0;
-		}
-	}
-
 	if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
 	    SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
 		if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
@@ -388,6 +376,27 @@ static int synaptics_resolution(struct psmouse *psmouse)
 	return 0;
 }
 
+/*
+ * Apply quirk(s) if the hardware matches
+ */
+
+static void synaptics_apply_quirks(struct psmouse *psmouse)
+{
+	struct synaptics_data *priv = psmouse->private;
+	int i;
+
+	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
+		if (psmouse_matches_pnp_id(psmouse,
+					   min_max_pnpid_table[i].pnp_ids)) {
+			priv->x_min = min_max_pnpid_table[i].x_min;
+			priv->x_max = min_max_pnpid_table[i].x_max;
+			priv->y_min = min_max_pnpid_table[i].y_min;
+			priv->y_max = min_max_pnpid_table[i].y_max;
+			break;
+		}
+	}
+}
+
 static int synaptics_query_hardware(struct psmouse *psmouse)
 {
 	if (synaptics_identify(psmouse))
@@ -403,6 +412,8 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
 	if (synaptics_resolution(psmouse))
 		return -1;
 
+	synaptics_apply_quirks(psmouse);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 025/144] Input: synaptics - log queried and quirked dimension values
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (23 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 024/144] Input: synaptics - split synaptics_resolution(), query first Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 026/144] Input: synaptics - query min dimensions for fw v8.1 Luis Henriques
                   ` (118 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Luis Henriques

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

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

From: Daniel Martin <consume.noise@gmail.com>

commit 9aff65982d0f58a78a27769fba7e97bc937b2593 upstream.

Logging the dimension values we queried and the values we use from a quirk
to overwrite can be helpful for debugging.

This partly relates to bug:
    https://bugzilla.kernel.org/show_bug.cgi?id=91541

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index bb097facf7f1..9240d6fa0c6d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -359,6 +359,9 @@ static int synaptics_resolution(struct psmouse *psmouse)
 		} else {
 			priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
 			priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
+			psmouse_info(psmouse,
+				     "queried max coordinates: x [..%d], y [..%d]\n",
+				     priv->x_max, priv->y_max);
 		}
 	}
 
@@ -370,6 +373,9 @@ static int synaptics_resolution(struct psmouse *psmouse)
 		} else {
 			priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
 			priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
+			psmouse_info(psmouse,
+				     "queried min coordinates: x [%d..], y [%d..]\n",
+				     priv->x_min, priv->y_min);
 		}
 	}
 
@@ -392,6 +398,10 @@ static void synaptics_apply_quirks(struct psmouse *psmouse)
 			priv->x_max = min_max_pnpid_table[i].x_max;
 			priv->y_min = min_max_pnpid_table[i].y_min;
 			priv->y_max = min_max_pnpid_table[i].y_max;
+			psmouse_info(psmouse,
+				     "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n",
+				     priv->x_min, priv->x_max,
+				     priv->y_min, priv->y_max);
 			break;
 		}
 	}

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

* [PATCH 3.16.y-ckt 026/144] Input: synaptics - query min dimensions for fw v8.1
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (24 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 025/144] Input: synaptics - log queried and quirked dimension values Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 027/144] Input: synaptics - remove obsolete min/max quirk for X240 Luis Henriques
                   ` (117 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Benjamin Tissoires, Dmitry Torokhov, Luis Henriques

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

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

From: Daniel Martin <consume.noise@gmail.com>

commit ac097930f0730a9b777737de2b51e0fc49d2be7a upstream.

Query the min dimensions even if the check
SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 fails, but we know that the
firmware version 8.1 is safe.

With that we don't need quirks for post-2013 models anymore as they expose
correct min and max dimensions.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
  re-order the tests to check SYN_CAP_MIN_DIMENSIONS even on FW 8.1
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 9240d6fa0c6d..9273eaf3e93e 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -365,8 +365,14 @@ static int synaptics_resolution(struct psmouse *psmouse)
 		}
 	}
 
-	if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
-	    SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
+	if (SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c) &&
+	    (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 ||
+	     /*
+	      * Firmware v8.1 does not report proper number of extended
+	      * capabilities, but has been proven to report correct min
+	      * coordinates.
+	      */
+	     SYN_ID_FULL(priv->identity) == 0x801)) {
 		if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
 			psmouse_warn(psmouse,
 				     "device claims to have min coordinates query, but I'm not able to read it.\n");

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

* [PATCH 3.16.y-ckt 027/144] Input: synaptics - remove obsolete min/max quirk for X240
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (25 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 026/144] Input: synaptics - query min dimensions for fw v8.1 Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 028/144] Input: synaptics - support min/max board id in min_max_pnpid_table Luis Henriques
                   ` (116 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Luis Henriques

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

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

From: Daniel Martin <consume.noise@gmail.com>

commit b05f4d1c332a22f98c037fa64f249aa30877adaf upstream.

The firmware of the X240 (LEN0035, 2013/12) exposes the same values
    x [1232..5710], y [1156..4696]
as the quirk applies.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 9273eaf3e93e..5dc113a8c48d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -128,7 +128,7 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		1024, 5052, 2258, 4832
 	},
 	{
-		(const char * const []){"LEN0035", "LEN0042", NULL},
+		(const char * const []){"LEN0042", NULL},
 		1232, 5710, 1156, 4696
 	},
 	{

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

* [PATCH 3.16.y-ckt 028/144] Input: synaptics - support min/max board id in min_max_pnpid_table
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (26 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 027/144] Input: synaptics - remove obsolete min/max quirk for X240 Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 029/144] Input: synaptics - skip quirks when post-2013 dimensions Luis Henriques
                   ` (115 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Luis Henriques

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

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

From: Daniel Martin <daniel.martin@secunet.com>

commit 5b3089ddb540401c1ad2e385a03d7e89ff954585 upstream.

Add a min/max range for board ids to the min/max coordinates quirk. This
makes it possible to restrict quirks to specific models based upon their
board id. The define ANY_BOARD_ID (0) serves as a wild card.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541

Signed-off-by: Daniel Martin <daniel.martin@secunet.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 43 +++++++++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 5dc113a8c48d..8f37989908a8 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -117,32 +117,42 @@ void synaptics_reset(struct psmouse *psmouse)
 }
 
 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+
+#define ANY_BOARD_ID 0
 struct min_max_quirk {
 	const char * const *pnp_ids;
+	struct {
+		unsigned long int min, max;
+	} board_id;
 	int x_min, x_max, y_min, y_max;
 };
 
 static const struct min_max_quirk min_max_pnpid_table[] = {
 	{
 		(const char * const []){"LEN0033", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1024, 5052, 2258, 4832
 	},
 	{
 		(const char * const []){"LEN0042", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1232, 5710, 1156, 4696
 	},
 	{
 		(const char * const []){"LEN0034", "LEN0036", "LEN0037",
 					"LEN0039", "LEN2002", "LEN2004",
 					NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1024, 5112, 2024, 4832
 	},
 	{
 		(const char * const []){"LEN2001", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1024, 5022, 2508, 4832
 	},
 	{
 		(const char * const []){"LEN2006", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1264, 5675, 1171, 4688
 	},
 	{ }
@@ -398,18 +408,27 @@ static void synaptics_apply_quirks(struct psmouse *psmouse)
 	int i;
 
 	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
-		if (psmouse_matches_pnp_id(psmouse,
-					   min_max_pnpid_table[i].pnp_ids)) {
-			priv->x_min = min_max_pnpid_table[i].x_min;
-			priv->x_max = min_max_pnpid_table[i].x_max;
-			priv->y_min = min_max_pnpid_table[i].y_min;
-			priv->y_max = min_max_pnpid_table[i].y_max;
-			psmouse_info(psmouse,
-				     "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n",
-				     priv->x_min, priv->x_max,
-				     priv->y_min, priv->y_max);
-			break;
-		}
+		if (!psmouse_matches_pnp_id(psmouse,
+					    min_max_pnpid_table[i].pnp_ids))
+			continue;
+
+		if (min_max_pnpid_table[i].board_id.min != ANY_BOARD_ID &&
+		    priv->board_id < min_max_pnpid_table[i].board_id.min)
+			continue;
+
+		if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID &&
+		    priv->board_id > min_max_pnpid_table[i].board_id.max)
+			continue;
+
+		priv->x_min = min_max_pnpid_table[i].x_min;
+		priv->x_max = min_max_pnpid_table[i].x_max;
+		priv->y_min = min_max_pnpid_table[i].y_min;
+		priv->y_max = min_max_pnpid_table[i].y_max;
+		psmouse_info(psmouse,
+			     "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n",
+			     priv->x_min, priv->x_max,
+			     priv->y_min, priv->y_max);
+		break;
 	}
 }
 

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

* [PATCH 3.16.y-ckt 029/144] Input: synaptics - skip quirks when post-2013 dimensions
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (27 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 028/144] Input: synaptics - support min/max board id in min_max_pnpid_table Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 030/144] Input: synaptics - fix middle button on Lenovo 2015 products Luis Henriques
                   ` (114 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Dmitry Torokhov, Luis Henriques

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

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

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

commit 02e07492cdfae9c86e3bd21c0beec88dbcc1e9e8 upstream.

Post-2013 Lenovo laptops provide correct min/max dimensions, which are
different with the ones currently quirked.  According to
https://bugzilla.kernel.org/show_bug.cgi?id=91541 the following board ids
are assigned in the post-2013 touchpads:

t440p/t440s: LEN0036 -> 2964/2962
t540p:       LEN0034 -> 2964

Using 2961 as the common minimum makes these 3 laptops OK. We may need
to update those values later if other pnp_ids has a lower board_id.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 8f37989908a8..5d9e1cba62c0 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -142,7 +142,7 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		(const char * const []){"LEN0034", "LEN0036", "LEN0037",
 					"LEN0039", "LEN2002", "LEN2004",
 					NULL},
-		{ANY_BOARD_ID, ANY_BOARD_ID},
+		{ANY_BOARD_ID, 2961},
 		1024, 5112, 2024, 4832
 	},
 	{

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

* [PATCH 3.16.y-ckt 030/144] Input: synaptics - fix middle button on Lenovo 2015 products
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (28 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 029/144] Input: synaptics - skip quirks when post-2013 dimensions Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 031/144] Input: synaptics - handle spurious release of trackstick buttons Luis Henriques
                   ` (113 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Dmitry Torokhov, Luis Henriques

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

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

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

commit dc5465dc8a6d5cae8a0e1d8826bdcb2e4cb261ab upstream.

On the X1 Carbon 3rd gen (with a 2015 broadwell cpu), the physical middle
button of the trackstick (attached to the touchpad serio device, of course)
seems to get lost.

Actually, the touchpads reports 3 extra buttons, which falls in the switch
below to the '2' case. Let's handle the case of odd numbers also, so that
the middle button finds its way back.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 44 ++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 5d9e1cba62c0..f958a231a24f 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -656,6 +656,18 @@ static void synaptics_parse_agm(const unsigned char buf[],
 	priv->agm_pending = true;
 }
 
+static void synaptics_parse_ext_buttons(const unsigned char buf[],
+					struct synaptics_data *priv,
+					struct synaptics_hw_state *hw)
+{
+	unsigned int ext_bits =
+		(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
+	unsigned int ext_mask = GENMASK(ext_bits - 1, 0);
+
+	hw->ext_buttons = buf[4] & ext_mask;
+	hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits;
+}
+
 static bool is_forcepad;
 
 static int synaptics_parse_hw_state(const unsigned char buf[],
@@ -742,28 +754,9 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
 			hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
 		}
 
-		if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) &&
+		if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 0 &&
 		    ((buf[0] ^ buf[3]) & 0x02)) {
-			switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {
-			default:
-				/*
-				 * if nExtBtn is greater than 8 it should be
-				 * considered invalid and treated as 0
-				 */
-				break;
-			case 8:
-				hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0;
-				hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0;
-			case 6:
-				hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0;
-				hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0;
-			case 4:
-				hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0;
-				hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0;
-			case 2:
-				hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0;
-				hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0;
-			}
+			synaptics_parse_ext_buttons(buf, priv, hw);
 		}
 	} else {
 		hw->x = (((buf[1] & 0x1f) << 8) | buf[2]);
@@ -830,6 +823,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
 {
 	struct input_dev *dev = psmouse->dev;
 	struct synaptics_data *priv = psmouse->private;
+	int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
 	int i;
 
 	input_report_key(dev, BTN_LEFT, hw->left);
@@ -843,8 +837,12 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
 		input_report_key(dev, BTN_BACK, hw->down);
 	}
 
-	for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
-		input_report_key(dev, BTN_0 + i, hw->ext_buttons & (1 << i));
+	for (i = 0; i < ext_bits; i++) {
+		input_report_key(dev, BTN_0 + 2 * i,
+				 hw->ext_buttons & (1 << i));
+		input_report_key(dev, BTN_1 + 2 * i,
+				 hw->ext_buttons & (1 << (i + ext_bits)));
+	}
 }
 
 static void synaptics_report_slot(struct input_dev *dev, int slot,

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

* [PATCH 3.16.y-ckt 031/144] Input: synaptics - handle spurious release of trackstick buttons
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (29 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 030/144] Input: synaptics - fix middle button on Lenovo 2015 products Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 032/144] Input: synaptics - do not retrieve the board id on old firmwares Luis Henriques
                   ` (112 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Dmitry Torokhov, Luis Henriques

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

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

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

commit ebc80840b850db72f7ae84fbcf77630ae5409629 upstream.

The Fimware 8.1 has a bug in which the extra buttons are only sent when the
ExtBit is 1.  This should be fixed in a future FW update which should have
a bump of the minor version.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index f958a231a24f..367a9457547d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -818,14 +818,36 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev,
 	}
 }
 
-static void synaptics_report_buttons(struct psmouse *psmouse,
-				     const struct synaptics_hw_state *hw)
+static void synaptics_report_ext_buttons(struct psmouse *psmouse,
+					 const struct synaptics_hw_state *hw)
 {
 	struct input_dev *dev = psmouse->dev;
 	struct synaptics_data *priv = psmouse->private;
 	int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
 	int i;
 
+	if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
+		return;
+
+	/* Bug in FW 8.1, buttons are reported only when ExtBit is 1 */
+	if (SYN_ID_FULL(priv->identity) == 0x801 &&
+	    !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
+		return;
+
+	for (i = 0; i < ext_bits; i++) {
+		input_report_key(dev, BTN_0 + 2 * i,
+			hw->ext_buttons & (1 << i));
+		input_report_key(dev, BTN_1 + 2 * i,
+			hw->ext_buttons & (1 << (i + ext_bits)));
+	}
+}
+
+static void synaptics_report_buttons(struct psmouse *psmouse,
+				     const struct synaptics_hw_state *hw)
+{
+	struct input_dev *dev = psmouse->dev;
+	struct synaptics_data *priv = psmouse->private;
+
 	input_report_key(dev, BTN_LEFT, hw->left);
 	input_report_key(dev, BTN_RIGHT, hw->right);
 
@@ -837,12 +859,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
 		input_report_key(dev, BTN_BACK, hw->down);
 	}
 
-	for (i = 0; i < ext_bits; i++) {
-		input_report_key(dev, BTN_0 + 2 * i,
-				 hw->ext_buttons & (1 << i));
-		input_report_key(dev, BTN_1 + 2 * i,
-				 hw->ext_buttons & (1 << (i + ext_bits)));
-	}
+	synaptics_report_ext_buttons(psmouse, hw);
 }
 
 static void synaptics_report_slot(struct input_dev *dev, int slot,

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

* [PATCH 3.16.y-ckt 032/144] Input: synaptics - do not retrieve the board id on old firmwares
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (30 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 031/144] Input: synaptics - handle spurious release of trackstick buttons Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 033/144] vt6655: RFbSetPower fix missing rate RATE_12M Luis Henriques
                   ` (111 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Dmitry Torokhov, Luis Henriques

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

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

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

commit b57a7128be24062b5b5b26032b7cd58f1651547e upstream.

The board id capability has been added in firmware 7.5.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/synaptics.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 367a9457547d..6d04d199b6be 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -248,6 +248,10 @@ static int synaptics_board_id(struct psmouse *psmouse)
 	struct synaptics_data *priv = psmouse->private;
 	unsigned char bid[3];
 
+	/* firmwares prior 7.5 have no board_id encoded */
+	if (SYN_ID_FULL(priv->identity) < 0x705)
+		return 0;
+
 	if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
 		return -1;
 	priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];

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

* [PATCH 3.16.y-ckt 033/144] vt6655: RFbSetPower fix missing rate RATE_12M
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (31 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 032/144] Input: synaptics - do not retrieve the board id on old firmwares Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 034/144] x86/asm/entry/32: Fix user_mode() misuses Luis Henriques
                   ` (110 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Malcolm Priestley, Greg Kroah-Hartman, Luis Henriques

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

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

From: Malcolm Priestley <tvboxspy@gmail.com>

commit 40c8790bcb7ac74f3038153cd09310e220c6a1df upstream.

When the driver sets this rate a power of zero value is set causing
data flow stoppage until another rate is tried.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/vt6655/rf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index 99c89a14d89b..dff8d47d65d8 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -923,6 +923,7 @@ bool RFbSetPower(
 		break;
 	case RATE_6M:
 	case RATE_9M:
+	case RATE_12M:
 	case RATE_18M:
 		byPwr = pDevice->abyOFDMPwrTbl[uCH];
 		if (pDevice->byRFType == RF_UW2452)

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

* [PATCH 3.16.y-ckt 034/144] x86/asm/entry/32: Fix user_mode() misuses
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (32 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 033/144] vt6655: RFbSetPower fix missing rate RATE_12M Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 035/144] ASoC: adav80x: Fix wrong value references for boolean kctl Luis Henriques
                   ` (109 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Lutomirski, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Linus Torvalds, Thomas Gleixner, Ingo Molnar, Luis Henriques

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

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

From: Andy Lutomirski <luto@amacapital.net>

commit 394838c96013ba414a24ffe7a2a593a9154daadf upstream.

The one in do_debug() is probably harmless, but better safe than sorry.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/d67deaa9df5458363623001f252d1aee3215d014.1425948056.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[ luis: backported to 3.16:
  - drop changes to do_bounds() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 07ab8e9733c5..871f43ae47ef 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -483,7 +483,7 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
 	 * then it's very likely the result of an icebp/int01 trap.
 	 * User wants a sigtrap for that.
 	 */
-	if (!dr6 && user_mode(regs))
+	if (!dr6 && user_mode_vm(regs))
 		user_icebp = 1;
 
 	/* Catch kmemcheck conditions first of all! */

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

* [PATCH 3.16.y-ckt 035/144] ASoC: adav80x: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (33 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 034/144] x86/asm/entry/32: Fix user_mode() misuses Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 036/144] ASoC: ak4641: " Luis Henriques
                   ` (108 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 2bf4c1d483d911cda5dd385527194d23e5cea73d upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/adav80x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index c43b93fdf0df..41da62f7250c 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -317,7 +317,7 @@ static int adav80x_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
-	unsigned int deemph = ucontrol->value.enumerated.item[0];
+	unsigned int deemph = ucontrol->value.integer.value[0];
 
 	if (deemph > 1)
 		return -EINVAL;
@@ -333,7 +333,7 @@ static int adav80x_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = adav80x->deemph;
+	ucontrol->value.integer.value[0] = adav80x->deemph;
 	return 0;
 };
 

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

* [PATCH 3.16.y-ckt 036/144] ASoC: ak4641: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (34 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 035/144] ASoC: adav80x: Fix wrong value references for boolean kctl Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 037/144] ASoC: cs4271: " Luis Henriques
                   ` (107 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 08641d9b7bf915144a57a736b42642e13eb1167f upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/ak4641.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 7afe8f482088..570ec04fe411 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -76,7 +76,7 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec);
-	int deemph = ucontrol->value.enumerated.item[0];
+	int deemph = ucontrol->value.integer.value[0];
 
 	if (deemph > 1)
 		return -EINVAL;
@@ -92,7 +92,7 @@ static int ak4641_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = ak4641->deemph;
+	ucontrol->value.integer.value[0] = ak4641->deemph;
 	return 0;
 };
 

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

* [PATCH 3.16.y-ckt 037/144] ASoC: cs4271: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (35 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 036/144] ASoC: ak4641: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 038/144] ASoC: pcm1681: " Luis Henriques
                   ` (106 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit e8371aa0fecb73fb8a4b2e0296b025b11e7d6229 upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Paul Handrigan <Paul.Handrigan@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/cs4271.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 93cec52f4733..6ec074fec068 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -287,7 +287,7 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = cs4271->deemph;
+	ucontrol->value.integer.value[0] = cs4271->deemph;
 	return 0;
 }
 
@@ -297,7 +297,7 @@ static int cs4271_put_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
 
-	cs4271->deemph = ucontrol->value.enumerated.item[0];
+	cs4271->deemph = ucontrol->value.integer.value[0];
 	return cs4271_set_deemph(codec);
 }
 

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

* [PATCH 3.16.y-ckt 038/144] ASoC: pcm1681: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (36 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 037/144] ASoC: cs4271: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 039/144] ASoC: tas5086: " Luis Henriques
                   ` (105 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit d7f58db49d9ad92bdb12d21fdc2308b76bc2ed38 upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/pcm1681.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index a722a023c262..477e13d30971 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -118,7 +118,7 @@ static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = priv->deemph;
+	ucontrol->value.integer.value[0] = priv->deemph;
 
 	return 0;
 }
@@ -129,7 +129,7 @@ static int pcm1681_put_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec);
 
-	priv->deemph = ucontrol->value.enumerated.item[0];
+	priv->deemph = ucontrol->value.integer.value[0];
 
 	return pcm1681_set_deemph(codec);
 }

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

* [PATCH 3.16.y-ckt 039/144] ASoC: tas5086: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (37 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 038/144] ASoC: pcm1681: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 040/144] ASoC: wm2000: " Luis Henriques
                   ` (104 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 4c523ef61160b7d478371ddc9f48c8ce0a00d675 upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/tas5086.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index d48491a4a19d..822e77c796ca 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -275,7 +275,7 @@ static int tas5086_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = priv->deemph;
+	ucontrol->value.integer.value[0] = priv->deemph;
 
 	return 0;
 }
@@ -286,7 +286,7 @@ static int tas5086_put_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec);
 
-	priv->deemph = ucontrol->value.enumerated.item[0];
+	priv->deemph = ucontrol->value.integer.value[0];
 
 	return tas5086_set_deemph(codec);
 }

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

* [PATCH 3.16.y-ckt 040/144] ASoC: wm2000: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (38 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 039/144] ASoC: tas5086: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 041/144] ASoC: wm8731: " Luis Henriques
                   ` (103 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 00a14c2968e3d55817e0fa35c78106ca840537bf upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm2000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index a4c352cc3464..a7a4cc4ad0e5 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -610,7 +610,7 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
 
-	ucontrol->value.enumerated.item[0] = wm2000->anc_active;
+	ucontrol->value.integer.value[0] = wm2000->anc_active;
 
 	return 0;
 }
@@ -620,7 +620,7 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
-	int anc_active = ucontrol->value.enumerated.item[0];
+	int anc_active = ucontrol->value.integer.value[0];
 	int ret;
 
 	if (anc_active > 1)
@@ -643,7 +643,7 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
 
-	ucontrol->value.enumerated.item[0] = wm2000->spk_ena;
+	ucontrol->value.integer.value[0] = wm2000->spk_ena;
 
 	return 0;
 }
@@ -653,7 +653,7 @@ static int wm2000_speaker_put(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
-	int val = ucontrol->value.enumerated.item[0];
+	int val = ucontrol->value.integer.value[0];
 	int ret;
 
 	if (val > 1)

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

* [PATCH 3.16.y-ckt 041/144] ASoC: wm8731: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (39 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 040/144] ASoC: wm2000: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 042/144] ASoC: wm8903: " Luis Henriques
                   ` (102 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit bd14016fbf31aa199026f1e2358eab695f374eb1 upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm8731.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 5ada61611324..e12d9a54e3ad 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -122,7 +122,7 @@ static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = wm8731->deemph;
+	ucontrol->value.integer.value[0] = wm8731->deemph;
 
 	return 0;
 }
@@ -132,7 +132,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
-	int deemph = ucontrol->value.enumerated.item[0];
+	int deemph = ucontrol->value.integer.value[0];
 	int ret = 0;
 
 	if (deemph > 1)

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

* [PATCH 3.16.y-ckt 042/144] ASoC: wm8903: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (40 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 041/144] ASoC: wm8731: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 043/144] ASoC: wm8904: " Luis Henriques
                   ` (101 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 24cc883c1fd16df34211ae41624aa6d3cd906693 upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm8903.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index b84940c359a1..168a47580b02 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -442,7 +442,7 @@ static int wm8903_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = wm8903->deemph;
+	ucontrol->value.integer.value[0] = wm8903->deemph;
 
 	return 0;
 }
@@ -452,7 +452,7 @@ static int wm8903_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
-	int deemph = ucontrol->value.enumerated.item[0];
+	int deemph = ucontrol->value.integer.value[0];
 	int ret = 0;
 
 	if (deemph > 1)

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

* [PATCH 3.16.y-ckt 043/144] ASoC: wm8904: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (41 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 042/144] ASoC: wm8903: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 044/144] ASoC: wm8955: " Luis Henriques
                   ` (100 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit eaddf6fd959074f6a6e71deffe079c71eef35da6 upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm8904.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index f7c549949c54..1289b59f8c87 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -523,7 +523,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = wm8904->deemph;
+	ucontrol->value.integer.value[0] = wm8904->deemph;
 	return 0;
 }
 
@@ -532,7 +532,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
-	int deemph = ucontrol->value.enumerated.item[0];
+	int deemph = ucontrol->value.integer.value[0];
 
 	if (deemph > 1)
 		return -EINVAL;

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

* [PATCH 3.16.y-ckt 044/144] ASoC: wm8955: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (42 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 043/144] ASoC: wm8904: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 045/144] ASoC: wm8960: " Luis Henriques
                   ` (99 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 07892b10356f17717abdc578acbef72db86c880e upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm8955.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 2a35108f233d..b8a9f8c84b7c 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -393,7 +393,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = wm8955->deemph;
+	ucontrol->value.integer.value[0] = wm8955->deemph;
 	return 0;
 }
 
@@ -402,7 +402,7 @@ static int wm8955_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
-	int deemph = ucontrol->value.enumerated.item[0];
+	int deemph = ucontrol->value.integer.value[0];
 
 	if (deemph > 1)
 		return -EINVAL;

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

* [PATCH 3.16.y-ckt 045/144] ASoC: wm8960: Fix wrong value references for boolean kctl
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (43 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 044/144] ASoC: wm8955: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 046/144] usb: phy: am335x-control: check return value of bus_find_device Luis Henriques
                   ` (98 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Mark Brown, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit b4a18c8b1af15ebfa9054a3d2aef7b0a7e6f2a05 upstream.

The correct values referred by a boolean control are
value.integer.value[], not value.enumerated.item[].
The former is long while the latter is int, so it's even incompatible
on 64bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm8960.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 8cb647f5a19e..de65ad096248 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -181,7 +181,7 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol,
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
 
-	ucontrol->value.enumerated.item[0] = wm8960->deemph;
+	ucontrol->value.integer.value[0] = wm8960->deemph;
 	return 0;
 }
 
@@ -190,7 +190,7 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
-	int deemph = ucontrol->value.enumerated.item[0];
+	int deemph = ucontrol->value.integer.value[0];
 
 	if (deemph > 1)
 		return -EINVAL;

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

* [PATCH 3.16.y-ckt 046/144] usb: phy: am335x-control: check return value of bus_find_device
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (44 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 045/144] ASoC: wm8960: " Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 047/144] crypto: aesni - fix memory usage in GCM decryption Luis Henriques
                   ` (97 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Dueck, Felipe Balbi, Luis Henriques

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

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

From: David Dueck <davidcdueck@googlemail.com>

commit d0f347d62814ec0f599a05c61c5619d5e999e4ae upstream.

This fixes a potential null pointer dereference.

Fixes: d4332013919a ("driver core: dev_get_drvdata: Don't check for NULL dev")
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David Dueck <davidcdueck@googlemail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/phy/phy-am335x-control.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c
index 35b6083b7999..d5eca7b9c555 100644
--- a/drivers/usb/phy/phy-am335x-control.c
+++ b/drivers/usb/phy/phy-am335x-control.c
@@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev)
 		return NULL;
 
 	dev = bus_find_device(&platform_bus_type, NULL, node, match);
+	if (!dev)
+		return NULL;
+
 	ctrl_usb = dev_get_drvdata(dev);
 	if (!ctrl_usb)
 		return NULL;

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

* [PATCH 3.16.y-ckt 047/144] crypto: aesni - fix memory usage in GCM decryption
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (45 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 046/144] usb: phy: am335x-control: check return value of bus_find_device Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 048/144] phy: Find the right match in devm_phy_destroy() Luis Henriques
                   ` (96 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tadeusz Struk, Stephan Mueller, Herbert Xu, Luis Henriques

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

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

From: Stephan Mueller <smueller@chronox.de>

commit ccfe8c3f7e52ae83155cb038753f4c75b774ca8a upstream.

The kernel crypto API logic requires the caller to provide the
length of (ciphertext || authentication tag) as cryptlen for the
AEAD decryption operation. Thus, the cipher implementation must
calculate the size of the plaintext output itself and cannot simply use
cryptlen.

The RFC4106 GCM decryption operation tries to overwrite cryptlen memory
in req->dst. As the destination buffer for decryption only needs to hold
the plaintext memory but cryptlen references the input buffer holding
(ciphertext || authentication tag), the assumption of the destination
buffer length in RFC4106 GCM operation leads to a too large size. This
patch simply uses the already calculated plaintext size.

In addition, this patch fixes the offset calculation of the AAD buffer
pointer: as mentioned before, cryptlen already includes the size of the
tag. Thus, the tag does not need to be added. With the addition, the AAD
will be written beyond the already allocated buffer.

Note, this fixes a kernel crash that can be triggered from user space
via AF_ALG(aead) -- simply use the libkcapi test application
from [1] and update it to use rfc4106-gcm-aes.

Using [1], the changes were tested using CAVS vectors to demonstrate
that the crypto operation still delivers the right results.

[1] http://www.chronox.de/libkcapi.html

CC: Tadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/crypto/aesni-intel_glue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 6dfb7d0b139a..6d4fabac779c 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -1109,7 +1109,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req)
 		src = kmalloc(req->cryptlen + req->assoclen, GFP_ATOMIC);
 		if (!src)
 			return -ENOMEM;
-		assoc = (src + req->cryptlen + auth_tag_len);
+		assoc = (src + req->cryptlen);
 		scatterwalk_map_and_copy(src, req->src, 0, req->cryptlen, 0);
 		scatterwalk_map_and_copy(assoc, req->assoc, 0,
 			req->assoclen, 0);
@@ -1134,7 +1134,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req)
 		scatterwalk_done(&src_sg_walk, 0, 0);
 		scatterwalk_done(&assoc_sg_walk, 0, 0);
 	} else {
-		scatterwalk_map_and_copy(dst, req->dst, 0, req->cryptlen, 1);
+		scatterwalk_map_and_copy(dst, req->dst, 0, tempCipherLen, 1);
 		kfree(src);
 	}
 	return retval;

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

* [PATCH 3.16.y-ckt 048/144] phy: Find the right match in devm_phy_destroy()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (46 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 047/144] crypto: aesni - fix memory usage in GCM decryption Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 049/144] x86/fpu: Avoid math_state_restore() without used_math() in __restore_xstate_sig() Luis Henriques
                   ` (95 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thierry Reding, Kishon Vijay Abraham I, Luis Henriques

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

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

From: Thierry Reding <treding@nvidia.com>

commit 2f1bce487cd0a02623cff3d877940f9a2026341c upstream.

devm_phy_create() stores the pointer to the new PHY at the address
returned by devres_alloc(). The res parameter passed to devm_phy_match()
is therefore the location where the pointer to the PHY is stored, hence
it needs to be dereferenced before comparing to the match data in order
to find the correct match.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/phy/phy-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 49c446530101..b7053d02b809 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -50,7 +50,9 @@ static void devm_phy_consume(struct device *dev, void *res)
 
 static int devm_phy_match(struct device *dev, void *res, void *match_data)
 {
-	return res == match_data;
+	struct phy **phy = res;
+
+	return *phy == match_data;
 }
 
 static struct phy *phy_lookup(struct device *device, const char *port)

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

* [PATCH 3.16.y-ckt 049/144] x86/fpu: Avoid math_state_restore() without used_math() in __restore_xstate_sig()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (47 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 048/144] phy: Find the right match in devm_phy_destroy() Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 050/144] x86/fpu: Drop_fpu() should not assume that tsk equals current Luis Henriques
                   ` (94 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Borislav Petkov, Andy Lutomirski, Borislav Petkov,
	Dave Hansen, Fenghua Yu, H. Peter Anvin, Linus Torvalds,
	Pekka Riikonen, Quentin Casasnovas, Rik van Riel, Suresh Siddha,
	Thomas Gleixner, Ingo Molnar, Luis Henriques

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

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

From: Oleg Nesterov <oleg@redhat.com>

commit a7c80ebcac3068b1c3cb27d538d29558c30010c8 upstream.

math_state_restore() assumes it is called with irqs disabled,
but this is not true if the caller is __restore_xstate_sig().

This means that if ia32_fxstate == T and __copy_from_user()
fails, __restore_xstate_sig() returns with irqs disabled too.

This triggers:

  BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:41
   dump_stack
   ___might_sleep
   ? _raw_spin_unlock_irqrestore
   __might_sleep
   down_read
   ? _raw_spin_unlock_irqrestore
   print_vma_addr
   signal_fault
   sys32_rt_sigreturn

Change __restore_xstate_sig() to call set_used_math()
unconditionally. This avoids enabling and disabling interrupts
in math_state_restore(). If copy_from_user() fails, we can
simply do fpu_finit() by hand.

[ Note: this is only the first step. math_state_restore() should
        not check used_math(), it should set this flag. While
	init_fpu() should simply die. ]

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20150307153844.GB25954@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/xsave.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index dd50e26c58f6..7a09aca4b33a 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -375,7 +375,7 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)
 		 * thread's fpu state, reconstruct fxstate from the fsave
 		 * header. Sanitize the copied state etc.
 		 */
-		struct xsave_struct *xsave = &tsk->thread.fpu.state->xsave;
+		struct fpu *fpu = &tsk->thread.fpu;
 		struct user_i387_ia32_struct env;
 		int err = 0;
 
@@ -389,14 +389,15 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)
 		 */
 		drop_fpu(tsk);
 
-		if (__copy_from_user(xsave, buf_fx, state_size) ||
+		if (__copy_from_user(&fpu->state->xsave, buf_fx, state_size) ||
 		    __copy_from_user(&env, buf, sizeof(env))) {
+			fpu_finit(fpu);
 			err = -1;
 		} else {
 			sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only);
-			set_used_math();
 		}
 
+		set_used_math();
 		if (use_eager_fpu()) {
 			preempt_disable();
 			math_state_restore();

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

* [PATCH 3.16.y-ckt 050/144] x86/fpu: Drop_fpu() should not assume that tsk equals current
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (48 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 049/144] x86/fpu: Avoid math_state_restore() without used_math() in __restore_xstate_sig() Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 051/144] cpuidle: mvebu: Fix the CPU PM notifier usage Luis Henriques
                   ` (93 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Borislav Petkov, Andy Lutomirski, Borislav Petkov,
	Dave Hansen, Fenghua Yu, H. Peter Anvin, Linus Torvalds,
	Pekka Riikonen, Quentin Casasnovas, Suresh Siddha,
	Thomas Gleixner, Ingo Molnar, Luis Henriques

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

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

From: Oleg Nesterov <oleg@redhat.com>

commit f4c3686386393c120710dd34df2a74183ab805fd upstream.

drop_fpu() does clear_used_math() and usually this is correct
because tsk == current.

However switch_fpu_finish()->restore_fpu_checking() is called before
__switch_to() updates the "current_task" variable. If it fails,
we will wrongly clear the PF_USED_MATH flag of the previous task.

So use clear_stopped_child_used_math() instead.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20150309171041.GB11388@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/asm/fpu-internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 115e3689cd53..0eb93c52e8d4 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -368,7 +368,7 @@ static inline void drop_fpu(struct task_struct *tsk)
 	preempt_disable();
 	tsk->thread.fpu_counter = 0;
 	__drop_fpu(tsk);
-	clear_used_math();
+	clear_stopped_child_used_math(tsk);
 	preempt_enable();
 }
 

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

* [PATCH 3.16.y-ckt 051/144] cpuidle: mvebu: Fix the CPU PM notifier usage
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (49 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 050/144] x86/fpu: Drop_fpu() should not assume that tsk equals current Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 052/144] can: kvaser_usb: Fix tx queue start/stop race conditions Luis Henriques
                   ` (92 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Gregory CLEMENT, Daniel Lezcano, Luis Henriques

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

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

From: Gregory CLEMENT <gregory.clement@free-electrons.com>

commit 43b68879de27b1993518687fbc6013da80cdcbfe upstream.

As stated in kernel/cpu_pm.c, "Platform is responsible for ensuring
that cpu_pm_enter is not called twice on the same CPU before
cpu_pm_exit is called.". In the current code in case of failure when
calling mvebu_v7_cpu_suspend, the function cpu_pm_exit() is never
called whereas cpu_pm_enter() was called just before.

This patch moves the cpu_pm_exit() in order to balance the
cpu_pm_enter() calls.

Reported-by: Fulvio Benini <fbf@libero.it>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[ luis: backported to 3.16:
  - file rename: cpuidle-mvebu-v7.c -> cpuidle-armada-370-xp.c
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/cpuidle/cpuidle-armada-370-xp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-armada-370-xp.c b/drivers/cpuidle/cpuidle-armada-370-xp.c
index a5fba0287bfb..1a428b478a0d 100644
--- a/drivers/cpuidle/cpuidle-armada-370-xp.c
+++ b/drivers/cpuidle/cpuidle-armada-370-xp.c
@@ -38,11 +38,11 @@ static int armada_370_xp_enter_idle(struct cpuidle_device *dev,
 		deepidle = true;
 
 	ret = armada_370_xp_cpu_suspend(deepidle);
+	cpu_pm_exit();
+
 	if (ret)
 		return ret;
 
-	cpu_pm_exit();
-
 	return index;
 }
 

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

* [PATCH 3.16.y-ckt 052/144] can: kvaser_usb: Fix tx queue start/stop race conditions
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (50 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 051/144] cpuidle: mvebu: Fix the CPU PM notifier usage Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 053/144] usb: chipidea: otg: add a_alt_hnp_support response for B device Luis Henriques
                   ` (91 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ahmed S. Darwish, Marc Kleine-Budde, Luis Henriques

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

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

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

commit a9dc960c37b0d4eb192598dc4c94276270454514 upstream.

A number of tx queue wake-up events went missing due to the
outlined scenario below. Start state is a pool of 16 tx URBs,
active tx_urbs count = 15, with the netdev tx queue open.

CPU #1 [softirq]                         CPU #2 [softirq]
start_xmit()                             tx_acknowledge()
................                         ................

atomic_inc(&tx_urbs);
if (atomic_read(&tx_urbs) >= 16) {
                        -->
                                         atomic_dec(&tx_urbs);
                                         netif_wake_queue();
                                         return;
                        <--
    netif_stop_queue();
}

At the end, the correct state expected is a 15 tx_urbs count
value with the tx queue state _open_. Due to the race, we get
the same tx_urbs value but with the tx queue state _stopped_.
The wake-up event is completely lost.

Thus avoid hand-rolled concurrency mechanisms and use a proper
lock for contexts and tx queue protection.

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/usb/kvaser_usb.c | 83 ++++++++++++++++++++++++----------------
 1 file changed, 51 insertions(+), 32 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 66b259bd9bce..4d47f224d705 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -12,6 +12,7 @@
  * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>
  */
 
+#include <linux/spinlock.h>
 #include <linux/kernel.h>
 #include <linux/completion.h>
 #include <linux/module.h>
@@ -298,10 +299,11 @@ struct kvaser_usb {
 struct kvaser_usb_net_priv {
 	struct can_priv can;
 
-	atomic_t active_tx_urbs;
-	struct usb_anchor tx_submitted;
+	spinlock_t tx_contexts_lock;
+	int active_tx_contexts;
 	struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS];
 
+	struct usb_anchor tx_submitted;
 	struct completion start_comp, stop_comp;
 
 	struct kvaser_usb *dev;
@@ -506,6 +508,7 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev,
 	struct can_frame *cf;
 	u8 channel = msg->u.tx_acknowledge.channel;
 	u8 tid = msg->u.tx_acknowledge.tid;
+	unsigned long flags;
 
 	if (channel >= dev->nchannels) {
 		dev_err(dev->udev->dev.parent,
@@ -545,12 +548,15 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev,
 
 	stats->tx_packets++;
 	stats->tx_bytes += context->dlc;
-	can_get_echo_skb(priv->netdev, context->echo_index);
 
-	context->echo_index = MAX_TX_URBS;
-	atomic_dec(&priv->active_tx_urbs);
+	spin_lock_irqsave(&priv->tx_contexts_lock, flags);
 
+	can_get_echo_skb(priv->netdev, context->echo_index);
+	context->echo_index = MAX_TX_URBS;
+	--priv->active_tx_contexts;
 	netif_wake_queue(priv->netdev);
+
+	spin_unlock_irqrestore(&priv->tx_contexts_lock, flags);
 }
 
 static void kvaser_usb_simple_msg_callback(struct urb *urb)
@@ -611,17 +617,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
 	return 0;
 }
 
-static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv)
-{
-	int i;
-
-	usb_kill_anchored_urbs(&priv->tx_submitted);
-	atomic_set(&priv->active_tx_urbs, 0);
-
-	for (i = 0; i < MAX_TX_URBS; i++)
-		priv->tx_contexts[i].echo_index = MAX_TX_URBS;
-}
-
 static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
 				const struct kvaser_msg *msg)
 {
@@ -1181,6 +1176,24 @@ error:
 	return err;
 }
 
+static void kvaser_usb_reset_tx_urb_contexts(struct kvaser_usb_net_priv *priv)
+{
+	int i;
+
+	priv->active_tx_contexts = 0;
+	for (i = 0; i < MAX_TX_URBS; i++)
+		priv->tx_contexts[i].echo_index = MAX_TX_URBS;
+}
+
+/* This method might sleep. Do not call it in the atomic context
+ * of URB completions.
+ */
+static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv)
+{
+	usb_kill_anchored_urbs(&priv->tx_submitted);
+	kvaser_usb_reset_tx_urb_contexts(priv);
+}
+
 static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev)
 {
 	int i;
@@ -1299,6 +1312,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	void *buf;
 	struct kvaser_msg *msg;
 	int i, err, ret = NETDEV_TX_OK;
+	unsigned long flags;
 
 	if (can_dropped_invalid_skb(netdev, skb))
 		return NETDEV_TX_OK;
@@ -1342,12 +1356,21 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	if (cf->can_id & CAN_RTR_FLAG)
 		msg->u.tx_can.flags |= MSG_FLAG_REMOTE_FRAME;
 
+	spin_lock_irqsave(&priv->tx_contexts_lock, flags);
 	for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) {
 		if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) {
 			context = &priv->tx_contexts[i];
+
+			context->echo_index = i;
+			can_put_echo_skb(skb, netdev, context->echo_index);
+			++priv->active_tx_contexts;
+			if (priv->active_tx_contexts >= MAX_TX_URBS)
+				netif_stop_queue(netdev);
+
 			break;
 		}
 	}
+	spin_unlock_irqrestore(&priv->tx_contexts_lock, flags);
 
 	/* This should never happen; it implies a flow control bug */
 	if (!context) {
@@ -1359,7 +1382,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	}
 
 	context->priv = priv;
-	context->echo_index = i;
 	context->dlc = cf->can_dlc;
 
 	msg->u.tx_can.tid = context->echo_index;
@@ -1371,18 +1393,17 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 			  kvaser_usb_write_bulk_callback, context);
 	usb_anchor_urb(urb, &priv->tx_submitted);
 
-	can_put_echo_skb(skb, netdev, context->echo_index);
-
-	atomic_inc(&priv->active_tx_urbs);
-
-	if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS)
-		netif_stop_queue(netdev);
-
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (unlikely(err)) {
+		spin_lock_irqsave(&priv->tx_contexts_lock, flags);
+
 		can_free_echo_skb(netdev, context->echo_index);
+		context->echo_index = MAX_TX_URBS;
+		--priv->active_tx_contexts;
+		netif_wake_queue(netdev);
+
+		spin_unlock_irqrestore(&priv->tx_contexts_lock, flags);
 
-		atomic_dec(&priv->active_tx_urbs);
 		usb_unanchor_urb(urb);
 
 		stats->tx_dropped++;
@@ -1509,7 +1530,7 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
 	struct kvaser_usb *dev = usb_get_intfdata(intf);
 	struct net_device *netdev;
 	struct kvaser_usb_net_priv *priv;
-	int i, err;
+	int err;
 
 	err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel);
 	if (err)
@@ -1523,19 +1544,17 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
 
 	priv = netdev_priv(netdev);
 
+	init_usb_anchor(&priv->tx_submitted);
 	init_completion(&priv->start_comp);
 	init_completion(&priv->stop_comp);
 
-	init_usb_anchor(&priv->tx_submitted);
-	atomic_set(&priv->active_tx_urbs, 0);
-
-	for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++)
-		priv->tx_contexts[i].echo_index = MAX_TX_URBS;
-
 	priv->dev = dev;
 	priv->netdev = netdev;
 	priv->channel = channel;
 
+	spin_lock_init(&priv->tx_contexts_lock);
+	kvaser_usb_reset_tx_urb_contexts(priv);
+
 	priv->can.state = CAN_STATE_STOPPED;
 	priv->can.clock.freq = CAN_USB_CLOCK;
 	priv->can.bittiming_const = &kvaser_usb_bittiming_const;

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

* [PATCH 3.16.y-ckt 053/144] usb: chipidea: otg: add a_alt_hnp_support response for B device
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (51 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 052/144] can: kvaser_usb: Fix tx queue start/stop race conditions Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 054/144] mac80211: count interfaces correctly for combination checks Luis Henriques
                   ` (90 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Li Jun, Peter Chen, Greg Kroah-Hartman, Luis Henriques

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

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

From: Li Jun <B47624@freescale.com>

commit d20f7807996c69537e07443ef8dec4e01a28b099 upstream.

This patch adds response to a_alt_hnp_support set feature request from legacy
A device, that is, B-device can provide a message to the user indicating that
the user needs to connect the B-device to an alternate port on the A-device.
A device sets this feature indicates to the B-device that it is connected
to an A-device port that is not capable of HNP, but that the A-device does have
an alternate port that is capable of HNP.

[Peter]
Without this patch, the OTG B device can't be enumerated on
non-HNP port at A device, see below log:
[    2.287464] usb 1-1: Dual-Role OTG device on non-HNP port
[    2.293105] usb 1-1: can't set HNP mode: -32
[    2.417422] usb 1-1: new high-speed USB device number 4 using ci_hdrc
[    2.460635] usb 1-1: Dual-Role OTG device on non-HNP port
[    2.466424] usb 1-1: can't set HNP mode: -32
[    2.587464] usb 1-1: new high-speed USB device number 5 using ci_hdrc
[    2.630649] usb 1-1: Dual-Role OTG device on non-HNP port
[    2.636436] usb 1-1: can't set HNP mode: -32
[    2.641003] usb usb1-port1: unable to enumerate USB device

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index b8125aa64ad8..4065323d493c 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -933,6 +933,13 @@ __acquires(hwep->lock)
 	return retval;
 }
 
+static int otg_a_alt_hnp_support(struct ci_hdrc *ci)
+{
+	dev_warn(&ci->gadget.dev,
+		"connect the device to an alternate port if you want HNP\n");
+	return isr_setup_status_phase(ci);
+}
+
 /**
  * isr_setup_packet_handler: setup packet handler
  * @ci: UDC descriptor
@@ -1065,6 +1072,10 @@ __acquires(ci->lock)
 							ci);
 				}
 				break;
+			case USB_DEVICE_A_ALT_HNP_SUPPORT:
+				if (ci_otg_is_fsm_mode(ci))
+					err = otg_a_alt_hnp_support(ci);
+				break;
 			default:
 				goto delegate;
 			}

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

* [PATCH 3.16.y-ckt 054/144] mac80211: count interfaces correctly for combination checks
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (52 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 053/144] usb: chipidea: otg: add a_alt_hnp_support response for B device Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 055/144] nl80211: ignore HT/VHT capabilities without QoS/WMM Luis Henriques
                   ` (89 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrei Otcheretianski, Emmanuel Grumbach, Johannes Berg, Luis Henriques

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

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

From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

commit 0f611d28fc2e13cfec64e1c544c16a086886805a upstream.

Since moving the interface combination checks to mac80211, it's
broken because it now only considers interfaces with an assigned
channel context, so for example any interface that isn't active
can still be up, which is clearly an issue; also, in particular
P2P-Device wdevs are an issue since they never have a chanctx.

Fix this by counting running interfaces instead the ones with a
channel context assigned.

Fixes: 73de86a38962b ("cfg80211/mac80211: move interface counting for combination check to mac80211")
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
[rewrite commit message, dig out the commit it fixes]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index a6cda52ed920..01fe82e9d1b0 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2896,7 +2896,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
 		wdev_iter = &sdata_iter->wdev;
 
 		if (sdata_iter == sdata ||
-		    rcu_access_pointer(sdata_iter->vif.chanctx_conf) == NULL ||
+		    !ieee80211_sdata_running(sdata_iter) ||
 		    local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype))
 			continue;
 

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

* [PATCH 3.16.y-ckt 055/144] nl80211: ignore HT/VHT capabilities without QoS/WMM
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (53 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 054/144] mac80211: count interfaces correctly for combination checks Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 056/144] ALSA: hda - Treat stereo-to-mono mix properly Luis Henriques
                   ` (88 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johannes Berg, Luis Henriques

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

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

From: Johannes Berg <johannes.berg@intel.com>

commit 496fcc294daab18799e190c0264863d653588d1f upstream.

As HT/VHT depend heavily on QoS/WMM, it's not a good idea to
let userspace add clients that have HT/VHT but not QoS/WMM.
Since it does so in certain cases we've observed (client is
using HT IEs but not QoS/WMM) just ignore the HT/VHT info at
this point and don't pass it down to the drivers which might
unconditionally use it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/wireless/nl80211.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index be4ba21df4d8..d316a9568238 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4266,6 +4266,16 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
 	if (parse_station_flags(info, dev->ieee80211_ptr->iftype, &params))
 		return -EINVAL;
 
+	/* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT
+	 * as userspace might just pass through the capabilities from the IEs
+	 * directly, rather than enforcing this restriction and returning an
+	 * error in this case.
+	 */
+	if (!(params.sta_flags_set & BIT(NL80211_STA_FLAG_WME))) {
+		params.ht_capa = NULL;
+		params.vht_capa = NULL;
+	}
+
 	/* When you run into this, adjust the code below for the new flag */
 	BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 7);
 

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

* [PATCH 3.16.y-ckt 056/144] ALSA: hda - Treat stereo-to-mono mix properly
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (54 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 055/144] nl80211: ignore HT/VHT capabilities without QoS/WMM Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 057/144] pagemap: do not leak physical addresses to non-privileged userspace Luis Henriques
                   ` (87 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit cc261738add93947d138d2fabad9f4dbed4e5c00 upstream.

The commit [ef403edb7558: ALSA: hda - Don't access stereo amps for
mono channel widgets] fixed the handling of mono widgets in general,
but it still misses an exceptional case: namely, a mono mixer widget
taking a single stereo input.  In this case, it has stereo volumes
although it's a mono widget, and thus we have to take care of both
left and right input channels, as stated in HD-audio spec ("7.1.3
Widget Interconnection Rules").

This patch covers this missing piece by adding proper checks of stereo
amps in both the generic parser and the proc output codes.

Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/hda_generic.c | 21 +++++++++++++++++++--
 sound/pci/hda/hda_proc.c    | 38 ++++++++++++++++++++++++++++++--------
 2 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index b756dd2906e4..0882f060696d 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -653,13 +653,30 @@ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
 	return val;
 }
 
+/* is this a stereo widget or a stereo-to-mono mix? */
+static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, int dir)
+{
+	unsigned int wcaps = get_wcaps(codec, nid);
+	hda_nid_t conn;
+
+	if (wcaps & AC_WCAP_STEREO)
+		return true;
+	if (dir != HDA_INPUT || get_wcaps_type(wcaps) != AC_WID_AUD_MIX)
+		return false;
+	if (snd_hda_get_num_conns(codec, nid) != 1)
+		return false;
+	if (snd_hda_get_connections(codec, nid, &conn, 1) < 0)
+		return false;
+	return !!(get_wcaps(codec, conn) & AC_WCAP_STEREO);
+}
+
 /* initialize the amp value (only at the first time) */
 static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx)
 {
 	unsigned int caps = query_amp_caps(codec, nid, dir);
 	int val = get_amp_val_to_activate(codec, nid, dir, caps, false);
 
-	if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
+	if (is_stereo_amps(codec, nid, dir))
 		snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val);
 	else
 		snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val);
@@ -669,7 +686,7 @@ static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx)
 static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx,
 		      unsigned int mask, unsigned int val)
 {
-	if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
+	if (is_stereo_amps(codec, nid, dir))
 		return snd_hda_codec_amp_stereo(codec, nid, dir, idx,
 						mask, val);
 	else
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index ce5a6da83419..05e19f78b4cb 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -134,13 +134,38 @@ static void print_amp_caps(struct snd_info_buffer *buffer,
 		    (caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT);
 }
 
+/* is this a stereo widget or a stereo-to-mono mix? */
+static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid,
+			   int dir, unsigned int wcaps, int indices)
+{
+	hda_nid_t conn;
+
+	if (wcaps & AC_WCAP_STEREO)
+		return true;
+	/* check for a stereo-to-mono mix; it must be:
+	 * only a single connection, only for input, and only a mixer widget
+	 */
+	if (indices != 1 || dir != HDA_INPUT ||
+	    get_wcaps_type(wcaps) != AC_WID_AUD_MIX)
+		return false;
+
+	if (snd_hda_get_raw_connections(codec, nid, &conn, 1) < 0)
+		return false;
+	/* the connection source is a stereo? */
+	wcaps = snd_hda_param_read(codec, conn, AC_PAR_AUDIO_WIDGET_CAP);
+	return !!(wcaps & AC_WCAP_STEREO);
+}
+
 static void print_amp_vals(struct snd_info_buffer *buffer,
 			   struct hda_codec *codec, hda_nid_t nid,
-			   int dir, int stereo, int indices)
+			   int dir, unsigned int wcaps, int indices)
 {
 	unsigned int val;
+	bool stereo;
 	int i;
 
+	stereo = is_stereo_amps(codec, nid, dir, wcaps, indices);
+
 	dir = dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT;
 	for (i = 0; i < indices; i++) {
 		snd_iprintf(buffer, " [");
@@ -757,12 +782,10 @@ static void print_codec_info(struct snd_info_entry *entry,
 			    (codec->single_adc_amp &&
 			     wid_type == AC_WID_AUD_IN))
 				print_amp_vals(buffer, codec, nid, HDA_INPUT,
-					       wid_caps & AC_WCAP_STEREO,
-					       1);
+					       wid_caps, 1);
 			else
 				print_amp_vals(buffer, codec, nid, HDA_INPUT,
-					       wid_caps & AC_WCAP_STEREO,
-					       conn_len);
+					       wid_caps, conn_len);
 		}
 		if (wid_caps & AC_WCAP_OUT_AMP) {
 			snd_iprintf(buffer, "  Amp-Out caps: ");
@@ -771,11 +794,10 @@ static void print_codec_info(struct snd_info_entry *entry,
 			if (wid_type == AC_WID_PIN &&
 			    codec->pin_amp_workaround)
 				print_amp_vals(buffer, codec, nid, HDA_OUTPUT,
-					       wid_caps & AC_WCAP_STEREO,
-					       conn_len);
+					       wid_caps, conn_len);
 			else
 				print_amp_vals(buffer, codec, nid, HDA_OUTPUT,
-					       wid_caps & AC_WCAP_STEREO, 1);
+					       wid_caps, 1);
 		}
 
 		switch (wid_type) {

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

* [PATCH 3.16.y-ckt 057/144] pagemap: do not leak physical addresses to non-privileged userspace
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (55 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 056/144] ALSA: hda - Treat stereo-to-mono mix properly Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 058/144] uas: Add US_FL_NO_ATA_1X for Initio Corporation controllers / devices Luis Henriques
                   ` (86 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kirill A. Shutemov, Pavel Emelyanov, Andrew Morton, Mark Seaborn,
	Linus Torvalds, Luis Henriques

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

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

From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

commit ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce upstream.

As pointed by recent post[1] on exploiting DRAM physical imperfection,
/proc/PID/pagemap exposes sensitive information which can be used to do
attacks.

This disallows anybody without CAP_SYS_ADMIN to read the pagemap.

[1] http://googleprojectzero.blogspot.com/2015/03/exploiting-dram-rowhammer-bug-to-gain.html

[ Eventually we might want to do anything more finegrained, but for now
  this is the simple model.   - Linus ]

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Seaborn <mseaborn@chromium.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/proc/task_mmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index a6b314919d9d..5825f6d944ce 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1260,6 +1260,9 @@ out:
 
 static int pagemap_open(struct inode *inode, struct file *file)
 {
+	/* do not disclose physical addresses: attack vector */
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
 	pr_warn_once("Bits 55-60 of /proc/PID/pagemap entries are about "
 			"to stop being page-shift some time soon. See the "
 			"linux/Documentation/vm/pagemap.txt for details.\n");

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

* [PATCH 3.16.y-ckt 058/144] uas: Add US_FL_NO_ATA_1X for Initio Corporation controllers / devices
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (56 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 057/144] pagemap: do not leak physical addresses to non-privileged userspace Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 059/144] usb: common: otg-fsm: only signal connect after switching to peripheral Luis Henriques
                   ` (85 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Hans de Goede, Greg Kroah-Hartman, Luis Henriques

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

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

From: Hans de Goede <hdegoede@redhat.com>

commit bda13e35d584dabf52c9f77e0fe62683ac4d9f86 upstream.

A new uas compatible controller has shown up in some people's devices from
the manufacturer Initio Corporation, this controller needs the US_FL_NO_ATA_1X
quirk to work properly with uas, so add it to the uas quirks table.

Reported-and-tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/storage/unusual_uas.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
index cd047d0cc7a6..cd4ba61330c8 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -103,6 +103,13 @@ UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x9999,
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_NO_ATA_1X),
 
+/* Reported-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> */
+UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999,
+		"Initio Corporation",
+		"",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_ATA_1X),
+
 /* Reported-by: Tom Arild Naess <tanaess@gmail.com> */
 UNUSUAL_DEV(0x152d, 0x0539, 0x0000, 0x9999,
 		"JMicron",

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

* [PATCH 3.16.y-ckt 059/144] usb: common: otg-fsm: only signal connect after switching to peripheral
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (57 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 058/144] uas: Add US_FL_NO_ATA_1X for Initio Corporation controllers / devices Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 060/144] of/irq: Fix of_irq_parse_one() returned error codes Luis Henriques
                   ` (84 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Chen, Greg Kroah-Hartman, Luis Henriques

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

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

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

commit a886bd92267c9e3d5c912860c6fb5a68479a7643 upstream.

We should signal connect (pull up dp) after we have already
at peripheral mode, otherwise, the dp may be toggled due to
we reset controller or do disconnect during the initialization
for peripheral, then, the host may be confused during the
enumeration, eg, it finds the reset can't succeed, but the
device is still there, see below error message.

hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: cannot reset port 1 (err = -32)
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
hub 1-0:1.0: unable to enumerate USB device on port 1

Fixes: the issue existed when the otg fsm code was added.
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/common/usb-otg-fsm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 98e8340a5bb1..c812fefe0e50 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -150,9 +150,9 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 		break;
 	case OTG_STATE_B_PERIPHERAL:
 		otg_chrg_vbus(fsm, 0);
-		otg_loc_conn(fsm, 1);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_GADGET);
+		otg_loc_conn(fsm, 1);
 		break;
 	case OTG_STATE_B_WAIT_ACON:
 		otg_chrg_vbus(fsm, 0);
@@ -213,10 +213,10 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 
 		break;
 	case OTG_STATE_A_PERIPHERAL:
-		otg_loc_conn(fsm, 1);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_GADGET);
 		otg_drv_vbus(fsm, 1);
+		otg_loc_conn(fsm, 1);
 		otg_add_timer(fsm, A_BIDL_ADIS);
 		break;
 	case OTG_STATE_A_WAIT_VFALL:

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

* [PATCH 3.16.y-ckt 060/144] of/irq: Fix of_irq_parse_one() returned error codes
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (58 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 059/144] usb: common: otg-fsm: only signal connect after switching to peripheral Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 061/144] iscsi-target: Avoid early conn_logout_comp for iser connections Luis Henriques
                   ` (83 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Laurent Pinchart, Rob Herring, Luis Henriques

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

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

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

commit d7c146053dd195b90c79b9b8131431f44541d015 upstream.

The error code paths that require cleanup use a goto to jump to the
cleanup code and return an error code. However, the error code variable
res, which is initialized to -EINVAL when declared, is then overwritten
with the return value of of_parse_phandle_with_args(), and reused as the
return code from of_irq_parse_one(). This leads to an undetermined error
being returned instead of the expected -EINVAL value. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/of/irq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 1471e0a223a5..b97363adca0b 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -290,7 +290,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
 	struct device_node *p;
 	const __be32 *intspec, *tmp, *addr;
 	u32 intsize, intlen;
-	int i, res = -EINVAL;
+	int i, res;
 
 	pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index);
 
@@ -323,15 +323,19 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
 
 	/* Get size of interrupt specifier */
 	tmp = of_get_property(p, "#interrupt-cells", NULL);
-	if (tmp == NULL)
+	if (tmp == NULL) {
+		res = -EINVAL;
 		goto out;
+	}
 	intsize = be32_to_cpu(*tmp);
 
 	pr_debug(" intsize=%d intlen=%d\n", intsize, intlen);
 
 	/* Check index */
-	if ((index + 1) * intsize > intlen)
+	if ((index + 1) * intsize > intlen) {
+		res = -EINVAL;
 		goto out;
+	}
 
 	/* Copy intspec into irq structure */
 	intspec += index * intsize;

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

* [PATCH 3.16.y-ckt 061/144] iscsi-target: Avoid early conn_logout_comp for iser connections
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (59 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 060/144] of/irq: Fix of_irq_parse_one() returned error codes Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 062/144] tcm_qla2xxx: Fix incorrect use of __transport_register_session Luis Henriques
                   ` (82 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sagi Grimberg, Slava Shwartsman, Nicholas Bellinger, Luis Henriques

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

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

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

commit f068fbc82e7696d67b1bb8189306865bedf368b6 upstream.

This patch fixes a iser specific logout bug where early complete()
of conn->conn_logout_comp in iscsit_close_connection() was causing
isert_wait4logout() to complete too soon, triggering a use after
free NULL pointer dereference of iscsi_conn memory.

The complete() was originally added for traditional iscsi-target
when a ISCSI_LOGOUT_OP failed in iscsi_target_rx_opcode(), but given
iser-target does not wait in logout failure, this special case needs
to be avoided.

Reported-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Slava Shwartsman <valyushash@gmail.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 | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 260c3e1e312c..209eb58b5d3a 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4223,11 +4223,17 @@ int iscsit_close_connection(
 	pr_debug("Closing iSCSI connection CID %hu on SID:"
 		" %u\n", conn->cid, sess->sid);
 	/*
-	 * Always up conn_logout_comp just in case the RX Thread is sleeping
-	 * and the logout response never got sent because the connection
-	 * failed.
+	 * Always up conn_logout_comp for the traditional TCP case just in case
+	 * the RX Thread in iscsi_target_rx_opcode() is sleeping and the logout
+	 * response never got sent because the connection failed.
+	 *
+	 * However for iser-target, isert_wait4logout() is using conn_logout_comp
+	 * to signal logout response TX interrupt completion.  Go ahead and skip
+	 * this for iser since isert_rx_opcode() does not wait on logout failure,
+	 * and to avoid iscsi_conn pointer dereference in iser-target code.
 	 */
-	complete(&conn->conn_logout_comp);
+	if (conn->conn_transport->transport_type == ISCSI_TCP)
+		complete(&conn->conn_logout_comp);
 
 	iscsi_release_thread_set(conn);
 

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

* [PATCH 3.16.y-ckt 062/144] tcm_qla2xxx: Fix incorrect use of __transport_register_session
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (60 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 061/144] iscsi-target: Avoid early conn_logout_comp for iser connections Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 063/144] target: Fix reference leak in target_get_sess_cmd() error path Luis Henriques
                   ` (81 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bart Van Assche, Giridhar Malavali, Quinn Tran,
	Nicholas Bellinger, Luis Henriques

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

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

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit 75c3d0bf9caebb502e96683b2bc37f9692437e68 upstream.

This patch fixes the incorrect use of __transport_register_session()
in tcm_qla2xxx_check_initiator_node_acl() code, that does not perform
explicit se_tpg->session_lock when accessing se_tpg->tpg_sess_list
to add new se_sess nodes.

Given that tcm_qla2xxx_check_initiator_node_acl() is not called with
qla_hw->hardware_lock held for all accesses of ->tpg_sess_list, the
code should be using transport_register_session() instead.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 4747d2c66024..39c890289134 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -1569,7 +1569,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(
 	/*
 	 * Finally register the new FC Nexus with TCM
 	 */
-	__transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess);
+	transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess);
 
 	return 0;
 }

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

* [PATCH 3.16.y-ckt 063/144] target: Fix reference leak in target_get_sess_cmd() error path
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (61 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 062/144] tcm_qla2xxx: Fix incorrect use of __transport_register_session Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 064/144] tcm_fc: missing curly braces in ft_invl_hw_context() Luis Henriques
                   ` (80 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bart Van Assche, Nicholas Bellinger, Luis Henriques

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

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

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit 7544e597343e2166daba3f32e4708533aa53c233 upstream.

This patch fixes a se_cmd->cmd_kref leak buf when se_sess->sess_tearing_down
is true within target_get_sess_cmd() submission path code.

This se_cmd reference leak can occur during active session shutdown when
ack_kref=1 is passed by target_submit_cmd_[map_sgls,tmr]() callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_transport.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index a9c77b5116e3..83b0d08c9d5b 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2392,6 +2392,10 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd,
 	list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list);
 out:
 	spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
+
+	if (ret && ack_kref)
+		target_put_sess_cmd(se_sess, se_cmd);
+
 	return ret;
 }
 EXPORT_SYMBOL(target_get_sess_cmd);

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

* [PATCH 3.16.y-ckt 064/144] tcm_fc: missing curly braces in ft_invl_hw_context()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (62 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 063/144] target: Fix reference leak in target_get_sess_cmd() error path Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 065/144] target/pscsi: Fix NULL pointer dereference in get_device_type Luis Henriques
                   ` (79 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Kiran Patil, Nicholas Bellinger, Luis Henriques

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit d556546e7ecd9fca199df4698943024d40044f8e upstream.

This patch adds a missing set of conditional check braces in
ft_invl_hw_context() originally introduced by commit dcd998ccd
when handling DDP failures in ft_recv_write_data() code.

 commit dcd998ccdbf74a7d8fe0f0a44e85da1ed5975946
 Author: Kiran Patil <kiran.patil@intel.com>
 Date:   Wed Aug 3 09:20:01 2011 +0000

    tcm_fc: Handle DDP/SW fc_frame_payload_get failures in ft_recv_write_data

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/tcm_fc/tfc_io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c
index 97b486c3dda1..583e755d8091 100644
--- a/drivers/target/tcm_fc/tfc_io.c
+++ b/drivers/target/tcm_fc/tfc_io.c
@@ -359,7 +359,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd)
 		ep = fc_seq_exch(seq);
 		if (ep) {
 			lport = ep->lp;
-			if (lport && (ep->xid <= lport->lro_xid))
+			if (lport && (ep->xid <= lport->lro_xid)) {
 				/*
 				 * "ddp_done" trigger invalidation of HW
 				 * specific DDP context
@@ -374,6 +374,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd)
 				 * identified using ep->xid)
 				 */
 				cmd->was_ddp_setup = 0;
+			}
 		}
 	}
 }

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

* [PATCH 3.16.y-ckt 065/144] target/pscsi: Fix NULL pointer dereference in get_device_type
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (63 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 064/144] tcm_fc: missing curly braces in ft_invl_hw_context() Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 066/144] target: Fix virtual LUN=0 target_configure_device failure OOPs Luis Henriques
                   ` (78 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Nicholas Bellinger, Luis Henriques

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

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

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

commit 215a8fe4198f607f34ecdbc9969dae783d8b5a61 upstream.

This patch fixes a NULL pointer dereference OOPs with pSCSI backends
within target_core_stat.c code.  The bug is caused by a configfs attr
read if no pscsi_dev_virt->pdv_sd has been configured.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_pscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 94d00df28f39..7a986d401d3f 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -1112,7 +1112,7 @@ static u32 pscsi_get_device_type(struct se_device *dev)
 	struct pscsi_dev_virt *pdv = PSCSI_DEV(dev);
 	struct scsi_device *sd = pdv->pdv_sd;
 
-	return sd->type;
+	return (sd) ? sd->type : TYPE_NO_LUN;
 }
 
 static sector_t pscsi_get_blocks(struct se_device *dev)

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

* [PATCH 3.16.y-ckt 066/144] target: Fix virtual LUN=0 target_configure_device failure OOPs
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (64 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 065/144] target/pscsi: Fix NULL pointer dereference in get_device_type Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 067/144] arm64: Honor __GFP_ZERO in dma allocations Luis Henriques
                   ` (77 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Claudio Fleiner, Christoph Hellwig, Nicholas Bellinger, Luis Henriques

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

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

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

commit 5f7da044f8bc1cfb21c962edf34bd5699a76e7ae upstream.

This patch fixes a NULL pointer dereference triggered by a late
target_configure_device() -> alloc_workqueue() failure that results
in target_free_device() being called with DF_CONFIGURED already set,
which subsequently OOPses in destroy_workqueue() code.

Currently this only happens at modprobe target_core_mod time when
core_dev_setup_virtual_lun0() -> target_configure_device() fails,
and the explicit target_free_device() gets called.

To address this bug originally introduced by commit 0fd97ccf45, go
ahead and move DF_CONFIGURED to end of target_configure_device()
code to handle this special failure case.

Reported-by: Claudio Fleiner <cmf@daterainc.com>
Cc: Claudio Fleiner <cmf@daterainc.com>
Cc: Christoph Hellwig <hch@lst.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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index e205bdbe14b2..5478aca8f4e6 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -1591,8 +1591,6 @@ int target_configure_device(struct se_device *dev)
 	ret = dev->transport->configure_device(dev);
 	if (ret)
 		goto out;
-	dev->dev_flags |= DF_CONFIGURED;
-
 	/*
 	 * XXX: there is not much point to have two different values here..
 	 */
@@ -1654,6 +1652,8 @@ int target_configure_device(struct se_device *dev)
 	list_add_tail(&dev->g_dev_node, &g_device_list);
 	mutex_unlock(&g_device_mutex);
 
+	dev->dev_flags |= DF_CONFIGURED;
+
 	return 0;
 
 out_free_alua:

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

* [PATCH 3.16.y-ckt 067/144] arm64: Honor __GFP_ZERO in dma allocations
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (65 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 066/144] target: Fix virtual LUN=0 target_configure_device failure OOPs Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 068/144] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Luis Henriques
                   ` (76 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Suzuki K. Poulose, Catalin Marinas, Luis Henriques

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

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

From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>

commit 7132813c384515c9dede1ae20e56f3895feb7f1e upstream.

Current implementation doesn't zero out the pages allocated.
Honor the __GFP_ZERO flag and zero out if set.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ luis: backported to 3.16: based on Suzuki's 3.14 backport ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/mm/dma-mapping.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 4164c5ace9f8..de3abbe6c59f 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -55,6 +55,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
 		flags |= GFP_DMA;
 	if (IS_ENABLED(CONFIG_DMA_CMA)) {
 		struct page *page;
+		void *addr;
 
 		size = PAGE_ALIGN(size);
 		page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT,
@@ -63,7 +64,10 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
 			return NULL;
 
 		*dma_handle = phys_to_dma(dev, page_to_phys(page));
-		return page_address(page);
+		addr = page_address(page);
+		if (flags & __GFP_ZERO)
+			memset(addr, 0, size);
+		return addr;
 	} else {
 		return swiotlb_alloc_coherent(dev, size, dma_handle, flags);
 	}

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

* [PATCH 3.16.y-ckt 068/144] IB/mlx4: Saturate RoCE port PMA counters in case of overflow
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (66 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 067/144] arm64: Honor __GFP_ZERO in dma allocations Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 069/144] dmaengine: dw: append MODULE_ALIAS for platform driver Luis Henriques
                   ` (75 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Majd Dibbiny, Eran Ben Elisha, Hadar Hen Zion, Or Gerlitz,
	David S. Miller, Luis Henriques

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

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

From: Majd Dibbiny <majd@mellanox.com>

commit 61a3855bb726cbb062ef02a31a832dea455456e0 upstream.

For RoCE ports, we set the u32 PMA values based on u64 HCA counters. In case of
overflow, according to the IB spec, we have to saturate a counter to its
max value, do that.

Fixes: c37791349cc7 ('IB/mlx4: Support PMA counters for IBoE')
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/hw/mlx4/mad.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 287ad0564acd..c128abd5f4c2 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -64,6 +64,14 @@ enum {
 #define GUID_TBL_BLK_NUM_ENTRIES 8
 #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES)
 
+/* Counters should be saturate once they reach their maximum value */
+#define ASSIGN_32BIT_COUNTER(counter, value) do {\
+	if ((value) > U32_MAX)			 \
+		counter = cpu_to_be32(U32_MAX); \
+	else					 \
+		counter = cpu_to_be32(value);	 \
+} while (0)
+
 struct mlx4_mad_rcv_buf {
 	struct ib_grh grh;
 	u8 payload[256];
@@ -806,10 +814,14 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
 static void edit_counter(struct mlx4_counter *cnt,
 					struct ib_pma_portcounters *pma_cnt)
 {
-	pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2));
-	pma_cnt->port_rcv_data  = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2));
-	pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames));
-	pma_cnt->port_rcv_packets  = cpu_to_be32(be64_to_cpu(cnt->rx_frames));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data,
+			     (be64_to_cpu(cnt->tx_bytes) >> 2));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data,
+			     (be64_to_cpu(cnt->rx_bytes) >> 2));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets,
+			     be64_to_cpu(cnt->tx_frames));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets,
+			     be64_to_cpu(cnt->rx_frames));
 }
 
 static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,

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

* [PATCH 3.16.y-ckt 069/144] dmaengine: dw: append MODULE_ALIAS for platform driver
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (67 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 068/144] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 070/144] xfrm: release dst_orig in case of error in xfrm_lookup() Luis Henriques
                   ` (74 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Shevchenko, Vinod Koul, Luis Henriques

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

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

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit a104a45ba7a51b5b4c5e8437020d9d48edf22f89 upstream.

The commit 9cade1a46c77 (dma: dw: split driver to library part and platform
code) introduced a separate platform driver but missed to add a
MODULE_ALIAS("platform:dw_dmac"); to that module.

The patch adds this to get driver loaded automatically if platform device is
registered.

Reported-by: "Blin, Jerome" <jerome.blin@intel.com>
Fixes: 9cade1a46c77 (dma: dw: split driver to library part and platform code)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/dma/dw/platform.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index c5b339af6be5..43157e151a22 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -25,6 +25,8 @@
 
 #include "internal.h"
 
+#define DRV_NAME	"dw_dmac"
+
 struct dw_dma_of_filter_args {
 	struct dw_dma *dw;
 	unsigned int req;
@@ -283,7 +285,7 @@ static struct platform_driver dw_driver = {
 	.remove		= dw_remove,
 	.shutdown	= dw_shutdown,
 	.driver = {
-		.name	= "dw_dmac",
+		.name	= DRV_NAME,
 		.pm	= &dw_dev_pm_ops,
 		.of_match_table = of_match_ptr(dw_dma_of_id_table),
 		.acpi_match_table = ACPI_PTR(dw_dma_acpi_id_table),
@@ -304,3 +306,4 @@ module_exit(dw_exit);
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller platform driver");
+MODULE_ALIAS("platform:" DRV_NAME);

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

* [PATCH 3.16.y-ckt 070/144] xfrm: release dst_orig in case of error in xfrm_lookup()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (68 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 069/144] dmaengine: dw: append MODULE_ALIAS for platform driver Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 071/144] staging: vt6656: vnt_rf_setpower: fix missing rate RATE_12M Luis Henriques
                   ` (73 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: huaibin Wang, Nicolas Dichtel, Steffen Klassert, Luis Henriques

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

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

From: huaibin Wang <huaibin.wang@6wind.com>

commit ac37e2515c1a89c477459a2020b6bfdedabdb91b upstream.

dst_orig should be released on error. Function like __xfrm_route_forward()
expects that behavior.
Since a recent commit, xfrm_lookup() may also be called by xfrm_lookup_route(),
which expects the opposite.
Let's introduce a new flag (XFRM_LOOKUP_KEEP_DST_REF) to tell what should be
done in case of error.

Fixes: f92ee61982d("xfrm: Generate blackhole routes only from route lookup functions")
Signed-off-by: huaibin Wang <huaibin.wang@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/net/dst.h      |  1 +
 net/xfrm/xfrm_policy.c | 12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index a8ae4e760778..0fb99a26e973 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -481,6 +481,7 @@ void dst_init(void);
 enum {
 	XFRM_LOOKUP_ICMP = 1 << 0,
 	XFRM_LOOKUP_QUEUE = 1 << 1,
+	XFRM_LOOKUP_KEEP_DST_REF = 1 << 2,
 };
 
 struct flowi;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 93e755b97486..d4d6fc96f6c5 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2149,11 +2149,9 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
 		 * have the xfrm_state's. We need to wait for KM to
 		 * negotiate new SA's or bail out with error.*/
 		if (net->xfrm.sysctl_larval_drop) {
-			dst_release(dst);
-			xfrm_pols_put(pols, drop_pols);
 			XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES);
-
-			return ERR_PTR(-EREMOTE);
+			err = -EREMOTE;
+			goto error;
 		}
 
 		err = -EAGAIN;
@@ -2204,7 +2202,8 @@ nopol:
 error:
 	dst_release(dst);
 dropdst:
-	dst_release(dst_orig);
+	if (!(flags & XFRM_LOOKUP_KEEP_DST_REF))
+		dst_release(dst_orig);
 	xfrm_pols_put(pols, drop_pols);
 	return ERR_PTR(err);
 }
@@ -2218,7 +2217,8 @@ struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig,
 				    struct sock *sk, int flags)
 {
 	struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk,
-					    flags | XFRM_LOOKUP_QUEUE);
+					    flags | XFRM_LOOKUP_QUEUE |
+					    XFRM_LOOKUP_KEEP_DST_REF);
 
 	if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE)
 		return make_blackhole(net, dst_orig->ops->family, dst_orig);

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

* [PATCH 3.16.y-ckt 071/144] staging: vt6656: vnt_rf_setpower: fix missing rate RATE_12M
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (69 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 070/144] xfrm: release dst_orig in case of error in xfrm_lookup() Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 072/144] Btrfs: make xattr replace operations atomic Luis Henriques
                   ` (72 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Malcolm Priestley, Greg Kroah-Hartman, Luis Henriques

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

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

From: Malcolm Priestley <tvboxspy@gmail.com>

commit 163fe301b9f78b6de57d0014eafe504fd20c0cd4 upstream.

When the driver sets this rate a power of zero value is set causing
data flow stoppage until another rate is tried.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/vt6656/rf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 3f54ae3cfb4e..ef876aba5e48 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -749,6 +749,7 @@ int vnt_rf_setpower(struct vnt_private *priv, u32 rate, u32 channel)
 		break;
 	case RATE_6M:
 	case RATE_9M:
+	case RATE_12M:
 	case RATE_18M:
 	case RATE_24M:
 	case RATE_36M:

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

* [PATCH 3.16.y-ckt 072/144] Btrfs: make xattr replace operations atomic
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (70 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 071/144] staging: vt6656: vnt_rf_setpower: fix missing rate RATE_12M Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 073/144] x86/microcode/intel: Guard against stack overflow in the loader Luis Henriques
                   ` (71 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Filipe Manana, Chris Mason, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit 5f5bc6b1e2d5a6f827bc860ef2dc5b6f365d1339 upstream.

Replacing a xattr consists of doing a lookup for its existing value, delete
the current value from the respective leaf, release the search path and then
finally insert the new value. This leaves a time window where readers (getxattr,
listxattrs) won't see any value for the xattr. Xattrs are used to store ACLs,
so this has security implications.

This change also fixes 2 other existing issues which were:

*) Deleting the old xattr value without verifying first if the new xattr will
   fit in the existing leaf item (in case multiple xattrs are packed in the
   same item due to name hash collision);

*) Returning -EEXIST when the flag XATTR_CREATE is given and the xattr doesn't
   exist but we have have an existing item that packs muliple xattrs with
   the same name hash as the input xattr. In this case we should return ENOSPC.

A test case for xfstests follows soon.

Thanks to Alexandre Oliva for reporting the non-atomicity of the xattr replace
implementation.

Reported-by: Alexandre Oliva <oliva@gnu.org>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/ctree.c    |   2 +-
 fs/btrfs/ctree.h    |   5 ++
 fs/btrfs/dir-item.c |  10 ++--
 fs/btrfs/xattr.c    | 150 ++++++++++++++++++++++++++++++++--------------------
 4 files changed, 102 insertions(+), 65 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 49f8392662b6..5d4adb55b07b 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2929,7 +2929,7 @@ done:
 	 */
 	if (!p->leave_spinning)
 		btrfs_set_path_blocking(p);
-	if (ret < 0)
+	if (ret < 0 && !p->skip_release_on_error)
 		btrfs_release_path(p);
 	return ret;
 }
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index be91397f4e92..efb0b8953fa5 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -611,6 +611,7 @@ struct btrfs_path {
 	unsigned int leave_spinning:1;
 	unsigned int search_commit_root:1;
 	unsigned int need_commit_sem:1;
+	unsigned int skip_release_on_error:1;
 };
 
 /*
@@ -3695,6 +3696,10 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
 int verify_dir_item(struct btrfs_root *root,
 		    struct extent_buffer *leaf,
 		    struct btrfs_dir_item *dir_item);
+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
+						 struct btrfs_path *path,
+						 const char *name,
+						 int name_len);
 
 /* orphan.c */
 int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index a0691df5dcea..9521a93b5303 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -21,10 +21,6 @@
 #include "hash.h"
 #include "transaction.h"
 
-static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
-			      struct btrfs_path *path,
-			      const char *name, int name_len);
-
 /*
  * insert a name into a directory, doing overflow properly if there is a hash
  * collision.  data_size indicates how big the item inserted should be.  On
@@ -383,9 +379,9 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
  * this walks through all the entries in a dir item and finds one
  * for a specific name.
  */
-static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
-			      struct btrfs_path *path,
-			      const char *name, int name_len)
+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
+						 struct btrfs_path *path,
+						 const char *name, int name_len)
 {
 	struct btrfs_dir_item *dir_item;
 	unsigned long name_ptr;
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index ad8328d797ea..7b29ee23b4ad 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -29,6 +29,7 @@
 #include "xattr.h"
 #include "disk-io.h"
 #include "props.h"
+#include "locking.h"
 
 
 ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
@@ -91,7 +92,7 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
 		       struct inode *inode, const char *name,
 		       const void *value, size_t size, int flags)
 {
-	struct btrfs_dir_item *di;
+	struct btrfs_dir_item *di = NULL;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_path *path;
 	size_t name_len = strlen(name);
@@ -103,84 +104,119 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
 	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
+	path->skip_release_on_error = 1;
+
+	if (!value) {
+		di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode),
+					name, name_len, -1);
+		if (!di && (flags & XATTR_REPLACE))
+			ret = -ENODATA;
+		else if (di)
+			ret = btrfs_delete_one_dir_name(trans, root, path, di);
+		goto out;
+	}
 
+	/*
+	 * For a replace we can't just do the insert blindly.
+	 * Do a lookup first (read-only btrfs_search_slot), and return if xattr
+	 * doesn't exist. If it exists, fall down below to the insert/replace
+	 * path - we can't race with a concurrent xattr delete, because the VFS
+	 * locks the inode's i_mutex before calling setxattr or removexattr.
+	 */
 	if (flags & XATTR_REPLACE) {
-		di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), name,
-					name_len, -1);
-		if (IS_ERR(di)) {
-			ret = PTR_ERR(di);
-			goto out;
-		} else if (!di) {
+		ASSERT(mutex_is_locked(&inode->i_mutex));
+		di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode),
+					name, name_len, 0);
+		if (!di) {
 			ret = -ENODATA;
 			goto out;
 		}
-		ret = btrfs_delete_one_dir_name(trans, root, path, di);
-		if (ret)
-			goto out;
 		btrfs_release_path(path);
+		di = NULL;
+	}
 
+	ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode),
+				      name, name_len, value, size);
+	if (ret == -EOVERFLOW) {
 		/*
-		 * remove the attribute
+		 * We have an existing item in a leaf, split_leaf couldn't
+		 * expand it. That item might have or not a dir_item that
+		 * matches our target xattr, so lets check.
 		 */
-		if (!value)
-			goto out;
-	} else {
-		di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode),
-					name, name_len, 0);
-		if (IS_ERR(di)) {
-			ret = PTR_ERR(di);
+		ret = 0;
+		btrfs_assert_tree_locked(path->nodes[0]);
+		di = btrfs_match_dir_item_name(root, path, name, name_len);
+		if (!di && !(flags & XATTR_REPLACE)) {
+			ret = -ENOSPC;
 			goto out;
 		}
-		if (!di && !value)
-			goto out;
-		btrfs_release_path(path);
+	} else if (ret == -EEXIST) {
+		ret = 0;
+		di = btrfs_match_dir_item_name(root, path, name, name_len);
+		ASSERT(di); /* logic error */
+	} else if (ret) {
+		goto out;
 	}
 
-again:
-	ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode),
-				      name, name_len, value, size);
-	/*
-	 * If we're setting an xattr to a new value but the new value is say
-	 * exactly BTRFS_MAX_XATTR_SIZE, we could end up with EOVERFLOW getting
-	 * back from split_leaf.  This is because it thinks we'll be extending
-	 * the existing item size, but we're asking for enough space to add the
-	 * item itself.  So if we get EOVERFLOW just set ret to EEXIST and let
-	 * the rest of the function figure it out.
-	 */
-	if (ret == -EOVERFLOW)
+	if (di && (flags & XATTR_CREATE)) {
 		ret = -EEXIST;
+		goto out;
+	}
 
-	if (ret == -EEXIST) {
-		if (flags & XATTR_CREATE)
-			goto out;
+	if (di) {
 		/*
-		 * We can't use the path we already have since we won't have the
-		 * proper locking for a delete, so release the path and
-		 * re-lookup to delete the thing.
+		 * We're doing a replace, and it must be atomic, that is, at
+		 * any point in time we have either the old or the new xattr
+		 * value in the tree. We don't want readers (getxattr and
+		 * listxattrs) to miss a value, this is specially important
+		 * for ACLs.
 		 */
-		btrfs_release_path(path);
-		di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode),
-					name, name_len, -1);
-		if (IS_ERR(di)) {
-			ret = PTR_ERR(di);
-			goto out;
-		} else if (!di) {
-			/* Shouldn't happen but just in case... */
-			btrfs_release_path(path);
-			goto again;
+		const int slot = path->slots[0];
+		struct extent_buffer *leaf = path->nodes[0];
+		const u16 old_data_len = btrfs_dir_data_len(leaf, di);
+		const u32 item_size = btrfs_item_size_nr(leaf, slot);
+		const u32 data_size = sizeof(*di) + name_len + size;
+		struct btrfs_item *item;
+		unsigned long data_ptr;
+		char *ptr;
+
+		if (size > old_data_len) {
+			if (btrfs_leaf_free_space(root, leaf) <
+			    (size - old_data_len)) {
+				ret = -ENOSPC;
+				goto out;
+			}
 		}
 
-		ret = btrfs_delete_one_dir_name(trans, root, path, di);
-		if (ret)
-			goto out;
+		if (old_data_len + name_len + sizeof(*di) == item_size) {
+			/* No other xattrs packed in the same leaf item. */
+			if (size > old_data_len)
+				btrfs_extend_item(root, path,
+						  size - old_data_len);
+			else if (size < old_data_len)
+				btrfs_truncate_item(root, path, data_size, 1);
+		} else {
+			/* There are other xattrs packed in the same item. */
+			ret = btrfs_delete_one_dir_name(trans, root, path, di);
+			if (ret)
+				goto out;
+			btrfs_extend_item(root, path, data_size);
+		}
 
+		item = btrfs_item_nr(slot);
+		ptr = btrfs_item_ptr(leaf, slot, char);
+		ptr += btrfs_item_size(leaf, item) - data_size;
+		di = (struct btrfs_dir_item *)ptr;
+		btrfs_set_dir_data_len(leaf, di, size);
+		data_ptr = ((unsigned long)(di + 1)) + name_len;
+		write_extent_buffer(leaf, value, data_ptr, size);
+		btrfs_mark_buffer_dirty(leaf);
+	} else {
 		/*
-		 * We have a value to set, so go back and try to insert it now.
+		 * Insert, and we had space for the xattr, so path->slots[0] is
+		 * where our xattr dir_item is and btrfs_insert_xattr_item()
+		 * filled it.
 		 */
-		if (value) {
-			btrfs_release_path(path);
-			goto again;
-		}
 	}
 out:
 	btrfs_free_path(path);

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

* [PATCH 3.16.y-ckt 073/144] x86/microcode/intel: Guard against stack overflow in the loader
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (71 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 072/144] Btrfs: make xattr replace operations atomic Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 074/144] powerpc/smp: Wait until secondaries are active & online Luis Henriques
                   ` (70 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Quentin Casasnovas, H. Peter Anvin, Fenghua Yu, Borislav Petkov,
	Luis Henriques

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

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

From: Quentin Casasnovas <quentin.casasnovas@oracle.com>

commit f84598bd7c851f8b0bf8cd0d7c3be0d73c432ff4 upstream.

mc_saved_tmp is a static array allocated on the stack, we need to make
sure mc_saved_count stays within its bounds, otherwise we're overflowing
the stack in _save_mc(). A specially crafted microcode header could lead
to a kernel crash or potentially kernel execution.

Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Link: http://lkml.kernel.org/r/1422964824-22056-1-git-send-email-quentin.casasnovas@oracle.com
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/cpu/microcode/intel_early.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c
index 18f739129e72..43a07bf48dea 100644
--- a/arch/x86/kernel/cpu/microcode/intel_early.c
+++ b/arch/x86/kernel/cpu/microcode/intel_early.c
@@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
 	unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
 	int i;
 
-	while (leftover) {
+	while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
 		mc_header = (struct microcode_header_intel *)ucode_ptr;
 
 		mc_size = get_totalsize(mc_header);

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

* [PATCH 3.16.y-ckt 074/144] powerpc/smp: Wait until secondaries are active & online
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (72 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 073/144] x86/microcode/intel: Guard against stack overflow in the loader Luis Henriques
@ 2015-04-21 15:30 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 075/144] powerpc/iommu: Remove IOMMU device references via bus notifier Luis Henriques
                   ` (69 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:30 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Ellerman, Anton Blanchard, Luis Henriques

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

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

From: Michael Ellerman <mpe@ellerman.id.au>

commit 875ebe940d77a41682c367ad799b4f39f128d3fa upstream.

Anton has a busy ppc64le KVM box where guests sometimes hit the infamous
"kernel BUG at kernel/smpboot.c:134!" issue during boot:

  BUG_ON(td->cpu != smp_processor_id());

Basically a per CPU hotplug thread scheduled on the wrong CPU. The oops
output confirms it:

  CPU: 0
  Comm: watchdog/130

The problem is that we aren't ensuring the CPU active bit is set for the
secondary before allowing the master to continue on. The master unparks
the secondary CPU's kthreads and the scheduler looks for a CPU to run
on. It calls select_task_rq() and realises the suggested CPU is not in
the cpus_allowed mask. It then ends up in select_fallback_rq(), and
since the active bit isnt't set we choose some other CPU to run on.

This seems to have been introduced by 6acbfb96976f "sched: Fix hotplug
vs. set_cpus_allowed_ptr()", which changed from setting active before
online to setting active after online. However that was in turn fixing a
bug where other code assumed an active CPU was also online, so we can't
just revert that fix.

The simplest fix is just to spin waiting for both active & online to be
set. We already have a barrier prior to set_cpu_online() (which also
sets active), to ensure all other setup is completed before online &
active are set.

Fixes: 6acbfb96976f ("sched: Fix hotplug vs. set_cpus_allowed_ptr()")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/kernel/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 1007fb802e6b..383859d125de 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -546,8 +546,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
 	if (smp_ops->give_timebase)
 		smp_ops->give_timebase();
 
-	/* Wait until cpu puts itself in the online map */
-	while (!cpu_online(cpu))
+	/* Wait until cpu puts itself in the online & active maps */
+	while (!cpu_online(cpu) || !cpu_active(cpu))
 		cpu_relax();
 
 	return 0;

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

* [PATCH 3.16.y-ckt 075/144] powerpc/iommu: Remove IOMMU device references via bus notifier
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (73 preceding siblings ...)
  2015-04-21 15:30 ` [PATCH 3.16.y-ckt 074/144] powerpc/smp: Wait until secondaries are active & online Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 076/144] powerpc/mpc85xx: Add ranges to etsec2 nodes Luis Henriques
                   ` (68 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nishanth Aravamudan, Michael Ellerman, Luis Henriques

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

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

From: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>

commit 4ad04e5987115ece5fa8a0cf1dc72fcd4707e33e upstream.

After d905c5df9aef ("PPC: POWERNV: move iommu_add_device earlier"), the
refcnt on the kobject backing the IOMMU group for a PCI device is
elevated by each call to pci_dma_dev_setup_pSeriesLP() (via
set_iommu_table_base_and_group). When we go to dlpar a multi-function
PCI device out:

        iommu_reconfig_notifier ->
                iommu_free_table ->
                        iommu_group_put
                        BUG_ON(tbl->it_group)

We trip this BUG_ON, because there are still references on the table, so
it is not freed. Fix this by moving the powernv bus notifier to common
code and calling it for both powernv and pseries.

Fixes: d905c5df9aef ("PPC: POWERNV: move iommu_add_device earlier")
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Tested-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/include/asm/iommu.h       |  6 ++++++
 arch/powerpc/kernel/iommu.c            | 26 ++++++++++++++++++++++++++
 arch/powerpc/platforms/powernv/pci.c   | 27 ---------------------------
 arch/powerpc/platforms/pseries/iommu.c |  2 ++
 4 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index 42632c7a2a4e..5b51ca28425e 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -113,6 +113,7 @@ extern void iommu_register_group(struct iommu_table *tbl,
 				 int pci_domain_number, unsigned long pe_num);
 extern int iommu_add_device(struct device *dev);
 extern void iommu_del_device(struct device *dev);
+extern int __init tce_iommu_bus_notifier_init(void);
 #else
 static inline void iommu_register_group(struct iommu_table *tbl,
 					int pci_domain_number,
@@ -128,6 +129,11 @@ static inline int iommu_add_device(struct device *dev)
 static inline void iommu_del_device(struct device *dev)
 {
 }
+
+static inline int __init tce_iommu_bus_notifier_init(void)
+{
+        return 0;
+}
 #endif /* !CONFIG_IOMMU_API */
 
 static inline void set_iommu_table_base_and_group(struct device *dev,
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 48fb2c18fa81..2ee19a583b2b 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -1175,4 +1175,30 @@ void iommu_del_device(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(iommu_del_device);
 
+static int tce_iommu_bus_notifier(struct notifier_block *nb,
+                unsigned long action, void *data)
+{
+        struct device *dev = data;
+
+        switch (action) {
+        case BUS_NOTIFY_ADD_DEVICE:
+                return iommu_add_device(dev);
+        case BUS_NOTIFY_DEL_DEVICE:
+                if (dev->iommu_group)
+                        iommu_del_device(dev);
+                return 0;
+        default:
+                return 0;
+        }
+}
+
+static struct notifier_block tce_iommu_bus_nb = {
+        .notifier_call = tce_iommu_bus_notifier,
+};
+
+int __init tce_iommu_bus_notifier_init(void)
+{
+        bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
+        return 0;
+}
 #endif /* CONFIG_IOMMU_API */
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 8326838ab6f6..1e539d019973 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -815,31 +815,4 @@ void __init pnv_pci_init(void)
 #endif
 }
 
-static int tce_iommu_bus_notifier(struct notifier_block *nb,
-		unsigned long action, void *data)
-{
-	struct device *dev = data;
-
-	switch (action) {
-	case BUS_NOTIFY_ADD_DEVICE:
-		return iommu_add_device(dev);
-	case BUS_NOTIFY_DEL_DEVICE:
-		if (dev->iommu_group)
-			iommu_del_device(dev);
-		return 0;
-	default:
-		return 0;
-	}
-}
-
-static struct notifier_block tce_iommu_bus_nb = {
-	.notifier_call = tce_iommu_bus_notifier,
-};
-
-static int __init tce_iommu_bus_notifier_init(void)
-{
-	bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
-	return 0;
-}
-
 subsys_initcall_sync(tce_iommu_bus_notifier_init);
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index de1ec54a2a57..78723292c883 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1341,3 +1341,5 @@ static int __init disable_multitce(char *str)
 }
 
 __setup("multitce=", disable_multitce);
+
+machine_subsys_initcall_sync(pseries, tce_iommu_bus_notifier_init);

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

* [PATCH 3.16.y-ckt 076/144] powerpc/mpc85xx: Add ranges to etsec2 nodes
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (74 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 075/144] powerpc/iommu: Remove IOMMU device references via bus notifier Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 077/144] IB/core: Avoid leakage from kernel to user space Luis Henriques
                   ` (67 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Scott Wood, Luis Henriques

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

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

From: Scott Wood <scottwood@freescale.com>

commit bb344ca5b90df62b1a3b7a35c6a9d00b306a170d upstream.

Commit 746c9e9f92dd "of/base: Fix PowerPC address parsing hack" limited
the applicability of the workaround whereby a missing ranges is treated
as an empty ranges.  This workaround was hiding a bug in the etsec2
device tree nodes, which have children with reg, but did not have
ranges.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi | 1 +
 arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi | 1 +
 arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi
index 1382fec9e8c5..7fcb1ac0f232 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi
@@ -50,6 +50,7 @@ ethernet@b0000 {
 	fsl,num_tx_queues = <0x8>;
 	fsl,magic-packet;
 	local-mac-address = [ 00 00 00 00 00 00 ];
+	ranges;
 
 	queue-group@b0000 {
 		#address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi
index 221cd2ea5b31..9f25427c1527 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi
@@ -50,6 +50,7 @@ ethernet@b1000 {
 	fsl,num_tx_queues = <0x8>;
 	fsl,magic-packet;
 	local-mac-address = [ 00 00 00 00 00 00 ];
+	ranges;
 
 	queue-group@b1000 {
 		#address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi
index 61456c317609..cd7c318ab131 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi
@@ -49,6 +49,7 @@ ethernet@b2000 {
 	fsl,num_tx_queues = <0x8>;
 	fsl,magic-packet;
 	local-mac-address = [ 00 00 00 00 00 00 ];
+	ranges;
 
 	queue-group@b2000 {
 		#address-cells = <1>;

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

* [PATCH 3.16.y-ckt 077/144] IB/core: Avoid leakage from kernel to user space
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (75 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 076/144] powerpc/mpc85xx: Add ranges to etsec2 nodes Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 078/144] timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop Luis Henriques
                   ` (66 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eli Cohen, Roland Dreier, Luis Henriques

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

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

From: Eli Cohen <eli@dev.mellanox.co.il>

commit 377b513485fd885dea1083a9a5430df65b35e048 upstream.

Clear the reserved field of struct ib_uverbs_async_event_desc which is
copied to user space.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/core/uverbs_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 08219fb3338b..7a515c867674 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -476,6 +476,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file,
 
 	entry->desc.async.element    = element;
 	entry->desc.async.event_type = event;
+	entry->desc.async.reserved   = 0;
 	entry->counter               = counter;
 
 	list_add_tail(&entry->list, &file->async_file->event_list);

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

* [PATCH 3.16.y-ckt 078/144] timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (76 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 077/144] IB/core: Avoid leakage from kernel to user space Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 079/144] ALSA: hda - Add one more node in the EAPD supporting candidate list Luis Henriques
                   ` (65 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Preeti U Murthy, Peter Zijlstra (Intel),
	linuxppc-dev, mpe, tglx, Ingo Molnar, Luis Henriques

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

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

From: Preeti U Murthy <preeti@linux.vnet.ibm.com>

commit a127d2bcf1fbc8c8e0b5cf0dab54f7d3ff50ce47 upstream.

The hrtimer mode of broadcast queues hrtimers in the idle entry
path so as to wakeup cpus in deep idle states. The associated
call graph is :

	cpuidle_idle_call()
	|____ clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, ....))
	     |_____tick_broadcast_set_event()
		   |____clockevents_program_event()
			|____bc_set_next()

The hrtimer_{start/cancel} functions call into tracing which uses RCU.
But it is not legal to call into RCU in cpuidle because it is one of the
quiescent states. Hence protect this region with RCU_NONIDLE which informs
RCU that the cpu is momentarily non-idle.

As an aside it is helpful to point out that the clock event device that is
programmed here is not a per-cpu clock device; it is a
pseudo clock device, used by the broadcast framework alone.
The per-cpu clock device programming never goes through bc_set_next().

Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org
Cc: mpe@ellerman.id.au
Cc: tglx@linutronix.de
Link: http://lkml.kernel.org/r/20150318104705.17763.56668.stgit@preeti.in.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/time/tick-broadcast-hrtimer.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c
index eb682d5c697c..6aac4beedbbe 100644
--- a/kernel/time/tick-broadcast-hrtimer.c
+++ b/kernel/time/tick-broadcast-hrtimer.c
@@ -49,6 +49,7 @@ static void bc_set_mode(enum clock_event_mode mode,
  */
 static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
 {
+	int bc_moved;
 	/*
 	 * We try to cancel the timer first. If the callback is on
 	 * flight on some other cpu then we let it handle it. If we
@@ -60,9 +61,15 @@ static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
 	 * restart the timer because we are in the callback, but we
 	 * can set the expiry time and let the callback return
 	 * HRTIMER_RESTART.
+	 *
+	 * Since we are in the idle loop at this point and because
+	 * hrtimer_{start/cancel} functions call into tracing,
+	 * calls to these functions must be bound within RCU_NONIDLE.
 	 */
-	if (hrtimer_try_to_cancel(&bctimer) >= 0) {
-		hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED);
+	RCU_NONIDLE(bc_moved = (hrtimer_try_to_cancel(&bctimer) >= 0) ?
+		!hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED) :
+			0);
+	if (bc_moved) {
 		/* Bind the "device" to the cpu */
 		bc->bound_on = smp_processor_id();
 	} else if (bc->bound_on == smp_processor_id()) {

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

* [PATCH 3.16.y-ckt 079/144] ALSA: hda - Add one more node in the EAPD supporting candidate list
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (77 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 078/144] timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 080/144] serial: 8250_dw: Fix deadlock in LCR workaround Luis Henriques
                   ` (64 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Hui Wang, Takashi Iwai, Luis Henriques

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

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

From: Hui Wang <hui.wang@canonical.com>

commit af95b41426e0b58279f8ff0ebe420df49a4e96b8 upstream.

We have a HP machine which use the codec node 0x17 connecting the
internal speaker, and from the node capability, we saw the EAPD,
if we don't set the EAPD on for this node, the internal speaker
can't output any sound.

BugLink: https://bugs.launchpad.net/bugs/1436745
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f7c6e6e3ce66..9e8dd403802c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -271,7 +271,7 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
 {
 	/* We currently only handle front, HP */
 	static hda_nid_t pins[] = {
-		0x0f, 0x10, 0x14, 0x15, 0
+		0x0f, 0x10, 0x14, 0x15, 0x17, 0
 	};
 	hda_nid_t *p;
 	for (p = pins; *p; p++)

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

* [PATCH 3.16.y-ckt 080/144] serial: 8250_dw: Fix deadlock in LCR workaround
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (78 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 079/144] ALSA: hda - Add one more node in the EAPD supporting candidate list Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 081/144] drm/i915/bdw: PCI IDs ending in 0xb are ULT Luis Henriques
                   ` (63 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tim Kryger, Peter Hurley, Greg Kroah-Hartman, Luis Henriques

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

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

From: Peter Hurley <peter@hurleysoftware.com>

commit 7fd6f640f2dd17dac6ddd6702c378cb0bb9cfa11 upstream.

Trying to write console output from within the serial console driver
while the port->lock is held causes recursive deadlock:

  CPU 0
spin_lock_irqsave(&port->lock)
printk()
  console_unlock()
    call_console_drivers()
      serial8250_console_write()
        spin_lock_irqsave(&port->lock)
** DEADLOCK **

The 8250_dw i/o accessors try to write a console error message if the
LCR workaround was unsuccessful. When the port->lock is already held
(eg., when called from serial8250_set_termios()), this deadlocks.

Make the error message a FIXME until a general solution is devised.

Cc: Tim Kryger <tim.kryger@gmail.com>
Reported-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16:
  - dropped changes to dw8250_serial_outq() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/serial/8250/8250_dw.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 51b307aab75e..f4e14f9baae5 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -165,7 +165,10 @@ static void dw8250_serial_out(struct uart_port *p, int offset, int value)
 			dw8250_force_idle(p);
 			writeb(value, p->membase + (UART_LCR << p->regshift));
 		}
-		dev_err(p->dev, "Couldn't set LCR to %d\n", value);
+		/*
+		 * FIXME: this deadlocks if port->lock is already held
+		 * dev_err(p->dev, "Couldn't set LCR to %d\n", value);
+		 */
 	}
 }
 
@@ -202,7 +205,10 @@ static void dw8250_serial_out32(struct uart_port *p, int offset, int value)
 			dw8250_force_idle(p);
 			writel(value, p->membase + (UART_LCR << p->regshift));
 		}
-		dev_err(p->dev, "Couldn't set LCR to %d\n", value);
+		/*
+		 * FIXME: this deadlocks if port->lock is already held
+		 * dev_err(p->dev, "Couldn't set LCR to %d\n", value);
+		 */
 	}
 }
 

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

* [PATCH 3.16.y-ckt 081/144] drm/i915/bdw: PCI IDs ending in 0xb are ULT.
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (79 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 080/144] serial: 8250_dw: Fix deadlock in LCR workaround Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 082/144] btrfs: simplify insert_orphan_item Luis Henriques
                   ` (62 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jani Nikula, Rodrigo Vivi, Luis Henriques

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

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

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

commit 0dc6f20b9803f09726bbb682649d35cda8ef5b5d upstream.

When reviewing patch that fixes VGA on BDW Halo Jani noticed that
we also had other ULT IDs that weren't listed there.

So this follow-up patch add these pci-ids as halo and fix comments
on i915_pciids.h

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 include/drm/i915_pciids.h       | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 67d5f61e29a9..09501070d7cd 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1900,6 +1900,7 @@ struct drm_i915_cmd_table {
 				 ((dev)->pdev->device & 0xFF00) == 0x0C00)
 #define IS_BDW_ULT(dev)		(IS_BROADWELL(dev) && \
 				 (((dev)->pdev->device & 0xf) == 0x6 || \
+				 ((dev)->pdev->device & 0xf) == 0xb  || \
 				 ((dev)->pdev->device & 0xf) == 0xe))
 #define IS_HSW_ULT(dev)		(IS_HASWELL(dev) && \
 				 ((dev)->pdev->device & 0xFF00) == 0x0A00)
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index a70d45647898..47116c87ab10 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -214,9 +214,9 @@
 	INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info)
 
 #define _INTEL_BDW_M_IDS(gt, info) \
-	_INTEL_BDW_M(gt, 0x1602, info), /* ULT */ \
+	_INTEL_BDW_M(gt, 0x1602, info), /* Halo */ \
 	_INTEL_BDW_M(gt, 0x1606, info), /* ULT */ \
-	_INTEL_BDW_M(gt, 0x160B, info), /* Iris */ \
+	_INTEL_BDW_M(gt, 0x160B, info), /* ULT */ \
 	_INTEL_BDW_M(gt, 0x160E, info) /* ULX */
 
 #define _INTEL_BDW_D_IDS(gt, info) \

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

* [PATCH 3.16.y-ckt 082/144] btrfs: simplify insert_orphan_item
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (80 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 081/144] drm/i915/bdw: PCI IDs ending in 0xb are ULT Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 083/144] ARM: sunxi: Have ARCH_SUNXI select RESET_CONTROLLER for clock driver usage Luis Henriques
                   ` (61 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Sterba, Chris Mason, Luis Henriques

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

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

From: David Sterba <dsterba@suse.cz>

commit 9c4f61f01d269815bb7c37be3ede59c5587747c6 upstream.

We can search and add the orphan item in one go,
btrfs_insert_orphan_item will find out if the item already exists.

Signed-off-by: David Sterba <dsterba@suse.cz>
Cc: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/tree-log.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 0a8194955e6b..700e6d860e0c 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1263,21 +1263,13 @@ out:
 }
 
 static int insert_orphan_item(struct btrfs_trans_handle *trans,
-			      struct btrfs_root *root, u64 offset)
+			      struct btrfs_root *root, u64 ino)
 {
 	int ret;
-	struct btrfs_path *path;
-
-	path = btrfs_alloc_path();
-	if (!path)
-		return -ENOMEM;
 
-	ret = btrfs_find_item(root, path, BTRFS_ORPHAN_OBJECTID,
-			offset, BTRFS_ORPHAN_ITEM_KEY, NULL);
-	if (ret > 0)
-		ret = btrfs_insert_orphan_item(trans, root, offset);
-
-	btrfs_free_path(path);
+	ret = btrfs_insert_orphan_item(trans, root, ino);
+	if (ret == -EEXIST)
+		ret = 0;
 
 	return ret;
 }

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

* [PATCH 3.16.y-ckt 083/144] ARM: sunxi: Have ARCH_SUNXI select RESET_CONTROLLER for clock driver usage
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (81 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 082/144] btrfs: simplify insert_orphan_item Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 084/144] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Luis Henriques
                   ` (60 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen-Yu Tsai, Maxime Ripard, Luis Henriques

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

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

From: Chen-Yu Tsai <wens@csie.org>

commit fdc0074c5fc8c7adb8186cbb123fe2082d9bd05f upstream.

As the sunxi usb clocks all contain a reset controller, it is not
possible to build the sunxi clock driver without RESET_CONTROLLER
enabled. Doing so results in an undefined symbol error:

    drivers/built-in.o: In function `sunxi_gates_clk_setup':
    linux/drivers/clk/sunxi/clk-sunxi.c:1071: undefined reference to
	`reset_controller_register'

This is possible if building a minimal kernel without PHY_SUN4I_USB.

The dependency issue is made visible at compile time instead of
link time by the new A80 mmc clocks, which also use a reset control
itself.

This patch makes ARCH_SUNXI select ARCH_HAS_RESET_CONTROLLER and
RESET_CONTROLLER.

Fixes: 559482d1f950 ARM: sunxi: Split the various SoCs support in Kconfig
Reported-by: Lourens Rozema <ik@lourensrozema.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
[ luis: backported to 3.16:
  - dropped changes to sun8i and sun9i, unsupported on 3.16 kernel ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mach-sunxi/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 0fbd4f156bfa..b59e17748882 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1,11 +1,13 @@
 menuconfig ARCH_SUNXI
 	bool "Allwinner SoCs" if ARCH_MULTI_V7
 	select ARCH_REQUIRE_GPIOLIB
+	select ARCH_HAS_RESET_CONTROLLER
 	select CLKSRC_MMIO
 	select GENERIC_IRQ_CHIP
 	select PINCTRL
 	select PINCTRL_SUNXI
 	select SUN4I_TIMER
+	select RESET_CONTROLLER
 
 if ARCH_SUNXI
 
@@ -21,10 +23,8 @@ config MACH_SUN5I
 config MACH_SUN6I
 	bool "Allwinner A31 (sun6i) SoCs support"
 	default ARCH_SUNXI
-	select ARCH_HAS_RESET_CONTROLLER
 	select ARM_GIC
 	select MFD_SUN6I_PRCM
-	select RESET_CONTROLLER
 	select SUN5I_HSTIMER
 
 config MACH_SUN7I

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

* [PATCH 3.16.y-ckt 084/144] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (82 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 083/144] ARM: sunxi: Have ARCH_SUNXI select RESET_CONTROLLER for clock driver usage Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 085/144] nbd: fix possible memory leak Luis Henriques
                   ` (59 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tejun Heo, Wu Fengguang, Jens Axboe, Jens Axboe, Luis Henriques

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

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

From: Tejun Heo <tj@kernel.org>

commit 7d70e15480c0450d2bfafaad338a32e884fc215e upstream.

global_update_bandwidth() uses static variable update_time as the
timestamp for the last update but forgets to initialize it to
INITIALIZE_JIFFIES.

This means that global_dirty_limit will be 5 mins into the future on
32bit and some large amount jiffies into the past on 64bit.  This
isn't critical as the only effect is that global_dirty_limit won't be
updated for the first 5 mins after booting on 32bit machines,
especially given the auxiliary nature of global_dirty_limit's role -
protecting against global dirty threshold's sudden dips; however, it
does lead to unintended suboptimal behavior.  Fix it.

Fixes: c42843f2f0bb ("writeback: introduce smoothed global dirty limit")
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/page-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index dfe512e911c8..001d86441639 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -925,7 +925,7 @@ static void global_update_bandwidth(unsigned long thresh,
 				    unsigned long now)
 {
 	static DEFINE_SPINLOCK(dirty_lock);
-	static unsigned long update_time;
+	static unsigned long update_time = INITIAL_JIFFIES;
 
 	/*
 	 * check locklessly first to optimize away locking for the most time

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

* [PATCH 3.16.y-ckt 085/144] nbd: fix possible memory leak
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (83 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 084/144] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 086/144] spi: qup: Fix cs-num DT property parsing Luis Henriques
                   ` (58 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sudip Mukherjee, Markus Pargmann, Luis Henriques

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

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

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

commit ff6b8090e26ef7649ef0cc6b42389141ef48b0cf upstream.

we have already allocated memory for nbd_dev, but we were not
releasing that memory and just returning the error value.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Paul Clements <Paul.Clements@SteelEye.com>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/block/nbd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index fb31b8ee4372..30f0ec65415f 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -803,10 +803,6 @@ static int __init nbd_init(void)
 		return -EINVAL;
 	}
 
-	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
-	if (!nbd_dev)
-		return -ENOMEM;
-
 	part_shift = 0;
 	if (max_part > 0) {
 		part_shift = fls(max_part);
@@ -828,6 +824,10 @@ static int __init nbd_init(void)
 	if (nbds_max > 1UL << (MINORBITS - part_shift))
 		return -EINVAL;
 
+	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
+	if (!nbd_dev)
+		return -ENOMEM;
+
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = alloc_disk(1 << part_shift);
 		if (!disk)

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

* [PATCH 3.16.y-ckt 086/144] spi: qup: Fix cs-num DT property parsing
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (84 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 085/144] nbd: fix possible memory leak Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 087/144] mfd: kempld-core: Fix callback return value check Luis Henriques
                   ` (57 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ivan T. Ivanov, Mark Brown, Luis Henriques

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

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

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

commit 12cb89e37a0c25fae7a0f1d2e4985558db9d0b13 upstream.

num-cs is 32 bit property, don't read just upper 16 bits.

Fixes: 4a8573abe965 (spi: qup: Remove chip select function)
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spi-qup.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index c08da380cb23..7be89126c6ff 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -486,7 +486,7 @@ static int spi_qup_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct device *dev;
 	void __iomem *base;
-	u32 data, max_freq, iomode;
+	u32 data, max_freq, iomode, num_cs;
 	int ret, irq, size;
 
 	dev = &pdev->dev;
@@ -547,10 +547,11 @@ static int spi_qup_probe(struct platform_device *pdev)
 	}
 
 	/* use num-cs unless not present or out of range */
-	if (of_property_read_u16(dev->of_node, "num-cs",
-			&master->num_chipselect) ||
-			(master->num_chipselect > SPI_NUM_CHIPSELECTS))
+	if (of_property_read_u32(dev->of_node, "num-cs", &num_cs) ||
+	    num_cs > SPI_NUM_CHIPSELECTS)
 		master->num_chipselect = SPI_NUM_CHIPSELECTS;
+	else
+		master->num_chipselect = num_cs;
 
 	master->bus_num = pdev->id;
 	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;

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

* [PATCH 3.16.y-ckt 087/144] mfd: kempld-core: Fix callback return value check
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (85 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 086/144] spi: qup: Fix cs-num DT property parsing Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 088/144] KVM: nVMX: mask unrestricted_guest if disabled on L0 Luis Henriques
                   ` (56 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ameya Palande, Lee Jones, Luis Henriques

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

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

From: Ameya Palande <2ameya@gmail.com>

commit c8648508ebfc597058d2cd00b6c539110264a167 upstream.

On success, callback function returns 0. So invert the if condition
check so that we can break out of loop.

Signed-off-by: Ameya Palande <2ameya@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mfd/kempld-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
index f7ff0188603d..7112308fa8be 100644
--- a/drivers/mfd/kempld-core.c
+++ b/drivers/mfd/kempld-core.c
@@ -738,7 +738,7 @@ static int __init kempld_init(void)
 	if (force_device_id[0]) {
 		for (id = kempld_dmi_table; id->matches[0].slot != DMI_NONE; id++)
 			if (strstr(id->ident, force_device_id))
-				if (id->callback && id->callback(id))
+				if (id->callback && !id->callback(id))
 					break;
 		if (id->matches[0].slot == DMI_NONE)
 			return -ENODEV;

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

* [PATCH 3.16.y-ckt 088/144] KVM: nVMX: mask unrestricted_guest if disabled on L0
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (86 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 087/144] mfd: kempld-core: Fix callback return value check Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 089/144] spi: trigger trace event for message-done before mesg->complete Luis Henriques
                   ` (55 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Radim Krčmář, Marcelo Tosatti, Luis Henriques

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

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

From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@redhat.com>

commit 0790ec172de1bd2e23f1dbd4925426b6cc3c1b72 upstream.

If EPT was enabled, unrestricted_guest was allowed in L1 regardless of
L0.  L1 triple faulted when running L2 guest that required emulation.

Another side effect was 'WARN_ON_ONCE(vmx->nested.nested_run_pending)'
in L0's dmesg:
  WARNING: CPU: 0 PID: 0 at arch/x86/kvm/vmx.c:9190 nested_vmx_vmexit+0x96e/0xb00 [kvm_intel] ()

Prevent this scenario by masking SECONDARY_EXEC_UNRESTRICTED_GUEST when
the host doesn't have it enabled.

Fixes: 78051e3b7e35 ("KVM: nVMX: Disable unrestricted mode if ept=0")
Tested-By: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
[ luis: backported to 3.16:
  - use nested_vmx_secondary_ctls_high instead of vmx->nested.nested_vmx_secondary_ctls_high ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kvm/vmx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2557e8e2193d..aa6bd8cc914c 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2348,8 +2348,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 
 	if (enable_ept) {
 		/* nested EPT: emulate EPT also to L1 */
-		nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT |
-			SECONDARY_EXEC_UNRESTRICTED_GUEST;
+		nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT;
 		nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT |
 			 VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT |
 			 VMX_EPT_INVEPT_BIT;
@@ -2363,6 +2362,10 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 	} else
 		nested_vmx_ept_caps = 0;
 
+	if (enable_unrestricted_guest)
+		nested_vmx_secondary_ctls_high |=
+			SECONDARY_EXEC_UNRESTRICTED_GUEST;
+
 	/* miscellaneous data */
 	rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high);
 	nested_vmx_misc_low &= VMX_MISC_SAVE_EFER_LMA;

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

* [PATCH 3.16.y-ckt 089/144] spi: trigger trace event for message-done before mesg->complete
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (87 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 088/144] KVM: nVMX: mask unrestricted_guest if disabled on L0 Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 090/144] regmap: introduce regmap_name to fix syscon regmap trace events Luis Henriques
                   ` (54 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Mark Brown, Luis Henriques

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

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

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>

commit 391949b6f02121371e3d7d9082c6d17fd9853034 upstream.

With spidev the mesg->complete callback points to spidev_complete.
Calling this unblocks spidev_sync and so spidev_sync_write finishes. As
the struct spi_message just read is a local variable in
spidev_sync_write and recording the trace event accesses this message
the recording is better done first. The same can happen for
spidev_sync_read.

This fixes an oops observed on a 3.14-rt system with spidev activity
after

	echo 1 > /sys/kernel/debug/tracing/events/spi/enable

.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index d9a59a0464cd..577605167be2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1053,13 +1053,14 @@ void spi_finalize_current_message(struct spi_master *master)
 				"failed to unprepare message: %d\n", ret);
 		}
 	}
+
+	trace_spi_message_done(mesg);
+
 	master->cur_msg_prepared = false;
 
 	mesg->state = NULL;
 	if (mesg->complete)
 		mesg->complete(mesg->context);
-
-	trace_spi_message_done(mesg);
 }
 EXPORT_SYMBOL_GPL(spi_finalize_current_message);
 

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

* [PATCH 3.16.y-ckt 090/144] regmap: introduce regmap_name to fix syscon regmap trace events
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (88 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 089/144] spi: trigger trace event for message-done before mesg->complete Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 091/144] powerpc/pseries: Little endian fixes for post mobility device tree update Luis Henriques
                   ` (53 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Philipp Zabel, Mark Brown, Luis Henriques

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

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

From: Philipp Zabel <p.zabel@pengutronix.de>

commit c6b570d97c0e77f570bb6b2ed30d372b2b1e9aae upstream.

This patch fixes a NULL pointer dereference when enabling regmap event
tracing in the presence of a syscon regmap, introduced by commit bdb0066df96e
("mfd: syscon: Decouple syscon interface from platform devices").
That patch introduced syscon regmaps that have their dev field set to NULL.
The regmap trace events expect it to point to a valid struct device and feed
it to dev_name():

  $ echo 1 > /sys/kernel/debug/tracing/events/regmap/enable

  Unable to handle kernel NULL pointer dereference at virtual address 0000002c
  pgd = 80004000
  [0000002c] *pgd=00000000
  Internal error: Oops: 17 [#1] SMP ARM
  Modules linked in: coda videobuf2_vmalloc
  CPU: 0 PID: 304 Comm: kworker/0:2 Not tainted 4.0.0-rc2+ #9197
  Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
  Workqueue: events_freezable thermal_zone_device_check
  task: 9f25a200 ti: 9f1ee000 task.ti: 9f1ee000
  PC is at ftrace_raw_event_regmap_block+0x3c/0xe4
  LR is at _regmap_raw_read+0x1bc/0x1cc
  pc : [<803636e8>]    lr : [<80365f2c>]    psr: 600f0093
  sp : 9f1efd78  ip : 9f1efdb8  fp : 9f1efdb4
  r10: 00000004  r9 : 00000001  r8 : 00000001
  r7 : 00000180  r6 : 00000000  r5 : 9f00e3c0  r4 : 00000003
  r3 : 00000001  r2 : 00000180  r1 : 00000000  r0 : 9f00e3c0
  Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
  Control: 10c5387d  Table: 2d91004a  DAC: 00000015
  Process kworker/0:2 (pid: 304, stack limit = 0x9f1ee210)
  Stack: (0x9f1efd78 to 0x9f1f0000)
  fd60:                                                       9f1efda4 9f1efd88
  fd80: 800708c0 805f9510 80927140 800f0013 9f1fc800 9eb2f490 00000000 00000180
  fda0: 808e3840 00000001 9f1efdfc 9f1efdb8 80365f2c 803636b8 805f8958 800708e0
  fdc0: a00f0013 803636ac 9f16de00 00000180 80927140 9f1fc800 9f1fc800 9f1efe6c
  fde0: 9f1efe6c 9f732400 00000000 00000000 9f1efe1c 9f1efe00 80365f70 80365d7c
  fe00: 80365f3c 9f1fc800 9f1fc800 00000180 9f1efe44 9f1efe20 803656a4 80365f48
  fe20: 9f1fc800 00000180 9f1efe6c 9f1efe6c 9f732400 00000000 9f1efe64 9f1efe48
  fe40: 803657bc 80365634 00000001 9e95f910 9f1fc800 9f1efeb4 9f1efe8c 9f1efe68
  fe60: 80452ac0 80365778 9f1efe8c 9f1efe78 9e93d400 9e93d5e8 9f1efeb4 9f72ef40
  fe80: 9f1efeac 9f1efe90 8044e11c 80452998 8045298c 9e93d608 9e93d400 808e1978
  fea0: 9f1efecc 9f1efeb0 8044fd14 8044e0d0 ffffffff 9f25a200 9e93d608 9e481380
  fec0: 9f1efedc 9f1efed0 8044fde8 8044fcec 9f1eff1c 9f1efee0 80038d50 8044fdd8
  fee0: 9f1ee020 9f72ef40 9e481398 00000000 00000008 9f72ef54 9f1ee020 9f72ef40
  ff00: 9e481398 9e481380 00000008 9f72ef40 9f1eff5c 9f1eff20 80039754 80038bfc
  ff20: 00000000 9e481380 80894100 808e1662 00000000 9e4f2ec0 00000000 9e481380
  ff40: 800396f8 00000000 00000000 00000000 9f1effac 9f1eff60 8003e020 80039704
  ff60: ffffffff 00000000 ffffffff 9e481380 00000000 00000000 9f1eff78 9f1eff78
  ff80: 00000000 00000000 9f1eff88 9f1eff88 9e4f2ec0 8003df30 00000000 00000000
  ffa0: 00000000 9f1effb0 8000eb60 8003df3c 00000000 00000000 00000000 00000000
  ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff ffffffff
  Backtrace:
  [<803636ac>] (ftrace_raw_event_regmap_block) from [<80365f2c>] (_regmap_raw_read+0x1bc/0x1cc)
   r9:00000001 r8:808e3840 r7:00000180 r6:00000000 r5:9eb2f490 r4:9f1fc800
  [<80365d70>] (_regmap_raw_read) from [<80365f70>] (_regmap_bus_read+0x34/0x6c)
   r10:00000000 r9:00000000 r8:9f732400 r7:9f1efe6c r6:9f1efe6c r5:9f1fc800
   r4:9f1fc800
  [<80365f3c>] (_regmap_bus_read) from [<803656a4>] (_regmap_read+0x7c/0x144)
   r6:00000180 r5:9f1fc800 r4:9f1fc800 r3:80365f3c
  [<80365628>] (_regmap_read) from [<803657bc>] (regmap_read+0x50/0x70)
   r9:00000000 r8:9f732400 r7:9f1efe6c r6:9f1efe6c r5:00000180 r4:9f1fc800
  [<8036576c>] (regmap_read) from [<80452ac0>] (imx_get_temp+0x134/0x1a4)
   r6:9f1efeb4 r5:9f1fc800 r4:9e95f910 r3:00000001
  [<8045298c>] (imx_get_temp) from [<8044e11c>] (thermal_zone_get_temp+0x58/0x74)
   r7:9f72ef40 r6:9f1efeb4 r5:9e93d5e8 r4:9e93d400
  [<8044e0c4>] (thermal_zone_get_temp) from [<8044fd14>] (thermal_zone_device_update+0x34/0xec)
   r6:808e1978 r5:9e93d400 r4:9e93d608 r3:8045298c
  [<8044fce0>] (thermal_zone_device_update) from [<8044fde8>] (thermal_zone_device_check+0x1c/0x20)
   r5:9e481380 r4:9e93d608
  [<8044fdcc>] (thermal_zone_device_check) from [<80038d50>] (process_one_work+0x160/0x3d4)
  [<80038bf0>] (process_one_work) from [<80039754>] (worker_thread+0x5c/0x4f4)
   r10:9f72ef40 r9:00000008 r8:9e481380 r7:9e481398 r6:9f72ef40 r5:9f1ee020
   r4:9f72ef54
  [<800396f8>] (worker_thread) from [<8003e020>] (kthread+0xf0/0x108)
   r10:00000000 r9:00000000 r8:00000000 r7:800396f8 r6:9e481380 r5:00000000
   r4:9e4f2ec0
  [<8003df30>] (kthread) from [<8000eb60>] (ret_from_fork+0x14/0x34)
   r7:00000000 r6:00000000 r5:8003df30 r4:9e4f2ec0
  Code: e3140040 1a00001a e3140020 1a000016 (e596002c)
  ---[ end trace 193c15c2494ec960 ]---

Fixes: bdb0066df96e (mfd: syscon: Decouple syscon interface from platform devices)
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/base/regmap/internal.h |   8 +++
 drivers/base/regmap/regcache.c |  16 +++---
 drivers/base/regmap/regmap.c   |  32 +++++------
 include/trace/events/regmap.h  | 123 ++++++++++++++++++++---------------------
 4 files changed, 91 insertions(+), 88 deletions(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index bfc90b8547f2..3259810b4718 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -235,4 +235,12 @@ extern struct regcache_ops regcache_rbtree_ops;
 extern struct regcache_ops regcache_lzo_ops;
 extern struct regcache_ops regcache_flat_ops;
 
+static inline const char *regmap_name(const struct regmap *map)
+{
+	if (map->dev)
+		return dev_name(map->dev);
+
+	return map->name;
+}
+
 #endif
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 5617da6dc898..5c1cc008af9e 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -213,7 +213,7 @@ int regcache_read(struct regmap *map,
 		ret = map->cache_ops->read(map, reg, value);
 
 		if (ret == 0)
-			trace_regmap_reg_read_cache(map->dev, reg, *value);
+			trace_regmap_reg_read_cache(map, reg, *value);
 
 		return ret;
 	}
@@ -303,7 +303,7 @@ int regcache_sync(struct regmap *map)
 	dev_dbg(map->dev, "Syncing %s cache\n",
 		map->cache_ops->name);
 	name = map->cache_ops->name;
-	trace_regcache_sync(map->dev, name, "start");
+	trace_regcache_sync(map, name, "start");
 
 	if (!map->cache_dirty)
 		goto out;
@@ -338,7 +338,7 @@ out:
 
 	regmap_async_complete(map);
 
-	trace_regcache_sync(map->dev, name, "stop");
+	trace_regcache_sync(map, name, "stop");
 
 	return ret;
 }
@@ -373,7 +373,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
 	name = map->cache_ops->name;
 	dev_dbg(map->dev, "Syncing %s cache from %d-%d\n", name, min, max);
 
-	trace_regcache_sync(map->dev, name, "start region");
+	trace_regcache_sync(map, name, "start region");
 
 	if (!map->cache_dirty)
 		goto out;
@@ -393,7 +393,7 @@ out:
 
 	regmap_async_complete(map);
 
-	trace_regcache_sync(map->dev, name, "stop region");
+	trace_regcache_sync(map, name, "stop region");
 
 	return ret;
 }
@@ -420,7 +420,7 @@ int regcache_drop_region(struct regmap *map, unsigned int min,
 
 	map->lock(map->lock_arg);
 
-	trace_regcache_drop_region(map->dev, min, max);
+	trace_regcache_drop_region(map, min, max);
 
 	ret = map->cache_ops->drop(map, min, max);
 
@@ -447,7 +447,7 @@ void regcache_cache_only(struct regmap *map, bool enable)
 	map->lock(map->lock_arg);
 	WARN_ON(map->cache_bypass && enable);
 	map->cache_only = enable;
-	trace_regmap_cache_only(map->dev, enable);
+	trace_regmap_cache_only(map, enable);
 	map->unlock(map->lock_arg);
 }
 EXPORT_SYMBOL_GPL(regcache_cache_only);
@@ -485,7 +485,7 @@ void regcache_cache_bypass(struct regmap *map, bool enable)
 	map->lock(map->lock_arg);
 	WARN_ON(map->cache_only && enable);
 	map->cache_bypass = enable;
-	trace_regmap_cache_bypass(map->dev, enable);
+	trace_regmap_cache_bypass(map, enable);
 	map->unlock(map->lock_arg);
 }
 EXPORT_SYMBOL_GPL(regcache_cache_bypass);
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 8cda01590ed2..457d335f8495 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1210,7 +1210,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 	if (map->async && map->bus->async_write) {
 		struct regmap_async *async;
 
-		trace_regmap_async_write_start(map->dev, reg, val_len);
+		trace_regmap_async_write_start(map, reg, val_len);
 
 		spin_lock_irqsave(&map->async_lock, flags);
 		async = list_first_entry_or_null(&map->async_free,
@@ -1268,8 +1268,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 		return ret;
 	}
 
-	trace_regmap_hw_write_start(map->dev, reg,
-				    val_len / map->format.val_bytes);
+	trace_regmap_hw_write_start(map, reg, val_len / map->format.val_bytes);
 
 	/* If we're doing a single register write we can probably just
 	 * send the work_buf directly, otherwise try to do a gather
@@ -1301,8 +1300,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 		kfree(buf);
 	}
 
-	trace_regmap_hw_write_done(map->dev, reg,
-				   val_len / map->format.val_bytes);
+	trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes);
 
 	return ret;
 }
@@ -1336,12 +1334,12 @@ static int _regmap_bus_formatted_write(void *context, unsigned int reg,
 
 	map->format.format_write(map, reg, val);
 
-	trace_regmap_hw_write_start(map->dev, reg, 1);
+	trace_regmap_hw_write_start(map, reg, 1);
 
 	ret = map->bus->write(map->bus_context, map->work_buf,
 			      map->format.buf_size);
 
-	trace_regmap_hw_write_done(map->dev, reg, 1);
+	trace_regmap_hw_write_done(map, reg, 1);
 
 	return ret;
 }
@@ -1399,7 +1397,7 @@ int _regmap_write(struct regmap *map, unsigned int reg,
 		dev_info(map->dev, "%x <= %x\n", reg, val);
 #endif
 
-	trace_regmap_reg_write(map->dev, reg, val);
+	trace_regmap_reg_write(map, reg, val);
 
 	return map->reg_write(context, reg, val);
 }
@@ -1702,7 +1700,7 @@ static int _regmap_raw_multi_reg_write(struct regmap *map,
 	for (i = 0; i < num_regs; i++) {
 		int reg = regs[i].reg;
 		int val = regs[i].def;
-		trace_regmap_hw_write_start(map->dev, reg, 1);
+		trace_regmap_hw_write_start(map, reg, 1);
 		map->format.format_reg(u8, reg, map->reg_shift);
 		u8 += reg_bytes + pad_bytes;
 		map->format.format_val(u8, val, 0);
@@ -1717,7 +1715,7 @@ static int _regmap_raw_multi_reg_write(struct regmap *map,
 
 	for (i = 0; i < num_regs; i++) {
 		int reg = regs[i].reg;
-		trace_regmap_hw_write_done(map->dev, reg, 1);
+		trace_regmap_hw_write_done(map, reg, 1);
 	}
 	return ret;
 }
@@ -1988,15 +1986,13 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 	 */
 	u8[0] |= map->read_flag_mask;
 
-	trace_regmap_hw_read_start(map->dev, reg,
-				   val_len / map->format.val_bytes);
+	trace_regmap_hw_read_start(map, reg, val_len / map->format.val_bytes);
 
 	ret = map->bus->read(map->bus_context, map->work_buf,
 			     map->format.reg_bytes + map->format.pad_bytes,
 			     val, val_len);
 
-	trace_regmap_hw_read_done(map->dev, reg,
-				  val_len / map->format.val_bytes);
+	trace_regmap_hw_read_done(map, reg, val_len / map->format.val_bytes);
 
 	return ret;
 }
@@ -2052,7 +2048,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
 			dev_info(map->dev, "%x => %x\n", reg, *val);
 #endif
 
-		trace_regmap_reg_read(map->dev, reg, *val);
+		trace_regmap_reg_read(map, reg, *val);
 
 		if (!map->cache_bypass)
 			regcache_write(map, reg, *val);
@@ -2409,7 +2405,7 @@ void regmap_async_complete_cb(struct regmap_async *async, int ret)
 	struct regmap *map = async->map;
 	bool wake;
 
-	trace_regmap_async_io_complete(map->dev);
+	trace_regmap_async_io_complete(map);
 
 	spin_lock(&map->async_lock);
 	list_move(&async->list, &map->async_free);
@@ -2454,7 +2450,7 @@ int regmap_async_complete(struct regmap *map)
 	if (!map->bus || !map->bus->async_write)
 		return 0;
 
-	trace_regmap_async_complete_start(map->dev);
+	trace_regmap_async_complete_start(map);
 
 	wait_event(map->async_waitq, regmap_async_is_done(map));
 
@@ -2463,7 +2459,7 @@ int regmap_async_complete(struct regmap *map)
 	map->async_ret = 0;
 	spin_unlock_irqrestore(&map->async_lock, flags);
 
-	trace_regmap_async_complete_done(map->dev);
+	trace_regmap_async_complete_done(map);
 
 	return ret;
 }
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
index 23d561512f64..22317d2b52ab 100644
--- a/include/trace/events/regmap.h
+++ b/include/trace/events/regmap.h
@@ -7,27 +7,26 @@
 #include <linux/ktime.h>
 #include <linux/tracepoint.h>
 
-struct device;
-struct regmap;
+#include "../../../drivers/base/regmap/internal.h"
 
 /*
  * Log register events
  */
 DECLARE_EVENT_CLASS(regmap_reg,
 
-	TP_PROTO(struct device *dev, unsigned int reg,
+	TP_PROTO(struct regmap *map, unsigned int reg,
 		 unsigned int val),
 
-	TP_ARGS(dev, reg, val),
+	TP_ARGS(map, reg, val),
 
 	TP_STRUCT__entry(
-		__string(	name,		dev_name(dev)	)
-		__field(	unsigned int,	reg		)
-		__field(	unsigned int,	val		)
+		__string(	name,		regmap_name(map)	)
+		__field(	unsigned int,	reg			)
+		__field(	unsigned int,	val			)
 	),
 
 	TP_fast_assign(
-		__assign_str(name, dev_name(dev));
+		__assign_str(name, regmap_name(map));
 		__entry->reg = reg;
 		__entry->val = val;
 	),
@@ -39,45 +38,45 @@ DECLARE_EVENT_CLASS(regmap_reg,
 
 DEFINE_EVENT(regmap_reg, regmap_reg_write,
 
-	TP_PROTO(struct device *dev, unsigned int reg,
+	TP_PROTO(struct regmap *map, unsigned int reg,
 		 unsigned int val),
 
-	TP_ARGS(dev, reg, val)
+	TP_ARGS(map, reg, val)
 
 );
 
 DEFINE_EVENT(regmap_reg, regmap_reg_read,
 
-	TP_PROTO(struct device *dev, unsigned int reg,
+	TP_PROTO(struct regmap *map, unsigned int reg,
 		 unsigned int val),
 
-	TP_ARGS(dev, reg, val)
+	TP_ARGS(map, reg, val)
 
 );
 
 DEFINE_EVENT(regmap_reg, regmap_reg_read_cache,
 
-	TP_PROTO(struct device *dev, unsigned int reg,
+	TP_PROTO(struct regmap *map, unsigned int reg,
 		 unsigned int val),
 
-	TP_ARGS(dev, reg, val)
+	TP_ARGS(map, reg, val)
 
 );
 
 DECLARE_EVENT_CLASS(regmap_block,
 
-	TP_PROTO(struct device *dev, unsigned int reg, int count),
+	TP_PROTO(struct regmap *map, unsigned int reg, int count),
 
-	TP_ARGS(dev, reg, count),
+	TP_ARGS(map, reg, count),
 
 	TP_STRUCT__entry(
-		__string(	name,		dev_name(dev)	)
-		__field(	unsigned int,	reg		)
-		__field(	int,		count		)
+		__string(	name,		regmap_name(map)	)
+		__field(	unsigned int,	reg			)
+		__field(	int,		count			)
 	),
 
 	TP_fast_assign(
-		__assign_str(name, dev_name(dev));
+		__assign_str(name, regmap_name(map));
 		__entry->reg = reg;
 		__entry->count = count;
 	),
@@ -89,48 +88,48 @@ DECLARE_EVENT_CLASS(regmap_block,
 
 DEFINE_EVENT(regmap_block, regmap_hw_read_start,
 
-	TP_PROTO(struct device *dev, unsigned int reg, int count),
+	TP_PROTO(struct regmap *map, unsigned int reg, int count),
 
-	TP_ARGS(dev, reg, count)
+	TP_ARGS(map, reg, count)
 );
 
 DEFINE_EVENT(regmap_block, regmap_hw_read_done,
 
-	TP_PROTO(struct device *dev, unsigned int reg, int count),
+	TP_PROTO(struct regmap *map, unsigned int reg, int count),
 
-	TP_ARGS(dev, reg, count)
+	TP_ARGS(map, reg, count)
 );
 
 DEFINE_EVENT(regmap_block, regmap_hw_write_start,
 
-	TP_PROTO(struct device *dev, unsigned int reg, int count),
+	TP_PROTO(struct regmap *map, unsigned int reg, int count),
 
-	TP_ARGS(dev, reg, count)
+	TP_ARGS(map, reg, count)
 );
 
 DEFINE_EVENT(regmap_block, regmap_hw_write_done,
 
-	TP_PROTO(struct device *dev, unsigned int reg, int count),
+	TP_PROTO(struct regmap *map, unsigned int reg, int count),
 
-	TP_ARGS(dev, reg, count)
+	TP_ARGS(map, reg, count)
 );
 
 TRACE_EVENT(regcache_sync,
 
-	TP_PROTO(struct device *dev, const char *type,
+	TP_PROTO(struct regmap *map, const char *type,
 		 const char *status),
 
-	TP_ARGS(dev, type, status),
+	TP_ARGS(map, type, status),
 
 	TP_STRUCT__entry(
-		__string(       name,           dev_name(dev)   )
-		__string(	status,		status		)
-		__string(	type,		type		)
-		__field(	int,		type		)
+		__string(       name,           regmap_name(map)	)
+		__string(	status,		status			)
+		__string(	type,		type			)
+		__field(	int,		type			)
 	),
 
 	TP_fast_assign(
-		__assign_str(name, dev_name(dev));
+		__assign_str(name, regmap_name(map));
 		__assign_str(status, status);
 		__assign_str(type, type);
 	),
@@ -141,17 +140,17 @@ TRACE_EVENT(regcache_sync,
 
 DECLARE_EVENT_CLASS(regmap_bool,
 
-	TP_PROTO(struct device *dev, bool flag),
+	TP_PROTO(struct regmap *map, bool flag),
 
-	TP_ARGS(dev, flag),
+	TP_ARGS(map, flag),
 
 	TP_STRUCT__entry(
-		__string(	name,		dev_name(dev)	)
-		__field(	int,		flag		)
+		__string(	name,		regmap_name(map)	)
+		__field(	int,		flag			)
 	),
 
 	TP_fast_assign(
-		__assign_str(name, dev_name(dev));
+		__assign_str(name, regmap_name(map));
 		__entry->flag = flag;
 	),
 
@@ -161,32 +160,32 @@ DECLARE_EVENT_CLASS(regmap_bool,
 
 DEFINE_EVENT(regmap_bool, regmap_cache_only,
 
-	TP_PROTO(struct device *dev, bool flag),
+	TP_PROTO(struct regmap *map, bool flag),
 
-	TP_ARGS(dev, flag)
+	TP_ARGS(map, flag)
 
 );
 
 DEFINE_EVENT(regmap_bool, regmap_cache_bypass,
 
-	TP_PROTO(struct device *dev, bool flag),
+	TP_PROTO(struct regmap *map, bool flag),
 
-	TP_ARGS(dev, flag)
+	TP_ARGS(map, flag)
 
 );
 
 DECLARE_EVENT_CLASS(regmap_async,
 
-	TP_PROTO(struct device *dev),
+	TP_PROTO(struct regmap *map),
 
-	TP_ARGS(dev),
+	TP_ARGS(map),
 
 	TP_STRUCT__entry(
-		__string(	name,		dev_name(dev)	)
+		__string(	name,		regmap_name(map)	)
 	),
 
 	TP_fast_assign(
-		__assign_str(name, dev_name(dev));
+		__assign_str(name, regmap_name(map));
 	),
 
 	TP_printk("%s", __get_str(name))
@@ -194,50 +193,50 @@ DECLARE_EVENT_CLASS(regmap_async,
 
 DEFINE_EVENT(regmap_block, regmap_async_write_start,
 
-	TP_PROTO(struct device *dev, unsigned int reg, int count),
+	TP_PROTO(struct regmap *map, unsigned int reg, int count),
 
-	TP_ARGS(dev, reg, count)
+	TP_ARGS(map, reg, count)
 );
 
 DEFINE_EVENT(regmap_async, regmap_async_io_complete,
 
-	TP_PROTO(struct device *dev),
+	TP_PROTO(struct regmap *map),
 
-	TP_ARGS(dev)
+	TP_ARGS(map)
 
 );
 
 DEFINE_EVENT(regmap_async, regmap_async_complete_start,
 
-	TP_PROTO(struct device *dev),
+	TP_PROTO(struct regmap *map),
 
-	TP_ARGS(dev)
+	TP_ARGS(map)
 
 );
 
 DEFINE_EVENT(regmap_async, regmap_async_complete_done,
 
-	TP_PROTO(struct device *dev),
+	TP_PROTO(struct regmap *map),
 
-	TP_ARGS(dev)
+	TP_ARGS(map)
 
 );
 
 TRACE_EVENT(regcache_drop_region,
 
-	TP_PROTO(struct device *dev, unsigned int from,
+	TP_PROTO(struct regmap *map, unsigned int from,
 		 unsigned int to),
 
-	TP_ARGS(dev, from, to),
+	TP_ARGS(map, from, to),
 
 	TP_STRUCT__entry(
-		__string(       name,           dev_name(dev)   )
-		__field(	unsigned int,	from		)
-		__field(	unsigned int,	to		)
+		__string(       name,           regmap_name(map)	)
+		__field(	unsigned int,	from			)
+		__field(	unsigned int,	to			)
 	),
 
 	TP_fast_assign(
-		__assign_str(name, dev_name(dev));
+		__assign_str(name, regmap_name(map));
 		__entry->from = from;
 		__entry->to = to;
 	),

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

* [PATCH 3.16.y-ckt 091/144] powerpc/pseries: Little endian fixes for post mobility device tree update
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (89 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 090/144] regmap: introduce regmap_name to fix syscon regmap trace events Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 092/144] Fix bug in blk_rq_merge_ok Luis Henriques
                   ` (52 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tyrel Datwyler, Nathan Fontenot, Cyril Bur, Michael Ellerman,
	Luis Henriques

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

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

From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

commit f6ff04149637723261aa4738958b0098b929ee9e upstream.

We currently use the device tree update code in the kernel after resuming
from a suspend operation to re-sync the kernels view of the device tree with
that of the hypervisor. The code as it stands is not endian safe as it relies
on parsing buffers returned by RTAS calls that thusly contains data in big
endian format.

This patch annotates variables and structure members with __be types as well
as performing necessary byte swaps to cpu endian for data that needs to be
parsed.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Cc: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 44 ++++++++++++++++---------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index bde7ebad3949..c70762e0daf1 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -24,10 +24,10 @@
 static struct kobject *mobility_kobj;
 
 struct update_props_workarea {
-	u32 phandle;
-	u32 state;
-	u64 reserved;
-	u32 nprops;
+	__be32 phandle;
+	__be32 state;
+	__be64 reserved;
+	__be32 nprops;
 } __packed;
 
 #define NODE_ACTION_MASK	0xff000000
@@ -53,11 +53,11 @@ static int mobility_rtas_call(int token, char *buf, s32 scope)
 	return rc;
 }
 
-static int delete_dt_node(u32 phandle)
+static int delete_dt_node(__be32 phandle)
 {
 	struct device_node *dn;
 
-	dn = of_find_node_by_phandle(phandle);
+	dn = of_find_node_by_phandle(be32_to_cpu(phandle));
 	if (!dn)
 		return -ENOENT;
 
@@ -126,7 +126,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
 	return 0;
 }
 
-static int update_dt_node(u32 phandle, s32 scope)
+static int update_dt_node(__be32 phandle, s32 scope)
 {
 	struct update_props_workarea *upwa;
 	struct device_node *dn;
@@ -135,6 +135,7 @@ static int update_dt_node(u32 phandle, s32 scope)
 	char *prop_data;
 	char *rtas_buf;
 	int update_properties_token;
+	u32 nprops;
 	u32 vd;
 
 	update_properties_token = rtas_token("ibm,update-properties");
@@ -145,7 +146,7 @@ static int update_dt_node(u32 phandle, s32 scope)
 	if (!rtas_buf)
 		return -ENOMEM;
 
-	dn = of_find_node_by_phandle(phandle);
+	dn = of_find_node_by_phandle(be32_to_cpu(phandle));
 	if (!dn) {
 		kfree(rtas_buf);
 		return -ENOENT;
@@ -161,6 +162,7 @@ static int update_dt_node(u32 phandle, s32 scope)
 			break;
 
 		prop_data = rtas_buf + sizeof(*upwa);
+		nprops = be32_to_cpu(upwa->nprops);
 
 		/* On the first call to ibm,update-properties for a node the
 		 * the first property value descriptor contains an empty
@@ -169,17 +171,17 @@ static int update_dt_node(u32 phandle, s32 scope)
 		 */
 		if (*prop_data == 0) {
 			prop_data++;
-			vd = *(u32 *)prop_data;
+			vd = be32_to_cpu(*(__be32 *)prop_data);
 			prop_data += vd + sizeof(vd);
-			upwa->nprops--;
+			nprops--;
 		}
 
-		for (i = 0; i < upwa->nprops; i++) {
+		for (i = 0; i < nprops; i++) {
 			char *prop_name;
 
 			prop_name = prop_data;
 			prop_data += strlen(prop_name) + 1;
-			vd = *(u32 *)prop_data;
+			vd = be32_to_cpu(*(__be32 *)prop_data);
 			prop_data += sizeof(vd);
 
 			switch (vd) {
@@ -211,13 +213,13 @@ static int update_dt_node(u32 phandle, s32 scope)
 	return 0;
 }
 
-static int add_dt_node(u32 parent_phandle, u32 drc_index)
+static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
 {
 	struct device_node *dn;
 	struct device_node *parent_dn;
 	int rc;
 
-	parent_dn = of_find_node_by_phandle(parent_phandle);
+	parent_dn = of_find_node_by_phandle(be32_to_cpu(parent_phandle));
 	if (!parent_dn)
 		return -ENOENT;
 
@@ -236,7 +238,7 @@ static int add_dt_node(u32 parent_phandle, u32 drc_index)
 int pseries_devicetree_update(s32 scope)
 {
 	char *rtas_buf;
-	u32 *data;
+	__be32 *data;
 	int update_nodes_token;
 	int rc;
 
@@ -253,17 +255,17 @@ int pseries_devicetree_update(s32 scope)
 		if (rc && rc != 1)
 			break;
 
-		data = (u32 *)rtas_buf + 4;
-		while (*data & NODE_ACTION_MASK) {
+		data = (__be32 *)rtas_buf + 4;
+		while (be32_to_cpu(*data) & NODE_ACTION_MASK) {
 			int i;
-			u32 action = *data & NODE_ACTION_MASK;
-			int node_count = *data & NODE_COUNT_MASK;
+			u32 action = be32_to_cpu(*data) & NODE_ACTION_MASK;
+			u32 node_count = be32_to_cpu(*data) & NODE_COUNT_MASK;
 
 			data++;
 
 			for (i = 0; i < node_count; i++) {
-				u32 phandle = *data++;
-				u32 drc_index;
+				__be32 phandle = *data++;
+				__be32 drc_index;
 
 				switch (action) {
 				case DELETE_DT_NODE:

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

* [PATCH 3.16.y-ckt 092/144] Fix bug in blk_rq_merge_ok
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (90 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 091/144] powerpc/pseries: Little endian fixes for post mobility device tree update Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 093/144] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Luis Henriques
                   ` (51 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Wenbo Wang, Jens Axboe, Luis Henriques

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

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

From: Wenbo Wang <wenbo.wang@memblaze.com>

commit 7ee8e4f3983c4ff700958a6099c8fd212ea67b94 upstream.

Use the right array index to reference the last
element of rq->biotail->bi_io_vec[]

Signed-off-by: Wenbo Wang <wenbo.wang@memblaze.com>
Reviewed-by: Chong Yuan <chong.yuan@memblaze.com>
Fixes: 66cb45aa41315 ("block: add support for limiting gaps in SG lists")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 block/blk-merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 54535831f1e1..25db382fd2c2 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -596,7 +596,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
 	if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) {
 		struct bio_vec *bprev;
 
-		bprev = &rq->biotail->bi_io_vec[bio->bi_vcnt - 1];
+		bprev = &rq->biotail->bi_io_vec[rq->biotail->bi_vcnt - 1];
 		if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset))
 			return false;
 	}

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

* [PATCH 3.16.y-ckt 093/144] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5}
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (91 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 092/144] Fix bug in blk_rq_merge_ok Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 094/144] powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER Luis Henriques
                   ` (50 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: netdev, Don Fry, Markos Chandras, David S. Miller, Luis Henriques

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

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

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

commit 87f966d97b89774162df04d2106c6350c8fe4cb3 upstream.

On a MIPS Malta board, tons of fifo underflow errors have been observed
when using u-boot as bootloader instead of YAMON. The reason for that
is that YAMON used to set the pcnet device to SRAM mode but u-boot does
not. As a result, the default Tx threshold (64 bytes) is now too small to
keep the fifo relatively used and it can result to Tx fifo underflow errors.
As a result of which, it's best to setup the SRAM on supported controllers
so we can always use the NOUFLO bit.

Cc: <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Cc: Don Fry <pcnet32@frontier.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/amd/pcnet32.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index e7cc9174e364..02d3b7975835 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1552,7 +1552,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 {
 	struct pcnet32_private *lp;
 	int i, media;
-	int fdx, mii, fset, dxsuflo;
+	int fdx, mii, fset, dxsuflo, sram;
 	int chip_version;
 	char *chipname;
 	struct net_device *dev;
@@ -1589,7 +1589,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 	}
 
 	/* initialize variables */
-	fdx = mii = fset = dxsuflo = 0;
+	fdx = mii = fset = dxsuflo = sram = 0;
 	chip_version = (chip_version >> 12) & 0xffff;
 
 	switch (chip_version) {
@@ -1622,6 +1622,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 		chipname = "PCnet/FAST III 79C973";	/* PCI */
 		fdx = 1;
 		mii = 1;
+		sram = 1;
 		break;
 	case 0x2626:
 		chipname = "PCnet/Home 79C978";	/* PCI */
@@ -1645,6 +1646,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 		chipname = "PCnet/FAST III 79C975";	/* PCI */
 		fdx = 1;
 		mii = 1;
+		sram = 1;
 		break;
 	case 0x2628:
 		chipname = "PCnet/PRO 79C976";
@@ -1673,6 +1675,31 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 		dxsuflo = 1;
 	}
 
+	/*
+	 * The Am79C973/Am79C975 controllers come with 12K of SRAM
+	 * which we can use for the Tx/Rx buffers but most importantly,
+	 * the use of SRAM allow us to use the BCR18:NOUFLO bit to avoid
+	 * Tx fifo underflows.
+	 */
+	if (sram) {
+		/*
+		 * The SRAM is being configured in two steps. First we
+		 * set the SRAM size in the BCR25:SRAM_SIZE bits. According
+		 * to the datasheet, each bit corresponds to a 512-byte
+		 * page so we can have at most 24 pages. The SRAM_SIZE
+		 * holds the value of the upper 8 bits of the 16-bit SRAM size.
+		 * The low 8-bits start at 0x00 and end at 0xff. So the
+		 * address range is from 0x0000 up to 0x17ff. Therefore,
+		 * the SRAM_SIZE is set to 0x17. The next step is to set
+		 * the BCR26:SRAM_BND midway through so the Tx and Rx
+		 * buffers can share the SRAM equally.
+		 */
+		a->write_bcr(ioaddr, 25, 0x17);
+		a->write_bcr(ioaddr, 26, 0xc);
+		/* And finally enable the NOUFLO bit */
+		a->write_bcr(ioaddr, 18, a->read_bcr(ioaddr, 18) | (1 << 11));
+	}
+
 	dev = alloc_etherdev(sizeof(*lp));
 	if (!dev) {
 		ret = -ENOMEM;

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

* [PATCH 3.16.y-ckt 094/144] powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (92 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 093/144] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 095/144] perf: Fix irq_work 'tail' recursion Luis Henriques
                   ` (49 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mahesh Salgaonkar, Michael Ellerman, Luis Henriques

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

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

From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

commit 44d5f6f5901e996744858c175baee320ccf1eda3 upstream.

commit id 2ba9f0d has changed CONFIG_KVM_BOOK3S_64_HV to tristate to allow
HV/PR bits to be built as modules. But the MCE code still depends on
CONFIG_KVM_BOOK3S_64_HV which is wrong. When user selects
CONFIG_KVM_BOOK3S_64_HV=m to build HV/PR bits as a separate module the
relevant MCE code gets excluded.

This patch fixes the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER. This
makes sure that the relevant MCE code is included when HV/PR bits
are built as a separate modules.

Fixes: 2ba9f0d88750 ("kvm: powerpc: book3s: Support building HV and PR KVM as module")
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/kernel/exceptions-64s.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index a7d36b19221d..246740cc796e 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1442,7 +1442,7 @@ machine_check_handle_early:
 	bne	9f			/* continue in V mode if we are. */
 
 5:
-#ifdef CONFIG_KVM_BOOK3S_64_HV
+#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
 	/*
 	 * We are coming from kernel context. Check if we are coming from
 	 * guest. if yes, then we can continue. We will fall through

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

* [PATCH 3.16.y-ckt 095/144] perf: Fix irq_work 'tail' recursion
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (93 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 094/144] powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 096/144] sched: Fix RLIMIT_RTTIME when PI-boosting to RT Luis Henriques
                   ` (48 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Zijlstra (Intel),
	Arnaldo Carvalho de Melo, Jiri Olsa, Paul Mackerras,
	Steven Rostedt, Ingo Molnar, Luis Henriques

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

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

From: Peter Zijlstra <peterz@infradead.org>

commit d525211f9d1be8b523ec7633f080f2116f5ea536 upstream.

Vince reported a watchdog lockup like:

	[<ffffffff8115e114>] perf_tp_event+0xc4/0x210
	[<ffffffff810b4f8a>] perf_trace_lock+0x12a/0x160
	[<ffffffff810b7f10>] lock_release+0x130/0x260
	[<ffffffff816c7474>] _raw_spin_unlock_irqrestore+0x24/0x40
	[<ffffffff8107bb4d>] do_send_sig_info+0x5d/0x80
	[<ffffffff811f69df>] send_sigio_to_task+0x12f/0x1a0
	[<ffffffff811f71ce>] send_sigio+0xae/0x100
	[<ffffffff811f72b7>] kill_fasync+0x97/0xf0
	[<ffffffff8115d0b4>] perf_event_wakeup+0xd4/0xf0
	[<ffffffff8115d103>] perf_pending_event+0x33/0x60
	[<ffffffff8114e3fc>] irq_work_run_list+0x4c/0x80
	[<ffffffff8114e448>] irq_work_run+0x18/0x40
	[<ffffffff810196af>] smp_trace_irq_work_interrupt+0x3f/0xc0
	[<ffffffff816c99bd>] trace_irq_work_interrupt+0x6d/0x80

Which is caused by an irq_work generating new irq_work and therefore
not allowing forward progress.

This happens because processing the perf irq_work triggers another
perf event (tracepoint stuff) which in turn generates an irq_work ad
infinitum.

Avoid this by raising the recursion counter in the irq_work -- which
effectively disables all software events (including tracepoints) from
actually triggering again.

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20150219170311.GH21418@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/events/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5a84ca5165ae..92320781b140 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4299,6 +4299,13 @@ static void perf_pending_event(struct irq_work *entry)
 {
 	struct perf_event *event = container_of(entry,
 			struct perf_event, pending);
+	int rctx;
+
+	rctx = perf_swevent_get_recursion_context();
+	/*
+	 * If we 'fail' here, that's OK, it means recursion is already disabled
+	 * and we won't recurse 'further'.
+	 */
 
 	if (event->pending_disable) {
 		event->pending_disable = 0;
@@ -4309,6 +4316,9 @@ static void perf_pending_event(struct irq_work *entry)
 		event->pending_wakeup = 0;
 		perf_event_wakeup(event);
 	}
+
+	if (rctx >= 0)
+		perf_swevent_put_recursion_context(rctx);
 }
 
 /*

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

* [PATCH 3.16.y-ckt 096/144] sched: Fix RLIMIT_RTTIME when PI-boosting to RT
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (94 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 095/144] perf: Fix irq_work 'tail' recursion Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 097/144] ALSA: hda - Add dock support for Thinkpad T450s (17aa:5036) Luis Henriques
                   ` (47 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian Silverman, Peter Zijlstra (Intel),
	austin, Ingo Molnar, Luis Henriques

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

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

From: Brian Silverman <brian@peloton-tech.com>

commit 746db9443ea57fd9c059f62c4bfbf41cf224fe13 upstream.

When non-realtime tasks get priority-inheritance boosted to a realtime
scheduling class, RLIMIT_RTTIME starts to apply to them. However, the
counter used for checking this (the same one used for SCHED_RR
timeslices) was not getting reset. This meant that tasks running with a
non-realtime scheduling class which are repeatedly boosted to a realtime
one, but never block while they are running realtime, eventually hit the
timeout without ever running for a time over the limit. This patch
resets the realtime timeslice counter when un-PI-boosting from an RT to
a non-RT scheduling class.

I have some test code with two threads and a shared PTHREAD_PRIO_INHERIT
mutex which induces priority boosting and spins while boosted that gets
killed by a SIGXCPU on non-fixed kernels but doesn't with this patch
applied. It happens much faster with a CONFIG_PREEMPT_RT kernel, and
does happen eventually with PREEMPT_VOLUNTARY kernels.

Signed-off-by: Brian Silverman <brian@peloton-tech.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: austin@peloton-tech.com
Link: http://lkml.kernel.org/r/1424305436-6716-1-git-send-email-brian@peloton-tech.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/sched/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 07f41f4fe4db..2eb2e7992970 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3012,6 +3012,8 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
 	} else {
 		if (dl_prio(oldprio))
 			p->dl.dl_boosted = 0;
+		if (rt_prio(oldprio))
+			p->rt.timeout = 0;
 		p->sched_class = &fair_sched_class;
 	}
 

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

* [PATCH 3.16.y-ckt 097/144] ALSA: hda - Add dock support for Thinkpad T450s (17aa:5036)
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (95 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 096/144] sched: Fix RLIMIT_RTTIME when PI-boosting to RT Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 098/144] arm64: Use the reserved TTBR0 if context switching to the init_mm Luis Henriques
                   ` (46 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Wicki, Takashi Iwai, Luis Henriques

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

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

From: Sebastian Wicki <gandro@gmx.net>

commit 80b311d3118842eb681397233faa0d588df13f92 upstream.

This model uses the same dock port as the previous generation.

Signed-off-by: Sebastian Wicki <gandro@gmx.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9e8dd403802c..4a6d7a0ee242 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4891,6 +4891,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),

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

* [PATCH 3.16.y-ckt 098/144] arm64: Use the reserved TTBR0 if context switching to the init_mm
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (96 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 097/144] ALSA: hda - Add dock support for Thinkpad T450s (17aa:5036) Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 099/144] selinux: fix sel_write_enforce broken return value Luis Henriques
                   ` (45 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Catalin Marinas, Luis Henriques

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

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

From: Catalin Marinas <catalin.marinas@arm.com>

commit e53f21bce4d35a93b23d8fa1a840860f6c74f59e upstream.

The idle_task_exit() function may call switch_mm() with next ==
&init_mm. On arm64, init_mm.pgd cannot be used for user mappings, so
this patch simply sets the reserved TTBR0.

Reported-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Tested-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/include/asm/mmu_context.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index a9eee33dfa62..101a42bde728 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -151,6 +151,15 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
 {
 	unsigned int cpu = smp_processor_id();
 
+	/*
+	 * init_mm.pgd does not contain any user mappings and it is always
+	 * active for kernel addresses in TTBR1. Just set the reserved TTBR0.
+	 */
+	if (next == &init_mm) {
+		cpu_set_reserved_ttbr0();
+		return;
+	}
+
 	if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next)
 		check_and_switch_context(next, tsk);
 }

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

* [PATCH 3.16.y-ckt 099/144] selinux: fix sel_write_enforce broken return value
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (97 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 098/144] arm64: Use the reserved TTBR0 if context switching to the init_mm Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 100/144] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention Luis Henriques
                   ` (44 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Joe Perches, Paul Moore, Luis Henriques

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

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

From: Joe Perches <joe@perches.com>

commit 6436a123a147db51a0b06024a8350f4c230e73ff upstream.

Return a negative error value like the rest of the entries in this function.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>
[PM: tweaked subject line]
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 security/selinux/selinuxfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 33db1ad4fd10..138949a31eab 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
 		goto out;
 
 	/* No partial writes. */
-	length = EINVAL;
+	length = -EINVAL;
 	if (*ppos != 0)
 		goto out;
 

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

* [PATCH 3.16.y-ckt 100/144] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (98 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 099/144] selinux: fix sel_write_enforce broken return value Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 101/144] mm/memory hotplug: postpone the reset of obsolete pgdat Luis Henriques
                   ` (43 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Leon Yu, Konstantin Khlebnikov, Andrew Morton, Linus Torvalds,
	Luis Henriques

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

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

From: Leon Yu <chianglungyu@gmail.com>

commit 3fe89b3e2a7bbf3e97657104b9b33a9d81b950b3 upstream.

I have constantly stumbled upon "kernel BUG at mm/rmap.c:399!" after
upgrading to 3.19 and had no luck with 4.0-rc1 neither.

So, after looking into new logic introduced by commit 7a3ef208e662 ("mm:
prevent endless growth of anon_vma hierarchy"), I found chances are that
unlink_anon_vmas() is called without incrementing dst->anon_vma->degree
in anon_vma_clone() due to allocation failure.  If dst->anon_vma is not
NULL in error path, its degree will be incorrectly decremented in
unlink_anon_vmas() and eventually underflow when exiting as a result of
another call to unlink_anon_vmas().  That's how "kernel BUG at
mm/rmap.c:399!" is triggered for me.

This patch fixes the underflow by dropping dst->anon_vma when allocation
fails.  It's safe to do so regardless of original value of dst->anon_vma
because dst->anon_vma doesn't have valid meaning if anon_vma_clone()
fails.  Besides, callers don't care dst->anon_vma in such case neither.

Also suggested by Michal Hocko, we can clean up vma_adjust() a bit as
anon_vma_clone() now does the work.

[akpm@linux-foundation.org: tweak comment]
Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
Signed-off-by: Leon Yu <chianglungyu@gmail.com>
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: David Rientjes <rientjes@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/mmap.c | 4 +---
 mm/rmap.c | 7 +++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 38dec592f496..0c144ec8c810 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -751,10 +751,8 @@ again:			remove_next = 1 + (end > next->vm_end);
 
 			importer->anon_vma = exporter->anon_vma;
 			error = anon_vma_clone(importer, exporter);
-			if (error) {
-				importer->anon_vma = NULL;
+			if (error)
 				return error;
-			}
 		}
 	}
 
diff --git a/mm/rmap.c b/mm/rmap.c
index ab8e7984fa19..e84beb4dcfce 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -287,6 +287,13 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
 	return 0;
 
  enomem_failure:
+	/*
+	 * dst->anon_vma is dropped here otherwise its degree can be incorrectly
+	 * decremented in unlink_anon_vmas().
+	 * We can safely do this because callers of anon_vma_clone() don't care
+	 * about dst->anon_vma if anon_vma_clone() failed.
+	 */
+	dst->anon_vma = NULL;
 	unlink_anon_vmas(dst);
 	return -ENOMEM;
 }

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

* [PATCH 3.16.y-ckt 101/144] mm/memory hotplug: postpone the reset of obsolete pgdat
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (99 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 100/144] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 102/144] hfsplus: fix B-tree corruption after insertion at position 0 Luis Henriques
                   ` (42 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Gu Zheng, David Rientjes, Yasuaki Ishimatsu, Taku Izumi,
	Tang Chen, Xie XiuQi, Andrew Morton, Linus Torvalds,
	Luis Henriques

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

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

From: Gu Zheng <guz.fnst@cn.fujitsu.com>

commit b0dc3a342af36f95a68fe229b8f0f73552c5ca08 upstream.

Qiu Xishi reported the following BUG when testing hot-add/hot-remove node under
stress condition:

  BUG: unable to handle kernel paging request at 0000000000025f60
  IP: next_online_pgdat+0x1/0x50
  PGD 0
  Oops: 0000 [#1] SMP
  ACPI: Device does not support D3cold
  Modules linked in: fuse nls_iso8859_1 nls_cp437 vfat fat loop dm_mod coretemp mperf crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper cryptd lrw gf128mul glue_helper aes_x86_64 pcspkr microcode igb dca i2c_algo_bit ipv6 megaraid_sas iTCO_wdt i2c_i801 i2c_core iTCO_vendor_support tg3 sg hwmon ptp lpc_ich pps_core mfd_core acpi_pad rtc_cmos button ext3 jbd mbcache sd_mod crc_t10dif scsi_dh_alua scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh ahci libahci libata scsi_mod [last unloaded: rasf]
  CPU: 23 PID: 238 Comm: kworker/23:1 Tainted: G           O 3.10.15-5885-euler0302 #1
  Hardware name: HUAWEI TECHNOLOGIES CO.,LTD. Huawei N1/Huawei N1, BIOS V100R001 03/02/2015
  Workqueue: events vmstat_update
  task: ffffa800d32c0000 ti: ffffa800d32ae000 task.ti: ffffa800d32ae000
  RIP: 0010: next_online_pgdat+0x1/0x50
  RSP: 0018:ffffa800d32afce8  EFLAGS: 00010286
  RAX: 0000000000001440 RBX: ffffffff81da53b8 RCX: 0000000000000082
  RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000000
  RBP: ffffa800d32afd28 R08: ffffffff81c93bfc R09: ffffffff81cbdc96
  R10: 00000000000040ec R11: 00000000000000a0 R12: ffffa800fffb3440
  R13: ffffa800d32afd38 R14: 0000000000000017 R15: ffffa800e6616800
  FS:  0000000000000000(0000) GS:ffffa800e6600000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000025f60 CR3: 0000000001a0b000 CR4: 00000000001407e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
    refresh_cpu_vm_stats+0xd0/0x140
    vmstat_update+0x11/0x50
    process_one_work+0x194/0x3d0
    worker_thread+0x12b/0x410
    kthread+0xc6/0xd0
    ret_from_fork+0x7c/0xb0

The cause is the "memset(pgdat, 0, sizeof(*pgdat))" at the end of
try_offline_node, which will reset all the content of pgdat to 0, as the
pgdat is accessed lock-free, so that the users still using the pgdat
will panic, such as the vmstat_update routine.

process A:				offline node XX:

vmstat_updat()
   refresh_cpu_vm_stats()
     for_each_populated_zone()
       find online node XX
     cond_resched()
					offline cpu and memory, then try_offline_node()
					node_set_offline(nid), and memset(pgdat, 0, sizeof(*pgdat))
       zone = next_zone(zone)
         pg_data_t *pgdat = zone->zone_pgdat;  // here pgdat is NULL now
           next_online_pgdat(pgdat)
             next_online_node(pgdat->node_id);  // NULL pointer access

So the solution here is postponing the reset of obsolete pgdat from
try_offline_node() to hotadd_new_pgdat(), and just resetting
pgdat->nr_zones and pgdat->classzone_idx to be 0 rather than the memset
0 to avoid breaking pointer information in pgdat.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Reported-by: Xishi Qiu <qiuxishi@huawei.com>
Suggested-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Xie XiuQi <xiexiuqi@huawei.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/memory_hotplug.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 845ca44ee5ab..46b59a6f8648 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1089,6 +1089,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
 			return NULL;
 
 		arch_refresh_nodedata(nid, pgdat);
+	} else {
+		/* Reset the nr_zones and classzone_idx to 0 before reuse */
+		pgdat->nr_zones = 0;
+		pgdat->classzone_idx = 0;
 	}
 
 	/* we can use NODE_DATA(nid) from here */
@@ -1951,15 +1955,6 @@ void try_offline_node(int nid)
 		if (is_vmalloc_addr(zone->wait_table))
 			vfree(zone->wait_table);
 	}
-
-	/*
-	 * Since there is no way to guarentee the address of pgdat/zone is not
-	 * on stack of any kernel threads or used by other kernel objects
-	 * without reference counting or other symchronizing method, do not
-	 * reset node_data and free pgdat here. Just reset it to 0 and reuse
-	 * the memory when the node is online again.
-	 */
-	memset(pgdat, 0, sizeof(*pgdat));
 }
 EXPORT_SYMBOL(try_offline_node);
 

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

* [PATCH 3.16.y-ckt 102/144] hfsplus: fix B-tree corruption after insertion at position 0
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (100 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 101/144] mm/memory hotplug: postpone the reset of obsolete pgdat Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 103/144] ARC: SA_SIGINFO ucontext regs off-by-one Luis Henriques
                   ` (41 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergei Antonov, Joe Perches, Anton Altaparmakov, Al Viro,
	Christoph Hellwig, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Sergei Antonov <saproj@gmail.com>

commit 98cf21c61a7f5419d82f847c4d77bf6e96a76f5f upstream.

Fix B-tree corruption when a new record is inserted at position 0 in the
node in hfs_brec_insert().  In this case a hfs_brec_update_parent() is
called to update the parent index node (if exists) and it is passed
hfs_find_data with a search_key containing a newly inserted key instead
of the key to be updated.  This results in an inconsistent index node.
The bug reproduces on my machine after an extents overflow record for
the catalog file (CNID=4) is inserted into the extents overflow B-tree.
Because of a low (reserved) value of CNID=4, it has to become the first
record in the first leaf node.

The resulting first leaf node is correct:

  ----------------------------------------------------
  | key0.CNID=4 | key1.CNID=123 | key2.CNID=456, ... |
  ----------------------------------------------------

But the parent index key0 still contains the previous key CNID=123:

  -----------------------
  | key0.CNID=123 | ... |
  -----------------------

A change in hfs_brec_insert() makes hfs_brec_update_parent() work
correctly by preventing it from getting fd->record=-1 value from
__hfs_brec_find().

Along the way, I removed duplicate code with unification of the if
condition.  The resulting code is equivalent to the original code
because node is never 0.

Also hfs_brec_update_parent() will now return an error after getting a
negative fd->record value.  However, the return value of
hfs_brec_update_parent() is not checked anywhere in the file and I'm
leaving it unchanged by this patch.  brec.c lacks error checking after
some other calls too, but this issue is of less importance than the one
being fixed by this patch.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Cc: Joe Perches <joe@perches.com>
Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Anton Altaparmakov <aia21@cam.ac.uk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
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/hfsplus/brec.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
index 6e560d56094b..754fdf8c6356 100644
--- a/fs/hfsplus/brec.c
+++ b/fs/hfsplus/brec.c
@@ -131,13 +131,16 @@ skip:
 	hfs_bnode_write(node, entry, data_off + key_len, entry_len);
 	hfs_bnode_dump(node);
 
-	if (new_node) {
-		/* update parent key if we inserted a key
-		 * at the start of the first node
-		 */
-		if (!rec && new_node != node)
-			hfs_brec_update_parent(fd);
+	/*
+	 * update parent key if we inserted a key
+	 * at the start of the node and it is not the new node
+	 */
+	if (!rec && new_node != node) {
+		hfs_bnode_read_key(node, fd->search_key, data_off + size);
+		hfs_brec_update_parent(fd);
+	}
 
+	if (new_node) {
 		hfs_bnode_put(fd->bnode);
 		if (!new_node->parent) {
 			hfs_btree_inc_height(tree);
@@ -168,9 +171,6 @@ skip:
 		goto again;
 	}
 
-	if (!rec)
-		hfs_brec_update_parent(fd);
-
 	return 0;
 }
 
@@ -370,6 +370,8 @@ again:
 	if (IS_ERR(parent))
 		return PTR_ERR(parent);
 	__hfs_brec_find(parent, fd, hfs_find_rec_by_key);
+	if (fd->record < 0)
+		return -ENOENT;
 	hfs_bnode_dump(parent);
 	rec = fd->record;
 

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

* [PATCH 3.16.y-ckt 103/144] ARC: SA_SIGINFO ucontext regs off-by-one
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (101 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 102/144] hfsplus: fix B-tree corruption after insertion at position 0 Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 104/144] writeback: fix possible underflow in write bandwidth calculation Luis Henriques
                   ` (40 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Luis Henriques

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

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

From: Vineet Gupta <vgupta@synopsys.com>

commit 6914e1e3f63caa829431160f0f7093292daef2d5 upstream.

The regfile provided to SA_SIGINFO signal handler as ucontext was off by
one due to pt_regs gutter cleanups in 2013.

Before handling signal, user pt_regs are copied onto user_regs_struct and copied
back later. Both structs are binary compatible. This was all fine until
commit 2fa919045b72 (ARC: pt_regs update #2) which removed the empty stack slot
at top of pt_regs (corresponding to first pad) and made the corresponding
fixup in struct user_regs_struct (the pad in there was moved out of
@scratch - not removed altogether as it is part of ptrace ABI)

 struct user_regs_struct {
+       long pad;
        struct {
-               long pad;
                long bta, lp_start, lp_end,....
        } scratch;
 ...
 }

This meant that now user_regs_struct was off by 1 reg w.r.t pt_regs and
signal code needs to user_regs_struct.scratch to reflect it as pt_regs,
which is what this commit does.

This problem was hidden for 2 years, because both save/restore, despite
using wrong location, were using the same location. Only an interim
inspection (reproducer below) exposed the issue.

     void handle_segv(int signo, siginfo_t *info, void *context)
     {
 	ucontext_t *uc = context;
	struct user_regs_struct *regs = &(uc->uc_mcontext.regs);

	printf("regs %x %x\n",               <=== prints 7 8 (vs. 8 9)
               regs->scratch.r8, regs->scratch.r9);
     }

     int main()
     {
	struct sigaction sa;

	sa.sa_sigaction = handle_segv;
	sa.sa_flags = SA_SIGINFO;
	sigemptyset(&sa.sa_mask);
	sigaction(SIGSEGV, &sa, NULL);

	asm volatile(
	"mov	r7, 7	\n"
	"mov	r8, 8	\n"
	"mov	r9, 9	\n"
	"mov	r10, 10	\n"
	:::"r7","r8","r9","r10");

	*((unsigned int*)0x10) = 0;
     }

Fixes: 2fa919045b72ec892e "ARC: pt_regs update #2: Remove unused gutter at start of pt_regs"
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arc/kernel/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
index 7e95e1a86510..d68b410595c8 100644
--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -67,7 +67,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
 	       sigset_t *set)
 {
 	int err;
-	err = __copy_to_user(&(sf->uc.uc_mcontext.regs), regs,
+	err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), regs,
 			     sizeof(sf->uc.uc_mcontext.regs.scratch));
 	err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
 
@@ -83,7 +83,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
 	if (!err)
 		set_current_blocked(&set);
 
-	err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs),
+	err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch),
 				sizeof(sf->uc.uc_mcontext.regs.scratch));
 
 	return err;

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

* [PATCH 3.16.y-ckt 104/144] writeback: fix possible underflow in write bandwidth calculation
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (102 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 103/144] ARC: SA_SIGINFO ucontext regs off-by-one Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 105/144] ipv6: Don't reduce hop limit for an interface Luis Henriques
                   ` (39 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tejun Heo, Jens Axboe, Jan Kara, Wu Fengguang, Greg Thelen,
	Jens Axboe, Luis Henriques

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

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

From: Tejun Heo <tj@kernel.org>

commit c72efb658f7c8b27ca3d0efb5cfd5ded9fcac89e upstream.

>From 1ebf33901ecc75d9496862dceb1ef0377980587c Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Mon, 23 Mar 2015 00:08:19 -0400

2f800fbd777b ("writeback: fix dirtied pages accounting on redirty")
introduced account_page_redirty() which reverts stat updates for a
redirtied page, making BDI_DIRTIED no longer monotonically increasing.

bdi_update_write_bandwidth() uses the delta in BDI_DIRTIED as the
basis for bandwidth calculation.  While unlikely, since the above
patch, the newer value may be lower than the recorded past value and
nunderflow the bandwidth calculation leading to a wild result.

Fix it by subtracing min of the old and new values when calculating
delta.  AFAIK, there hasn't been any report of it happening but the
resulting erratic behavior would be non-critical and temporary, so
it's possible that the issue is happening without being reported.  The
risk of the fix is very low, so tagged for -stable.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Greg Thelen <gthelen@google.com>
Fixes: 2f800fbd777b ("writeback: fix dirtied pages accounting on redirty")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/page-writeback.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 001d86441639..6a3348761648 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -860,8 +860,11 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi,
 	 *                   bw * elapsed + write_bandwidth * (period - elapsed)
 	 * write_bandwidth = ---------------------------------------------------
 	 *                                          period
+	 *
+	 * @written may have decreased due to account_page_redirty().
+	 * Avoid underflowing @bw calculation.
 	 */
-	bw = written - bdi->written_stamp;
+	bw = written - min(written, bdi->written_stamp);
 	bw *= HZ;
 	if (unlikely(elapsed > period)) {
 		do_div(bw, elapsed);

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

* [PATCH 3.16.y-ckt 105/144] ipv6: Don't reduce hop limit for an interface
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (103 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 104/144] writeback: fix possible underflow in write bandwidth calculation Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 106/144] iio: fix drivers that check buffer->scan_mask Luis Henriques
                   ` (38 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: D.S. Ljungmark, David S. Miller, Luis Henriques

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

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

From: "D.S. Ljungmark" <ljungmark@modio.se>

commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a upstream.

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, "Parameter Spoofing"

>   1.  The attacker includes a Current Hop Limit of one or another small
>       number which the attacker knows will cause legitimate packets to
>       be dropped before they reach their destination.

>   As an example, one possible approach to mitigate this threat is to
>   ignore very small hop limits.  The nodes could implement a
>   configurable minimum hop limit, and ignore attempts to set it below
>   said limit.

Signed-off-by: D.S. Ljungmark <ljungmark@modio.se>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/ndisc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index ca8d4ea48a5d..e2eb53c719dc 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1190,7 +1190,14 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	if (rt)
 		rt6_set_expires(rt, jiffies + (HZ * lifetime));
 	if (ra_msg->icmph.icmp6_hop_limit) {
-		in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
+		/* Only set hop_limit on the interface if it is higher than
+		 * the current hop_limit.
+		 */
+		if (in6_dev->cnf.hop_limit < ra_msg->icmph.icmp6_hop_limit) {
+			in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
+		} else {
+			ND_PRINTK(2, warn, "RA: Got route advertisement with lower hop_limit than current\n");
+		}
 		if (rt)
 			dst_metric_set(&rt->dst, RTAX_HOPLIMIT,
 				       ra_msg->icmph.icmp6_hop_limit);

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

* [PATCH 3.16.y-ckt 106/144] iio: fix drivers that check buffer->scan_mask
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (104 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 105/144] ipv6: Don't reduce hop limit for an interface Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 107/144] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Luis Henriques
                   ` (37 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Octavian Purdila, Jonathan Cameron, Luis Henriques

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

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

From: Octavian Purdila <octavian.purdila@intel.com>

commit 70dddeee8945a0e62525a278ae7b91778f82f765 upstream.

If the in-kernel push interface is used we may have a different masks
on the device buffer and the kernel buffer and in this case the device
should generate data for the reunion of the buffers, which is
available at indio_dev->active_scan_mask.

Compiled tested only except for bmc150-accel which was tested at
runtime with the hardware.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[ luis: backported to 3.16: dropped changes to:
  - drivers/iio/accel/bmc150-accel.c
  - drivers/iio/accel/kxcjk-1013.c
  - drivers/iio/gyro/bmg160.c
  - drivers/iio/imu/kmx61.c
  - drivers/iio/proximity/sx9500.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/accel/bma180.c      | 2 +-
 drivers/iio/adc/at91_adc.c      | 5 ++---
 drivers/iio/adc/ti_am335x_adc.c | 3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 19100fddd2ed..d075d02b841f 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -483,7 +483,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)
 
 	mutex_lock(&data->mutex);
 
-	for_each_set_bit(bit, indio_dev->buffer->scan_mask,
+	for_each_set_bit(bit, indio_dev->active_scan_mask,
 			 indio_dev->masklength) {
 		ret = bma180_get_acc_reg(data, bit);
 		if (ret < 0) {
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index f508bd6b46e3..e7ff26a4aef9 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 {
 	struct iio_dev *idev = iio_trigger_get_drvdata(trig);
 	struct at91_adc_state *st = iio_priv(idev);
-	struct iio_buffer *buffer = idev->buffer;
 	struct at91_adc_reg_desc *reg = st->registers;
 	u32 status = at91_adc_readl(st, reg->trigger_register);
 	int value;
@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 		at91_adc_writel(st, reg->trigger_register,
 				status | value);
 
-		for_each_set_bit(bit, buffer->scan_mask,
+		for_each_set_bit(bit, idev->active_scan_mask,
 				 st->num_channels) {
 			struct iio_chan_spec const *chan = idev->channels + bit;
 			at91_adc_writel(st, AT91_ADC_CHER,
@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 		at91_adc_writel(st, reg->trigger_register,
 				status & ~value);
 
-		for_each_set_bit(bit, buffer->scan_mask,
+		for_each_set_bit(bit, idev->active_scan_mask,
 				 st->num_channels) {
 			struct iio_chan_spec const *chan = idev->channels + bit;
 			at91_adc_writel(st, AT91_ADC_CHDR,
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index d5dc4c6ce86c..9d2957696b23 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -189,12 +189,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
 static int tiadc_buffer_postenable(struct iio_dev *indio_dev)
 {
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
-	struct iio_buffer *buffer = indio_dev->buffer;
 	unsigned int enb = 0;
 	u8 bit;
 
 	tiadc_step_config(indio_dev);
-	for_each_set_bit(bit, buffer->scan_mask, adc_dev->channels)
+	for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels)
 		enb |= (get_adc_step_bit(adc_dev, bit) << 1);
 	adc_dev->buffer_en_ch_steps = enb;
 

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

* [PATCH 3.16.y-ckt 107/144] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (105 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 106/144] iio: fix drivers that check buffer->scan_mask Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 108/144] iio: core: Fix double free Luis Henriques
                   ` (36 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Viorel Suman, Jonathan Cameron, Luis Henriques

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

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

From: Viorel Suman <viorel.suman@gmail.com>

commit 4dac0a8eefd55bb1f157d1a5a084531334a2d74c upstream.

A hardware fifo reset always imply an invalidation of the
existing timestamps, so we'll clear timestamps fifo on
successfull hardware fifo reset.

Signed-off-by: Viorel Suman <viorel.suman@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
index 0cd306a72a6e..ba27e277511f 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
@@ -24,6 +24,16 @@
 #include <linux/poll.h>
 #include "inv_mpu_iio.h"
 
+static void inv_clear_kfifo(struct inv_mpu6050_state *st)
+{
+	unsigned long flags;
+
+	/* take the spin lock sem to avoid interrupt kick in */
+	spin_lock_irqsave(&st->time_stamp_lock, flags);
+	kfifo_reset(&st->timestamps);
+	spin_unlock_irqrestore(&st->time_stamp_lock, flags);
+}
+
 int inv_reset_fifo(struct iio_dev *indio_dev)
 {
 	int result;
@@ -50,6 +60,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev)
 					INV_MPU6050_BIT_FIFO_RST);
 	if (result)
 		goto reset_fifo_fail;
+
+	/* clear timestamps fifo */
+	inv_clear_kfifo(st);
+
 	/* enable interrupt */
 	if (st->chip_config.accl_fifo_enable ||
 	    st->chip_config.gyro_fifo_enable) {
@@ -83,16 +97,6 @@ reset_fifo_fail:
 	return result;
 }
 
-static void inv_clear_kfifo(struct inv_mpu6050_state *st)
-{
-	unsigned long flags;
-
-	/* take the spin lock sem to avoid interrupt kick in */
-	spin_lock_irqsave(&st->time_stamp_lock, flags);
-	kfifo_reset(&st->timestamps);
-	spin_unlock_irqrestore(&st->time_stamp_lock, flags);
-}
-
 /**
  * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt.
  */
@@ -184,7 +188,6 @@ end_session:
 flush_fifo:
 	/* Flush HW and SW FIFOs. */
 	inv_reset_fifo(indio_dev);
-	inv_clear_kfifo(st);
 	mutex_unlock(&indio_dev->mlock);
 	iio_trigger_notify_done(indio_dev->trig);
 

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

* [PATCH 3.16.y-ckt 108/144] iio: core: Fix double free.
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (106 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 107/144] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 109/144] USB: ftdi_sio: Added custom PID for Synapse Wireless product Luis Henriques
                   ` (35 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin Fuzzey, Jonathan Cameron, Luis Henriques

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

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

From: Martin Fuzzey <mfuzzey@parkeon.com>

commit c1b03ab5e886760bdd38c9c7a27af149046ffe01 upstream.

When an error occurred during event registration memory was freed twice
resulting in kernel memory corruption and a crash in unrelated code.

The problem was caused by
	iio_device_unregister_eventset()
	iio_device_unregister_sysfs()

being called twice, once on the error path and then
again via iio_dev_release().

Fix this by making these two functions idempotent so they
may be called multiple times.

The problem was observed before applying
	78b33216 iio:core: Handle error when mask type is not separate

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/industrialio-core.c  | 5 +++--
 drivers/iio/industrialio-event.c | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 4b1f375c5659..fa061972a2fe 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -828,8 +828,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
  * @attr_list: List of IIO device attributes
  *
  * This function frees the memory allocated for each of the IIO device
- * attributes in the list. Note: if you want to reuse the list after calling
- * this function you have to reinitialize it using INIT_LIST_HEAD().
+ * attributes in the list.
  */
 void iio_free_chan_devattr_list(struct list_head *attr_list)
 {
@@ -837,6 +836,7 @@ void iio_free_chan_devattr_list(struct list_head *attr_list)
 
 	list_for_each_entry_safe(p, n, attr_list, l) {
 		kfree(p->dev_attr.attr.name);
+		list_del(&p->l);
 		kfree(p);
 	}
 }
@@ -917,6 +917,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
 
 	iio_free_chan_devattr_list(&indio_dev->channel_attr_list);
 	kfree(indio_dev->chan_attr_group.attrs);
+	indio_dev->chan_attr_group.attrs = NULL;
 }
 
 static void iio_dev_release(struct device *device)
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index bfbf4d419f41..ad7a35f63a16 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -492,6 +492,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
 error_free_setup_event_lines:
 	iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list);
 	kfree(indio_dev->event_interface);
+	indio_dev->event_interface = NULL;
 	return ret;
 }
 

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

* [PATCH 3.16.y-ckt 109/144] USB: ftdi_sio: Added custom PID for Synapse Wireless product
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (107 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 108/144] iio: core: Fix double free Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 110/144] iwlwifi: dvm: run INIT firmware again upon .start() Luis Henriques
                   ` (34 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Doug Goldstein, Johan Hovold, Luis Henriques

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

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

From: Doug Goldstein <cardoe@cardoe.com>

commit 4899c054a90439477b24da8977db8d738376fe90 upstream.

Synapse Wireless uses the FTDI VID with a custom PID of 0x9090 for their
SNAP Stick 200 product.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     | 1 +
 drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 923500595357..c738b5fca8db 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -617,6 +617,7 @@ static const struct usb_device_id id_table_combined[] = {
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+	{ USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
 	/*
 	 * ELV devices:
 	 */
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 56b1b55c4751..4e4f46f3c89c 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -561,6 +561,12 @@
  */
 #define FTDI_NT_ORIONLXM_PID	0x7c90	/* OrionLXm Substation Automation Platform */
 
+/*
+ * Synapse Wireless product ids (FTDI_VID)
+ * http://www.synapse-wireless.com
+ */
+#define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */
+
 
 /********************************/
 /** third-party VID/PID combos **/

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

* [PATCH 3.16.y-ckt 110/144] iwlwifi: dvm: run INIT firmware again upon .start()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (108 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 109/144] USB: ftdi_sio: Added custom PID for Synapse Wireless product Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 111/144] USB: serial: keyspan_pda: fix Entrega company name spelling Luis Henriques
                   ` (33 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Emmanuel Grumbach, Luis Henriques

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

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

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

commit 9c8928f5176766bec79f272bd47b7124e11cccbd upstream.

The assumption before this patch was that we don't need to
run again the INIT firmware after the system booted. The
INIT firmware runs calibrations which impact the physical
layer's behavior.
Users reported that it may be helpful to run these
calibrations again every time the interface is brought up.
The penatly is minimal, since the calibrations run fast.
This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=94341

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/iwlwifi/dvm/dev.h   | 1 -
 drivers/net/wireless/iwlwifi/dvm/ucode.c | 5 -----
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h
index a6f22c32a279..3811878ab9cd 100644
--- a/drivers/net/wireless/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h
@@ -708,7 +708,6 @@ struct iwl_priv {
 	unsigned long reload_jiffies;
 	int reload_count;
 	bool ucode_loaded;
-	bool init_ucode_run;		/* Don't run init uCode again */
 
 	u8 plcp_delta_threshold;
 
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index d5cee1530597..80b8094deed1 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -418,9 +418,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv)
 	if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len)
 		return 0;
 
-	if (priv->init_ucode_run)
-		return 0;
-
 	iwl_init_notification_wait(&priv->notif_wait, &calib_wait,
 				   calib_complete, ARRAY_SIZE(calib_complete),
 				   iwlagn_wait_calib, priv);
@@ -440,8 +437,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv)
 	 */
 	ret = iwl_wait_notification(&priv->notif_wait, &calib_wait,
 					UCODE_CALIB_TIMEOUT);
-	if (!ret)
-		priv->init_ucode_run = true;
 
 	goto out;
 

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

* [PATCH 3.16.y-ckt 111/144] USB: serial: keyspan_pda: fix Entrega company name spelling
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (109 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 110/144] iwlwifi: dvm: run INIT firmware again upon .start() Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 112/144] USB: keyspan_pda: add new device id Luis Henriques
                   ` (32 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Knibbs, Johan Hovold, Luis Henriques

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

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

From: Mark Knibbs <markk@clara.co.uk>

commit 5f9f975b7984ffec0a25f55e58246aebf68794f4 upstream.

Entrega is misspelled as Entregra or Entrgra, so fix that.

Signed-off-by: Mark Knibbs <markk@clara.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 Documentation/usb/usb-serial.txt |  2 +-
 drivers/usb/serial/Kconfig       |  4 ++--
 drivers/usb/serial/keyspan_pda.c | 16 ++++++++--------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt
index 5bd7926185e8..947fa62bccf2 100644
--- a/Documentation/usb/usb-serial.txt
+++ b/Documentation/usb/usb-serial.txt
@@ -145,7 +145,7 @@ Keyspan PDA Serial Adapter
   Single port DB-9 serial adapter, pushed as a PDA adapter for iMacs (mostly
   sold in Macintosh catalogs, comes in a translucent white/green dongle).
   Fairly simple device. Firmware is homebrew.
-  This driver also works for the Xircom/Entrgra single port serial adapter.
+  This driver also works for the Xircom/Entrega single port serial adapter.
 
   Current status:
    Things that work:
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 6f483b8a4f56..92ad61c0f133 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -605,10 +605,10 @@ config USB_SERIAL_CYBERJACK
 	  If unsure, say N.
 
 config USB_SERIAL_XIRCOM
-	tristate "USB Xircom / Entregra Single Port Serial Driver"
+	tristate "USB Xircom / Entrega Single Port Serial Driver"
 	select USB_EZUSB_FX2
 	help
-	  Say Y here if you want to use a Xircom or Entregra single port USB to
+	  Say Y here if you want to use a Xircom or Entrega single port USB to
 	  serial converter device.  This driver makes use of firmware
 	  developed from scratch by Brian Warner.
 
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 742d827f876c..dd97d8b572c3 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -1,5 +1,5 @@
 /*
- * USB Keyspan PDA / Xircom / Entregra Converter driver
+ * USB Keyspan PDA / Xircom / Entrega Converter driver
  *
  * Copyright (C) 1999 - 2001 Greg Kroah-Hartman	<greg@kroah.com>
  * Copyright (C) 1999, 2000 Brian Warner	<warner@lothar.com>
@@ -58,11 +58,11 @@ struct keyspan_pda_private {
 #define KEYSPAN_PDA_FAKE_ID		0x0103
 #define KEYSPAN_PDA_ID			0x0104 /* no clue */
 
-/* For Xircom PGSDB9 and older Entregra version of the same device */
+/* For Xircom PGSDB9 and older Entrega version of the same device */
 #define XIRCOM_VENDOR_ID		0x085a
 #define XIRCOM_FAKE_ID			0x8027
-#define ENTREGRA_VENDOR_ID		0x1645
-#define ENTREGRA_FAKE_ID		0x8093
+#define ENTREGA_VENDOR_ID		0x1645
+#define ENTREGA_FAKE_ID			0x8093
 
 static const struct usb_device_id id_table_combined[] = {
 #ifdef KEYSPAN
@@ -70,7 +70,7 @@ static const struct usb_device_id id_table_combined[] = {
 #endif
 #ifdef XIRCOM
 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
-	{ USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
+	{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
 #endif
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
 	{ }						/* Terminating entry */
@@ -93,7 +93,7 @@ static const struct usb_device_id id_table_fake[] = {
 #ifdef XIRCOM
 static const struct usb_device_id id_table_fake_xircom[] = {
 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
-	{ USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
+	{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
 	{ }
 };
 #endif
@@ -667,7 +667,7 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial)
 #endif
 #ifdef XIRCOM
 	else if ((le16_to_cpu(serial->dev->descriptor.idVendor) == XIRCOM_VENDOR_ID) ||
-		 (le16_to_cpu(serial->dev->descriptor.idVendor) == ENTREGRA_VENDOR_ID))
+		 (le16_to_cpu(serial->dev->descriptor.idVendor) == ENTREGA_VENDOR_ID))
 		fw_name = "keyspan_pda/xircom_pgs.fw";
 #endif
 	else {
@@ -744,7 +744,7 @@ static struct usb_serial_driver xircom_pgs_fake_device = {
 		.owner =	THIS_MODULE,
 		.name =		"xircom_no_firm",
 	},
-	.description =		"Xircom / Entregra PGS - (prerenumeration)",
+	.description =		"Xircom / Entrega PGS - (prerenumeration)",
 	.id_table =		id_table_fake_xircom,
 	.num_ports =		1,
 	.attach =		keyspan_pda_fake_startup,

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

* [PATCH 3.16.y-ckt 112/144] USB: keyspan_pda: add new device id
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (110 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 111/144] USB: serial: keyspan_pda: fix Entrega company name spelling Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 113/144] cifs: smb2_clone_range() - exit on unhandled error Luis Henriques
                   ` (31 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nathaniel Wesley Filardo, Johan Hovold, Luis Henriques

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

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

From: Nathaniel W Filardo <nwf@cs.jhu.edu>

commit 5e71fc8629cefae5f3c1a4f498de3fe4f631924a upstream.

Add USB VID/PID for Xircom PGMFHUB USB/serial component.  (The hub and SCSI
bridge on that hardware are recognized out of the box by existing drivers.)
Tested VID/PID using new_id and loopback connection and was met with
success, but that's all the testing done.

Signed-off-by: Nathaniel Wesley Filardo <nwf@cs.jhu.edu>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/keyspan_pda.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index dd97d8b572c3..4f7e072e4e00 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -61,6 +61,7 @@ struct keyspan_pda_private {
 /* For Xircom PGSDB9 and older Entrega version of the same device */
 #define XIRCOM_VENDOR_ID		0x085a
 #define XIRCOM_FAKE_ID			0x8027
+#define XIRCOM_FAKE_ID_2		0x8025 /* "PGMFHUB" serial */
 #define ENTREGA_VENDOR_ID		0x1645
 #define ENTREGA_FAKE_ID			0x8093
 
@@ -70,6 +71,7 @@ static const struct usb_device_id id_table_combined[] = {
 #endif
 #ifdef XIRCOM
 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
+	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
 	{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
 #endif
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
@@ -93,6 +95,7 @@ static const struct usb_device_id id_table_fake[] = {
 #ifdef XIRCOM
 static const struct usb_device_id id_table_fake_xircom[] = {
 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
+	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
 	{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
 	{ }
 };

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

* [PATCH 3.16.y-ckt 113/144] cifs: smb2_clone_range() - exit on unhandled error
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (111 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 112/144] USB: keyspan_pda: add new device id Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 114/144] cifs: fix use-after-free bug in find_writable_file Luis Henriques
                   ` (30 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sachin Prabhu, Steve French, Steve French, Luis Henriques

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

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

From: Sachin Prabhu <sprabhu@redhat.com>

commit 2477bc58d49edb1c0baf59df7dc093dce682af2b upstream.

While attempting to clone a file on a samba server, we receive a
STATUS_INVALID_DEVICE_REQUEST. This is mapped to -EOPNOTSUPP which
isn't handled in smb2_clone_range(). We end up looping in the while loop
making same call to the samba server over and over again.

The proposed fix is to exit and return the error value when encountered
with an unhandled error.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Steve French <steve.french@primarydata.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/cifs/smb2ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index f325c59e12e6..772ee0ecf32a 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -630,7 +630,8 @@ smb2_clone_range(const unsigned int xid,
 
 			/* No need to change MaxChunks since already set to 1 */
 			chunk_sizes_updated = true;
-		}
+		} else
+			goto cchunk_out;
 	}
 
 cchunk_out:

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

* [PATCH 3.16.y-ckt 114/144] cifs: fix use-after-free bug in find_writable_file
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (112 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 113/144] cifs: smb2_clone_range() - exit on unhandled error Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 115/144] can: flexcan: Deferred on Regulator return EPROBE_DEFER Luis Henriques
                   ` (29 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Disseldorp, Steve French, Luis Henriques

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

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

From: David Disseldorp <ddiss@suse.de>

commit e1e9bda22d7ddf88515e8fe401887e313922823e upstream.

Under intermittent network outages, find_writable_file() is susceptible
to the following race condition, which results in a user-after-free in
the cifs_writepages code-path:

Thread 1                                        Thread 2
========                                        ========

inv_file = NULL
refind = 0
spin_lock(&cifs_file_list_lock)

// invalidHandle found on openFileList

inv_file = open_file
// inv_file->count currently 1

cifsFileInfo_get(inv_file)
// inv_file->count = 2

spin_unlock(&cifs_file_list_lock);

cifs_reopen_file()                            cifs_close()
// fails (rc != 0)                            ->cifsFileInfo_put()
                                       spin_lock(&cifs_file_list_lock)
                                       // inv_file->count = 1
                                       spin_unlock(&cifs_file_list_lock)

spin_lock(&cifs_file_list_lock);
list_move_tail(&inv_file->flist,
      &cifs_inode->openFileList);
spin_unlock(&cifs_file_list_lock);

cifsFileInfo_put(inv_file);
->spin_lock(&cifs_file_list_lock)

  // inv_file->count = 0
  list_del(&cifs_file->flist);
  // cleanup!!
  kfree(cifs_file);

  spin_unlock(&cifs_file_list_lock);

spin_lock(&cifs_file_list_lock);
++refind;
// refind = 1
goto refind_writable;

At this point we loop back through with an invalid inv_file pointer
and a refind value of 1. On second pass, inv_file is not overwritten on
openFileList traversal, and is subsequently dereferenced.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Jeff Layton <jlayton@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 58dff97aafef..e645b9f4f6a3 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1821,6 +1821,7 @@ refind_writable:
 			cifsFileInfo_put(inv_file);
 			spin_lock(&cifs_file_list_lock);
 			++refind;
+			inv_file = NULL;
 			goto refind_writable;
 		}
 	}

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

* [PATCH 3.16.y-ckt 115/144] can: flexcan: Deferred on Regulator return EPROBE_DEFER
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (113 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 114/144] cifs: fix use-after-free bug in find_writable_file Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 116/144] xen/balloon: before adding hotplugged memory, set frames to invalid Luis Henriques
                   ` (28 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andreas Werner, Marc Kleine-Budde, Luis Henriques

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

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

From: Andreas Werner <kernel@andy89.org>

commit 555828ef45f825d6ee06559f0304163550eed380 upstream.

Return EPROBE_DEFER if Regulator returns EPROBE_DEFER

If the Flexcan driver is built into kernel and a regulator is used to
enable the CAN transceiver, the Flexcan driver may not use the regulator.

When initializing the Flexcan device with a regulator defined in the device
tree, but not initialized, the regulator subsystem returns EPROBE_DEFER, hence
the Flexcan init fails.

The solution for this is to return EPROBE_DEFER if regulator is not initialized
and wait until the regulator is initialized.

Signed-off-by: Andreas Werner <kernel@andy89.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/flexcan.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 9fc6f2cc2ed2..bf83639888a9 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1131,12 +1131,19 @@ static int flexcan_probe(struct platform_device *pdev)
 	const struct flexcan_devtype_data *devtype_data;
 	struct net_device *dev;
 	struct flexcan_priv *priv;
+	struct regulator *reg_xceiver;
 	struct resource *mem;
 	struct clk *clk_ipg = NULL, *clk_per = NULL;
 	void __iomem *base;
 	int err, irq;
 	u32 clock_freq = 0;
 
+	reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
+	if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+	else if (IS_ERR(reg_xceiver))
+		reg_xceiver = NULL;
+
 	if (pdev->dev.of_node)
 		of_property_read_u32(pdev->dev.of_node,
 						"clock-frequency", &clock_freq);
@@ -1198,9 +1205,7 @@ static int flexcan_probe(struct platform_device *pdev)
 	priv->pdata = dev_get_platdata(&pdev->dev);
 	priv->devtype_data = devtype_data;
 
-	priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
-	if (IS_ERR(priv->reg_xceiver))
-		priv->reg_xceiver = NULL;
+	priv->reg_xceiver = reg_xceiver;
 
 	netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT);
 

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

* [PATCH 3.16.y-ckt 116/144] xen/balloon: before adding hotplugged memory, set frames to invalid
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (114 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 115/144] can: flexcan: Deferred on Regulator return EPROBE_DEFER Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 117/144] usb: xhci: handle Config Error Change (CEC) in xhci driver Luis Henriques
                   ` (27 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Juergen Gross, David Vrabel, Luis Henriques

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

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

From: Juergen Gross <jgross@suse.com>

commit 3c56b3a12ce52f361468cbdd2f79b2f3b8da0ea6 upstream.

Commit 25b884a83d487fd62c3de7ac1ab5549979188482 ("x86/xen: set
regions above the end of RAM as 1:1") introduced a regression.

To be able to add memory pages which were added via memory hotplug to
a pv domain, the pages must be "invalid" instead of "identity" in the
p2m list before they can be added.

Suggested-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/xen/balloon.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 5c660c77f03b..8db7abb6ef5a 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -227,6 +227,29 @@ static enum bp_state reserve_additional_memory(long credit)
 	balloon_hotplug = round_up(balloon_hotplug, PAGES_PER_SECTION);
 	nid = memory_add_physaddr_to_nid(hotplug_start_paddr);
 
+#ifdef CONFIG_XEN_HAVE_PVMMU
+        /*
+         * add_memory() will build page tables for the new memory so
+         * the p2m must contain invalid entries so the correct
+         * non-present PTEs will be written.
+         *
+         * If a failure occurs, the original (identity) p2m entries
+         * are not restored since this region is now known not to
+         * conflict with any devices.
+         */ 
+	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+		unsigned long pfn, i;
+
+		pfn = PFN_DOWN(hotplug_start_paddr);
+		for (i = 0; i < balloon_hotplug; i++) {
+			if (!set_phys_to_machine(pfn + i, INVALID_P2M_ENTRY)) {
+				pr_warn("set_phys_to_machine() failed, no memory added\n");
+				return BP_ECANCELED;
+			}
+                }
+	}
+#endif
+
 	rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT);
 
 	if (rc) {

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

* [PATCH 3.16.y-ckt 117/144] usb: xhci: handle Config Error Change (CEC) in xhci driver
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (115 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 116/144] xen/balloon: before adding hotplugged memory, set frames to invalid Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 118/144] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Luis Henriques
                   ` (26 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lu Baolu, Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

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

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

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

commit 9425183d177aa4a2f09d01a74925124f0778b595 upstream.

Linux xHCI driver doesn't report and handle port cofig error change.
If Port Configure Error for root hub port occurs, CEC bit in PORTSC
would be set by xHC and remains 1. This happends when the root port
fails to configure its link partner, e.g. the port fails to exchange
port capabilities information using Port Capability LMPs.

Then the Port Status Change Events will be blocked until all status
change bits(CEC is one of the change bits) are cleared('0') (refer to
xHCI spec 4.19.2). Otherwise, the port status change event for this
root port will not be generated anymore, then root port would look
like dead for user and can't be recovered until a Host Controller
Reset(HCRST).

This patch is to check CEC bit in PORTSC in xhci_get_port_status()
and set a Config Error in the return status if CEC is set. This will
cause a ClearPortFeature request, where CEC bit is cleared in
xhci_clear_port_change_bit().

[The commit log is based on initial Marvell patch posted at
http://marc.info/?l=linux-kernel&m=142323612321434&w=2]

Reported-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
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>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-hub.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 64f0ddac957f..8c21c3bcd59b 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -380,6 +380,10 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue,
 		status = PORT_PLC;
 		port_change_bit = "link state";
 		break;
+	case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
+		status = PORT_CEC;
+		port_change_bit = "config error";
+		break;
 	default:
 		/* Should never happen */
 		return;
@@ -581,6 +585,8 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
 			status |= USB_PORT_STAT_C_LINK_STATE << 16;
 		if ((raw_port_status & PORT_WRC))
 			status |= USB_PORT_STAT_C_BH_RESET << 16;
+		if ((raw_port_status & PORT_CEC))
+			status |= USB_PORT_STAT_C_CONFIG_ERROR << 16;
 	}
 
 	if (hcd->speed != HCD_USB3) {
@@ -998,6 +1004,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 		case USB_PORT_FEAT_C_OVER_CURRENT:
 		case USB_PORT_FEAT_C_ENABLE:
 		case USB_PORT_FEAT_C_PORT_LINK_STATE:
+		case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
 			xhci_clear_port_change_bit(xhci, wValue, wIndex,
 					port_array[wIndex], temp);
 			break;
@@ -1062,7 +1069,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
 	 */
 	status = bus_state->resuming_ports;
 
-	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC;
+	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
 
 	spin_lock_irqsave(&xhci->lock, flags);
 	/* For each port, did anything change?  If so, set that bit in buf. */

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

* [PATCH 3.16.y-ckt 118/144] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (116 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 117/144] usb: xhci: handle Config Error Change (CEC) in xhci driver Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 119/144] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Luis Henriques
                   ` (25 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lu Baolu, Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

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

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

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

commit 227a4fd801c8a9fa2c4700ab98ec1aec06e3b44d upstream.

When a device with an isochronous endpoint is plugged into the Intel
xHCI host controller, and the driver submits multiple frames per URB,
the xHCI driver will set the Block Event Interrupt (BEI) flag on all
but the last TD for the URB. This causes the host controller to place
an event on the event ring, but not send an interrupt. When the last
TD for the URB completes, BEI is cleared, and we get an interrupt for
the whole URB.

However, under Intel xHCI host controllers, if the event ring is full
of events from transfers with BEI set,  an "Event Ring is Full" event
will be posted to the last entry of the event ring,  but no interrupt
is generated. Host will cease all transfer and command executions and
wait until software completes handling the pending events in the event
ring.  That means xHC stops, but event of "event ring is full" is not
notified. As the result, the xHC looks like dead to user.

This patch is to apply XHCI_AVOID_BEI quirk to Intel xHC devices. And
it should be backported to kernels as old as 3.0, that contains the
commit 69e848c2090a ("Intel xhci: Support EHCI/xHCI port switching.").

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Tested-by: Alistair Grant <akgrant0710@gmail.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-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index c947bfd260a9..7a68fe1795a5 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -113,6 +113,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 		xhci->quirks |= XHCI_INTEL_HOST;
+		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 			pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
@@ -128,7 +129,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 		 * PPT chipsets.
 		 */
 		xhci->quirks |= XHCI_SPURIOUS_REBOOT;
-		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 		pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {

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

* [PATCH 3.16.y-ckt 119/144] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (117 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 118/144] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 120/144] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Luis Henriques
                   ` (24 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Doug Goldstein, Johan Hovold, Luis Henriques

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

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

From: Doug Goldstein <cardoe@cardoe.com>

commit b229a0f840f774d29d8fedbf5deb344ca36b7f1a upstream.

This patch uses the existing CALAO Systems ftdi_8u2232c_probe in order
to avoid attaching a TTY to the JTAG port as this board is based on the
CALAO Systems reference design and needs the same fix up.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
[johan: clean up probe logic ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index c738b5fca8db..2d858f81ab33 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1902,8 +1902,12 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
 {
 	struct usb_device *udev = serial->dev;
 
-	if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) ||
-	    (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2")))
+	if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems"))
+		return ftdi_jtag_probe(serial);
+
+	if (udev->product &&
+		(!strcmp(udev->product, "BeagleBone/XDS100V2") ||
+		 !strcmp(udev->product, "SNAP Connect E10")))
 		return ftdi_jtag_probe(serial);
 
 	return 0;

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

* [PATCH 3.16.y-ckt 120/144] tty: serial: fsl_lpuart: clear receive flag on FIFO flush
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (118 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 119/144] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 121/144] drm/radeon/dpm: fix 120hz handling harder Luis Henriques
                   ` (23 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan Agner, Greg Kroah-Hartman, Luis Henriques

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

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

From: Stefan Agner <stefan@agner.ch>

commit 8e4934c6d6c659e22b1b746af4196683e77ce6ca upstream.

When the receiver was enabled during startup, a character could
have been in the FIFO when the UART get initially used. The
driver configures the (receive) watermark level, and flushes the
FIFO. However, the receive flag (RDRF) could still be set at that
stage (as mentioned in the register description of UARTx_RWFIFO).
This leads to an interrupt which won't be handled properly in
interrupt mode: The receive interrupt function lpuart_rxint checks
the FIFO count, which is 0 at that point (due to the flush
during initialization). The problem does not manifest when using
DMA to receive characters.

Fix this situation by explicitly read the status register, which
leads to clearing of the RDRF flag. Due to the flush just after
the status flag read, a explicit data read is not to required.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/serial/fsl_lpuart.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 05a033e7446c..2b49f2abd8b5 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -608,6 +608,9 @@ static void lpuart_setup_watermark(struct lpuart_port *sport)
 	writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE,
 			sport->port.membase + UARTPFIFO);
 
+	/* explicitly clear RDRF */
+	readb(sport->port.membase + UARTSR1);
+
 	/* flush Tx and Rx FIFO */
 	writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH,
 			sport->port.membase + UARTCFIFO);

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

* [PATCH 3.16.y-ckt 121/144] drm/radeon/dpm: fix 120hz handling harder
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (119 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 120/144] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 122/144] radeon: Do not directly dereference pointers to BIOS area Luis Henriques
                   ` (22 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

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

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

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

commit 3899ca844b82fb201fb764f56eec483acb59a29c upstream.

Need to expand the check to handle short circuiting
if the selected state is the same as current state.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=87796

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/radeon.h    |  1 +
 drivers/gpu/drm/radeon/radeon_pm.c | 22 +++++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index a7861a4ba340..96b85d632a38 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1512,6 +1512,7 @@ struct radeon_dpm {
 	int			new_active_crtc_count;
 	u32			current_active_crtcs;
 	int			current_active_crtc_count;
+	bool single_display;
 	struct radeon_dpm_dynamic_state dyn_state;
 	struct radeon_dpm_fan fan;
 	u32 tdp_limit;
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 4d48e00e25b6..5baef4473e25 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -704,12 +704,8 @@ static void radeon_dpm_thermal_work_handler(struct work_struct *work)
 	radeon_pm_compute_clocks(rdev);
 }
 
-static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
-						     enum radeon_pm_state_type dpm_state)
+static bool radeon_dpm_single_display(struct radeon_device *rdev)
 {
-	int i;
-	struct radeon_ps *ps;
-	u32 ui_class;
 	bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ?
 		true : false;
 
@@ -719,6 +715,17 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
 			single_display = false;
 	}
 
+	return single_display;
+}
+
+static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
+						     enum radeon_pm_state_type dpm_state)
+{
+	int i;
+	struct radeon_ps *ps;
+	u32 ui_class;
+	bool single_display = radeon_dpm_single_display(rdev);
+
 	/* certain older asics have a separare 3D performance state,
 	 * so try that first if the user selected performance
 	 */
@@ -844,6 +851,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
 	struct radeon_ps *ps;
 	enum radeon_pm_state_type dpm_state;
 	int ret;
+	bool single_display = radeon_dpm_single_display(rdev);
 
 	/* if dpm init failed */
 	if (!rdev->pm.dpm_enabled)
@@ -868,6 +876,9 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
 		/* vce just modifies an existing state so force a change */
 		if (ps->vce_active != rdev->pm.dpm.vce_active)
 			goto force;
+		/* user has made a display change (such as timing) */
+		if (rdev->pm.dpm.single_display != single_display)
+			goto force;
 		if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) {
 			/* for pre-BTC and APUs if the num crtcs changed but state is the same,
 			 * all we need to do is update the display configuration.
@@ -930,6 +941,7 @@ force:
 
 	rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs;
 	rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count;
+	rdev->pm.dpm.single_display = single_display;
 
 	/* wait for the rings to drain */
 	for (i = 0; i < RADEON_NUM_RINGS; i++) {

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

* [PATCH 3.16.y-ckt 122/144] radeon: Do not directly dereference pointers to BIOS area.
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (120 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 121/144] drm/radeon/dpm: fix 120hz handling harder Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 123/144] iio: adc: vf610: use ADC clock within specification Luis Henriques
                   ` (21 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David S. Miller, Alex Deucher, Luis Henriques

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

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

From: David Miller <davem@davemloft.net>

commit f2c9e560b406f2f6b14b345c7da33467dee9cdf2 upstream.

Use readb() and memcpy_fromio() accessors instead.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_bios.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 6a03624fadaa..a1ebf2c629ed 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
 
 static bool radeon_read_bios(struct radeon_device *rdev)
 {
-	uint8_t __iomem *bios;
+	uint8_t __iomem *bios, val1, val2;
 	size_t size;
 
 	rdev->bios = NULL;
@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev)
 		return false;
 	}
 
-	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+	val1 = readb(&bios[0]);
+	val2 = readb(&bios[1]);
+
+	if (size == 0 || val1 != 0x55 || val2 != 0xaa) {
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
 	}
-	rdev->bios = kmemdup(bios, size, GFP_KERNEL);
+	rdev->bios = kzalloc(size, GFP_KERNEL);
 	if (rdev->bios == NULL) {
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
 	}
+	memcpy_fromio(rdev->bios, bios, size);
 	pci_unmap_rom(rdev->pdev, bios);
 	return true;
 }

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

* [PATCH 3.16.y-ckt 123/144] iio: adc: vf610: use ADC clock within specification
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (121 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 122/144] radeon: Do not directly dereference pointers to BIOS area Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 124/144] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Luis Henriques
                   ` (20 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan Agner, Jonathan Cameron, Luis Henriques

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

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

From: Stefan Agner <stefan@agner.ch>

commit f54e9f2be312a4e71b54aea865b2e33ccb95ef0c upstream.

Depending on conversion mode used, the ADC clock (ADCK) needs
to be below a maximum frequency. According to Vybrid's data
sheet this is 20MHz for the low power conversion mode.

The ADC clock is depending on input clock, which is the bus
clock by default. Vybrid SoC are typically clocked at at 400MHz
or 500MHz, which leads to 66MHz or 83MHz bus clock respectively.
Hence, a divider of 8 is required to stay below the specified
maximum clock of 20MHz.

Due to the different bus clock speeds, the resulting sampling
frequency is not static. Hence use the ADC clock and calculate
the actual available sampling frequency dynamically.

This fixes bogous values observed on some 500MHz clocked Vybrid
SoC. The resulting value usually showed Bit 9 being stuck at 1,
or 0, which lead to a value of +/-512.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/adc/vf610_adc.c | 91 ++++++++++++++++++++++++++++++---------------
 1 file changed, 61 insertions(+), 30 deletions(-)

diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
index 44799eb5930e..11048473b89e 100644
--- a/drivers/iio/adc/vf610_adc.c
+++ b/drivers/iio/adc/vf610_adc.c
@@ -141,9 +141,13 @@ struct vf610_adc {
 	struct regulator *vref;
 	struct vf610_adc_feature adc_feature;
 
+	u32 sample_freq_avail[5];
+
 	struct completion completion;
 };
 
+static const u32 vf610_hw_avgs[] = { 1, 4, 8, 16, 32 };
+
 #define VF610_ADC_CHAN(_idx, _chan_type) {			\
 	.type = (_chan_type),					\
 	.indexed = 1,						\
@@ -173,35 +177,47 @@ static const struct iio_chan_spec vf610_adc_iio_channels[] = {
 	/* sentinel */
 };
 
-/*
- * ADC sample frequency, unit is ADCK cycles.
- * ADC clk source is ipg clock, which is the same as bus clock.
- *
- * ADC conversion time = SFCAdder + AverageNum x (BCT + LSTAdder)
- * SFCAdder: fixed to 6 ADCK cycles
- * AverageNum: 1, 4, 8, 16, 32 samples for hardware average.
- * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode
- * LSTAdder(Long Sample Time): fixed to 3 ADCK cycles
- *
- * By default, enable 12 bit resolution mode, clock source
- * set to ipg clock, So get below frequency group:
- */
-static const u32 vf610_sample_freq_avail[5] =
-{1941176, 559332, 286957, 145374, 73171};
+static inline void vf610_adc_calculate_rates(struct vf610_adc *info)
+{
+	unsigned long adck_rate, ipg_rate = clk_get_rate(info->clk);
+	int i;
+
+	/*
+	 * Calculate ADC sample frequencies
+	 * Sample time unit is ADCK cycles. ADCK clk source is ipg clock,
+	 * which is the same as bus clock.
+	 *
+	 * ADC conversion time = SFCAdder + AverageNum x (BCT + LSTAdder)
+	 * SFCAdder: fixed to 6 ADCK cycles
+	 * AverageNum: 1, 4, 8, 16, 32 samples for hardware average.
+	 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode
+	 * LSTAdder(Long Sample Time): fixed to 3 ADCK cycles
+	 */
+	adck_rate = ipg_rate / info->adc_feature.clk_div;
+	for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++)
+		info->sample_freq_avail[i] =
+			adck_rate / (6 + vf610_hw_avgs[i] * (25 + 3));
+}
 
 static inline void vf610_adc_cfg_init(struct vf610_adc *info)
 {
+	struct vf610_adc_feature *adc_feature = &info->adc_feature;
+
 	/* set default Configuration for ADC controller */
-	info->adc_feature.clk_sel = VF610_ADCIOC_BUSCLK_SET;
-	info->adc_feature.vol_ref = VF610_ADCIOC_VR_VREF_SET;
+	adc_feature->clk_sel = VF610_ADCIOC_BUSCLK_SET;
+	adc_feature->vol_ref = VF610_ADCIOC_VR_VREF_SET;
+
+	adc_feature->calibration = true;
+	adc_feature->ovwren = true;
+
+	adc_feature->res_mode = 12;
+	adc_feature->sample_rate = 1;
+	adc_feature->lpm = true;
 
-	info->adc_feature.calibration = true;
-	info->adc_feature.ovwren = true;
+	/* Use a save ADCK which is below 20MHz on all devices */
+	adc_feature->clk_div = 8;
 
-	info->adc_feature.clk_div = 1;
-	info->adc_feature.res_mode = 12;
-	info->adc_feature.sample_rate = 1;
-	info->adc_feature.lpm = true;
+	vf610_adc_calculate_rates(info);
 }
 
 static void vf610_adc_cfg_post_set(struct vf610_adc *info)
@@ -283,12 +299,10 @@ static void vf610_adc_cfg_set(struct vf610_adc *info)
 
 	cfg_data = readl(info->regs + VF610_REG_ADC_CFG);
 
-	/* low power configuration */
 	cfg_data &= ~VF610_ADC_ADLPC_EN;
 	if (adc_feature->lpm)
 		cfg_data |= VF610_ADC_ADLPC_EN;
 
-	/* disable high speed */
 	cfg_data &= ~VF610_ADC_ADHSC_EN;
 
 	writel(cfg_data, info->regs + VF610_REG_ADC_CFG);
@@ -428,10 +442,27 @@ static irqreturn_t vf610_adc_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("1941176, 559332, 286957, 145374, 73171");
+static ssize_t vf610_show_samp_freq_avail(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct vf610_adc *info = iio_priv(dev_to_iio_dev(dev));
+	size_t len = 0;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(info->sample_freq_avail); i++)
+		len += scnprintf(buf + len, PAGE_SIZE - len,
+			"%u ", info->sample_freq_avail[i]);
+
+	/* replace trailing space by newline */
+	buf[len - 1] = '\n';
+
+	return len;
+}
+
+static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(vf610_show_samp_freq_avail);
 
 static struct attribute *vf610_attributes[] = {
-	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
+	&iio_dev_attr_sampling_frequency_available.dev_attr.attr,
 	NULL
 };
 
@@ -478,7 +509,7 @@ static int vf610_read_raw(struct iio_dev *indio_dev,
 		return IIO_VAL_FRACTIONAL_LOG2;
 
 	case IIO_CHAN_INFO_SAMP_FREQ:
-		*val = vf610_sample_freq_avail[info->adc_feature.sample_rate];
+		*val = info->sample_freq_avail[info->adc_feature.sample_rate];
 		*val2 = 0;
 		return IIO_VAL_INT;
 
@@ -501,9 +532,9 @@ static int vf610_write_raw(struct iio_dev *indio_dev,
 	switch (mask) {
 		case IIO_CHAN_INFO_SAMP_FREQ:
 			for (i = 0;
-				i < ARRAY_SIZE(vf610_sample_freq_avail);
+				i < ARRAY_SIZE(info->sample_freq_avail);
 				i++)
-				if (val == vf610_sample_freq_avail[i]) {
+				if (val == info->sample_freq_avail[i]) {
 					info->adc_feature.sample_rate = i;
 					vf610_adc_sample_set(info);
 					return 0;

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

* [PATCH 3.16.y-ckt 124/144] iio: imu: Use iio_trigger_get for indio_dev->trig assignment
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (122 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 123/144] iio: adc: vf610: use ADC clock within specification Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 125/144] dmaengine: edma: fix memory leak when terminating running transfers Luis Henriques
                   ` (19 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Darshana Padmadas, Jonathan Cameron, Luis Henriques

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

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

From: Darshana Padmadas <darshanapadmadas@gmail.com>

commit 4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4 upstream.

This patch uses iio_trigger_get to increment the reference
count of trigger device, to avoid incorrect assignment.
Can result in a null pointer dereference during removal if the
trigger has been changed before removal.

This patch refers to a similar situation encountered through the
following discussion:
http://www.spinics.net/lists/linux-iio/msg13669.html

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/imu/adis_trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index e0017c22bb9c..f53e9a803a0e 100644
--- a/drivers/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
 	iio_trigger_set_drvdata(adis->trig, adis);
 	ret = iio_trigger_register(adis->trig);
 
-	indio_dev->trig = adis->trig;
+	indio_dev->trig = iio_trigger_get(adis->trig);
 	if (ret)
 		goto error_free_irq;
 

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

* [PATCH 3.16.y-ckt 125/144] dmaengine: edma: fix memory leak when terminating running transfers
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (123 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 124/144] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 126/144] dmaengine: omap-dma: Fix memory leak when terminating running transfer Luis Henriques
                   ` (18 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Petr Kulhavy, Peter Ujfalusi, linux-omap, Vinod Koul, Luis Henriques

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

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

From: Petr Kulhavy <petr@barix.com>

commit 5ca9e7ce6eebec53362ff779264143860ccf68cd upstream.

If edma_terminate_all() was called while a transfer was running (i.e. after
edma_execute() but before edma_callback()) the echan->edesc was not freed.

This was due to the fact that a running transfer is on none of the
vchan lists: desc_submitted, desc_issued, desc_completed (edma_execute()
removes it from the desc_issued list), so the vchan_dma_desc_free_list()
called at the end of edma_terminate_all() didn't find it and didn't free it.

This bug was found on an AM1808 based hardware (very similar to da850evm,
however using the second MMC/SD controller), where intense operations on the SD
card wasted the device 128MB RAM within a couple of days.

Peter Ujfalusi:
The issue is even more severe since it affects cyclic (audio) transfers as
well. In this case starting/stopping audio will results memory leak.

Signed-off-by: Petr Kulhavy <petr@barix.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: <linux-omap@vger.kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/dma/edma.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index d08c4dedef35..3c58df963e06 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -256,6 +256,12 @@ static int edma_terminate_all(struct edma_chan *echan)
 	 * echan->edesc is NULL and exit.)
 	 */
 	if (echan->edesc) {
+		/*
+		 * free the running request descriptor
+		 * since it is not in any of the vdesc lists
+		 */
+		edma_desc_free(&echan->edesc->vdesc);
+
 		echan->edesc = NULL;
 		edma_stop(echan->ch_num);
 	}

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

* [PATCH 3.16.y-ckt 126/144] dmaengine: omap-dma: Fix memory leak when terminating running transfer
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (124 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 125/144] dmaengine: edma: fix memory leak when terminating running transfers Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 127/144] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Luis Henriques
                   ` (17 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Ujfalusi, linux-omap, Vinod Koul, Luis Henriques

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

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

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

commit 02d88b735f5a60f04dbf6d051b76e1877a0d0844 upstream.

In omap_dma_start_desc the vdesc->node is removed from the virt-dma
framework managed lists (to be precise from the desc_issued list).
If a terminate_all comes before the transfer finishes the omap_desc will
not be freed up because it is not in any of the lists and we stopped the
DMA channel so the transfer will not going to complete.
There is no special sequence for leaking memory when using cyclic (audio)
transfer: with every start and stop of a cyclic transfer the driver leaks
struct omap_desc worth of memory.

Free up the allocated memory directly in omap_dma_terminate_all() since the
framework will not going to do that for us.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: <linux-omap@vger.kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/dma/omap-dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index b19f04f4390b..2e63234a9e7f 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -979,6 +979,7 @@ static int omap_dma_terminate_all(struct omap_chan *c)
 	 * c->desc is NULL and exit.)
 	 */
 	if (c->desc) {
+		omap_dma_desc_free(&c->desc->vd);
 		c->desc = NULL;
 		/* Avoid stopping the dma twice */
 		if (!c->paused)

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

* [PATCH 3.16.y-ckt 127/144] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (125 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 126/144] dmaengine: omap-dma: Fix memory leak when terminating running transfer Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 128/144] mac80211: fix RX A-MPDU session reorder timer deletion Luis Henriques
                   ` (16 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan Lippers-Hollmann, Matt Fleming, Ingo Molnar, Luis Henriques

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

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

From: Stefan Lippers-Hollmann <s.l-h@gmx.de>

commit 80313b3078fcd2ca51970880d90757f05879a193 upstream.

The ASRock Q1900DC-ITX mainboard (Baytrail-D) hangs randomly in
both BIOS and UEFI mode while rebooting unless reboot=pci is
used. Add a quirk to reboot via the pci method.

The problem is very intermittent and hard to debug, it might succeed
rebooting just fine 40 times in a row - but fails half a dozen times
the next day. It seems to be slightly less common in BIOS CSM mode
than native UEFI (with the CSM disabled), but it does happen in either
mode. Since I've started testing this patch in late january, rebooting
has been 100% reliable.

Most of the time it already hangs during POST, but occasionally it
might even make it through the bootloader and the kernel might even
start booting, but then hangs before the mode switch. The same symptoms
occur with grub-efi, gummiboot and grub-pc, just as well as (at least)
kernel 3.16-3.19 and 4.0-rc6 (I haven't tried older kernels than 3.16).
Upgrading to the most current mainboard firmware of the ASRock
Q1900DC-ITX, version 1.20, does not improve the situation.

( Searching the web seems to suggest that other Bay Trail-D mainboards
  might be affected as well. )
--
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: Matt Fleming <matt.fleming@intel.com>
Link: http://lkml.kernel.org/r/20150330224427.0fb58e42@mir
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/reboot.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 52b1157c53eb..f319bfea154e 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -181,6 +181,16 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
 		},
 	},
 
+	/* ASRock */
+	{	/* Handle problems with rebooting on ASRock Q1900DC-ITX */
+		.callback = set_pci_reboot,
+		.ident = "ASRock Q1900DC-ITX",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "ASRock"),
+			DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"),
+		},
+	},
+
 	/* ASUS */
 	{	/* Handle problems with rebooting on ASUS P4S800 */
 		.callback = set_bios_reboot,

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

* [PATCH 3.16.y-ckt 128/144] mac80211: fix RX A-MPDU session reorder timer deletion
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (126 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 127/144] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 129/144] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Luis Henriques
                   ` (15 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johannes Berg, Luis Henriques

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

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

From: Johannes Berg <johannes.berg@intel.com>

commit 788211d81bfdf9b6a547d0530f206ba6ee76b107 upstream.

There's an issue with the way the RX A-MPDU reorder timer is
deleted that can cause a kernel crash like this:

 * tid_rx is removed - call_rcu(ieee80211_free_tid_rx)
 * station is destroyed
 * reorder timer fires before ieee80211_free_tid_rx() runs,
   accessing the station, thus potentially crashing due to
   the use-after-free

The station deletion is protected by synchronize_net(), but
that isn't enough -- ieee80211_free_tid_rx() need not have
run when that returns (it deletes the timer.) We could use
rcu_barrier() instead of synchronize_net(), but that's much
more expensive.

Instead, to fix this, add a field tracking that the session
is being deleted. In this case, the only re-arming of the
timer happens with the reorder spinlock held, so make that
code not rearm it if the session is being deleted and also
delete the timer after setting that field. This ensures the
timer cannot fire after ___ieee80211_stop_rx_ba_session()
returns, which fixes the problem.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/agg-rx.c   | 8 ++++++--
 net/mac80211/rx.c       | 7 ++++---
 net/mac80211/sta_info.h | 2 ++
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 31bf2586fb84..9608c6e65887 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -49,8 +49,6 @@ static void ieee80211_free_tid_rx(struct rcu_head *h)
 		container_of(h, struct tid_ampdu_rx, rcu_head);
 	int i;
 
-	del_timer_sync(&tid_rx->reorder_timer);
-
 	for (i = 0; i < tid_rx->buf_size; i++)
 		dev_kfree_skb(tid_rx->reorder_buf[i]);
 	kfree(tid_rx->reorder_buf);
@@ -93,6 +91,12 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
 
 	del_timer_sync(&tid_rx->session_timer);
 
+	/* make sure ieee80211_sta_reorder_release() doesn't re-arm the timer */
+	spin_lock_bh(&tid_rx->reorder_lock);
+	tid_rx->removed = true;
+	spin_unlock_bh(&tid_rx->reorder_lock);
+	del_timer_sync(&tid_rx->reorder_timer);
+
 	call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx);
 }
 
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index a70f4ce4f652..07fb67803097 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -792,9 +792,10 @@ static void ieee80211_sta_reorder_release(struct ieee80211_sub_if_data *sdata,
 
  set_release_timer:
 
-		mod_timer(&tid_agg_rx->reorder_timer,
-			  tid_agg_rx->reorder_time[j] + 1 +
-			  HT_RX_REORDER_BUF_TIMEOUT);
+		if (!tid_agg_rx->removed)
+			mod_timer(&tid_agg_rx->reorder_timer,
+				  tid_agg_rx->reorder_time[j] + 1 +
+				  HT_RX_REORDER_BUF_TIMEOUT);
 	} else {
 		del_timer(&tid_agg_rx->reorder_timer);
 	}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 4acc5fc402fa..5a600151ba5a 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -162,6 +162,7 @@ struct tid_ampdu_tx {
  * @dialog_token: dialog token for aggregation session
  * @rcu_head: RCU head used for freeing this struct
  * @reorder_lock: serializes access to reorder buffer, see below.
+ * @removed: this session is removed (but might have been found due to RCU)
  *
  * This structure's lifetime is managed by RCU, assignments to
  * the array holding it must hold the aggregation mutex.
@@ -185,6 +186,7 @@ struct tid_ampdu_rx {
 	u16 buf_size;
 	u16 timeout;
 	u8 dialog_token;
+	bool removed;
 };
 
 /**

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

* [PATCH 3.16.y-ckt 129/144] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (127 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 128/144] mac80211: fix RX A-MPDU session reorder timer deletion Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 130/144] net: use for_each_netdev_safe() in rtnl_group_changelink() Luis Henriques
                   ` (14 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shachar Raindel, Jack Morgenstein, Or Gerlitz, Roland Dreier,
	Luis Henriques

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

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

From: Shachar Raindel <raindel@mellanox.com>

commit 8494057ab5e40df590ef6ef7d66324d3ae33356b upstream.

Properly verify that the resulting page aligned end address is larger
than both the start address and the length of the memory area requested.

Both the start and length arguments for ib_umem_get are controlled by
the user. A misbehaving user can provide values which will cause an
integer overflow when calculating the page aligned end address.

This overflow can cause also miscalculation of the number of pages
mapped, and additional logic issues.

Addresses: CVE-2014-8159
Signed-off-by: Shachar Raindel <raindel@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/core/umem.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index a3a2e9c1639b..0b2584dbeba0 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	if (dmasync)
 		dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
 
+	/*
+	 * If the combination of the addr and size requested for this memory
+	 * region causes an integer overflow, return error.
+	 */
+	if ((PAGE_ALIGN(addr + size) <= size) ||
+	    (PAGE_ALIGN(addr + size) <= addr))
+		return ERR_PTR(-EINVAL);
+
 	if (!can_do_mlock())
 		return ERR_PTR(-EPERM);
 

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

* [PATCH 3.16.y-ckt 130/144] net: use for_each_netdev_safe() in rtnl_group_changelink()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (128 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 129/144] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 131/144] net/mlx4_en: Call register_netdevice in the proper location Luis Henriques
                   ` (13 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Cong Wang, David S. Miller, Luis Henriques

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

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

From: WANG Cong <xiyou.wangcong@gmail.com>

commit d079535d5e1bf5e2e7c856bae2483414ea21e137 upstream.

In case we move the whole dev group to another netns,
we should call for_each_netdev_safe(), otherwise we get
a soft lockup:

 NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [ip:798]
 irq event stamp: 255424
 hardirqs last  enabled at (255423): [<ffffffff81a2aa95>] restore_args+0x0/0x30
 hardirqs last disabled at (255424): [<ffffffff81a2ad5a>] apic_timer_interrupt+0x6a/0x80
 softirqs last  enabled at (255422): [<ffffffff81079ebc>] __do_softirq+0x2c1/0x3a9
 softirqs last disabled at (255417): [<ffffffff8107a190>] irq_exit+0x41/0x95
 CPU: 0 PID: 798 Comm: ip Not tainted 4.0.0-rc4+ #881
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 task: ffff8800d1b88000 ti: ffff880119530000 task.ti: ffff880119530000
 RIP: 0010:[<ffffffff810cad11>]  [<ffffffff810cad11>] debug_lockdep_rcu_enabled+0x28/0x30
 RSP: 0018:ffff880119533778  EFLAGS: 00000246
 RAX: ffff8800d1b88000 RBX: 0000000000000002 RCX: 0000000000000038
 RDX: 0000000000000000 RSI: ffff8800d1b888c8 RDI: ffff8800d1b888c8
 RBP: ffff880119533778 R08: 0000000000000000 R09: 0000000000000000
 R10: 0000000000000000 R11: 000000000000b5c2 R12: 0000000000000246
 R13: ffff880119533708 R14: 00000000001d5a40 R15: ffff88011a7d5a40
 FS:  00007fc01315f740(0000) GS:ffff88011a600000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 00007f367a120988 CR3: 000000011849c000 CR4: 00000000000007f0
 Stack:
  ffff880119533798 ffffffff811ac868 ffffffff811ac831 ffffffff811ac828
  ffff8801195337c8 ffffffff811ac8c9 ffff8801195339b0 ffff8801197633e0
  0000000000000000 ffff8801195339b0 ffff8801195337d8 ffffffff811ad2d7
 Call Trace:
  [<ffffffff811ac868>] rcu_read_lock+0x37/0x6e
  [<ffffffff811ac831>] ? rcu_read_unlock+0x5f/0x5f
  [<ffffffff811ac828>] ? rcu_read_unlock+0x56/0x5f
  [<ffffffff811ac8c9>] __fget+0x2a/0x7a
  [<ffffffff811ad2d7>] fget+0x13/0x15
  [<ffffffff811be732>] proc_ns_fget+0xe/0x38
  [<ffffffff817c7714>] get_net_ns_by_fd+0x11/0x59
  [<ffffffff817df359>] rtnl_link_get_net+0x33/0x3e
  [<ffffffff817df3d7>] do_setlink+0x73/0x87b
  [<ffffffff810b28ce>] ? trace_hardirqs_off+0xd/0xf
  [<ffffffff81a2aa95>] ? retint_restore_args+0xe/0xe
  [<ffffffff817e0301>] rtnl_newlink+0x40c/0x699
  [<ffffffff817dffe0>] ? rtnl_newlink+0xeb/0x699
  [<ffffffff81a29246>] ? _raw_spin_unlock+0x28/0x33
  [<ffffffff8143ed1e>] ? security_capable+0x18/0x1a
  [<ffffffff8107da51>] ? ns_capable+0x4d/0x65
  [<ffffffff817de5ce>] rtnetlink_rcv_msg+0x181/0x194
  [<ffffffff817de407>] ? rtnl_lock+0x17/0x19
  [<ffffffff817de407>] ? rtnl_lock+0x17/0x19
  [<ffffffff817de44d>] ? __rtnl_unlock+0x17/0x17
  [<ffffffff818327c6>] netlink_rcv_skb+0x4d/0x93
  [<ffffffff817de42f>] rtnetlink_rcv+0x26/0x2d
  [<ffffffff81830f18>] netlink_unicast+0xcb/0x150
  [<ffffffff8183198e>] netlink_sendmsg+0x501/0x523
  [<ffffffff8115cba9>] ? might_fault+0x59/0xa9
  [<ffffffff817b5398>] ? copy_from_user+0x2a/0x2c
  [<ffffffff817b7b74>] sock_sendmsg+0x34/0x3c
  [<ffffffff817b7f6d>] ___sys_sendmsg+0x1b8/0x255
  [<ffffffff8115c5eb>] ? handle_pte_fault+0xbd5/0xd4a
  [<ffffffff8100a2b0>] ? native_sched_clock+0x35/0x37
  [<ffffffff8109e94b>] ? sched_clock_local+0x12/0x72
  [<ffffffff8109eb9c>] ? sched_clock_cpu+0x9e/0xb7
  [<ffffffff810cadbf>] ? rcu_read_lock_held+0x3b/0x3d
  [<ffffffff811ac1d8>] ? __fcheck_files+0x4c/0x58
  [<ffffffff811ac946>] ? __fget_light+0x2d/0x52
  [<ffffffff817b8adc>] __sys_sendmsg+0x42/0x60
  [<ffffffff817b8b0c>] SyS_sendmsg+0x12/0x1c
  [<ffffffff81a29e32>] system_call_fastpath+0x12/0x17

Fixes: e7ed828f10bd8 ("netlink: support setting devgroup parameters")
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/rtnetlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b1e79ca03fa0..0d2119ff2875 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1859,10 +1859,10 @@ static int rtnl_group_changelink(const struct sk_buff *skb,
 		struct ifinfomsg *ifm,
 		struct nlattr **tb)
 {
-	struct net_device *dev;
+	struct net_device *dev, *aux;
 	int err;
 
-	for_each_netdev(net, dev) {
+	for_each_netdev_safe(net, dev, aux) {
 		if (dev->group == group) {
 			err = do_setlink(skb, dev, ifm, tb, NULL, 0);
 			if (err < 0)

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

* [PATCH 3.16.y-ckt 131/144] net/mlx4_en: Call register_netdevice in the proper location
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (129 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 130/144] net: use for_each_netdev_safe() in rtnl_group_changelink() Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 132/144] xen-netfront: transmit fully GSO-sized packets Luis Henriques
                   ` (12 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ido Shamay, Or Gerlitz, David S. Miller, Luis Henriques

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

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

From: Ido Shamay <idos@mellanox.com>

commit e5eda89d97ec256ba14e7e861387cc0468259c18 upstream.

Netdevice registration should be performed a the end of the driver
initialization flow. If we don't do that, after calling register_netdevice,
device callbacks may be issued by higher layers of the stack before
final configuration of the device is done.

For example (VXLAN configuration race), mlx4_SET_PORT_VXLAN was issued
after the register_netdev command. System network scripts may configure
the interface (UP) right after the registration, which also attach
unicast VXLAN steering rule, before mlx4_SET_PORT_VXLAN was called,
causing the firmware to fail the rule attachment.

Fixes: 837052d0ccc5 ("net/mlx4_en: Add netdev support for TCP/IP offloads of vxlan tunneling")
Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 04b2d8e117cb..1b67e902aee6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2619,13 +2619,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 	netif_carrier_off(dev);
 	mlx4_en_set_default_moderation(priv);
 
-	err = register_netdev(dev);
-	if (err) {
-		en_err(priv, "Netdev registration failed for port %d\n", port);
-		goto out;
-	}
-	priv->registered = 1;
-
 	en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num);
 	en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);
 
@@ -2665,6 +2658,14 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 		queue_delayed_work(mdev->workqueue, &priv->service_task,
 				   SERVICE_TASK_DELAY);
 
+	err = register_netdev(dev);
+	if (err) {
+		en_err(priv, "Netdev registration failed for port %d\n", port);
+		goto out;
+	}
+
+	priv->registered = 1;
+
 	return 0;
 
 out:

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

* [PATCH 3.16.y-ckt 132/144] xen-netfront: transmit fully GSO-sized packets
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (130 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 131/144] net/mlx4_en: Call register_netdevice in the proper location Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 133/144] tcp: fix FRTO undo on cumulative ACK of SACKed range Luis Henriques
                   ` (11 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jonathan Davies, David S. Miller, Luis Henriques

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

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

From: Jonathan Davies <jonathan.davies@citrix.com>

commit 0c36820e2ab7d943ab1188230fdf2149826d33c0 upstream.

xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
bytes each. This slight reduction in the size of packets means a slight loss in
efficiency.

Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
    XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.

The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
6c09fa09d) in determining when to split an skb into two is
    sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.

So the maximum permitted size of an skb is calculated to be
    (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.

Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
Instead, there is no need to deviate from the default gso_max_size of 65536 as
this already accommodates the size of the header.

Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
skbs of up to 65160 bytes (45 segments of 1448 bytes each).

Similarly, the maximum allowable mtu does not need to subtract MAX_TCP_HEADER as
it relates to the size of the whole packet, including the header.

Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/xen-netfront.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index fc49005ddb5d..0838a2db5570 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1098,8 +1098,7 @@ err:
 
 static int xennet_change_mtu(struct net_device *dev, int mtu)
 {
-	int max = xennet_can_sg(dev) ?
-		XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER : ETH_DATA_LEN;
+	int max = xennet_can_sg(dev) ? XEN_NETIF_MAX_TX_SIZE : ETH_DATA_LEN;
 
 	if (mtu > max)
 		return -EINVAL;
@@ -1370,8 +1369,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netdev->ethtool_ops = &xennet_ethtool_ops;
 	SET_NETDEV_DEV(netdev, &dev->dev);
 
-	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
-
 	np->netdev = netdev;
 
 	netif_carrier_off(netdev);

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

* [PATCH 3.16.y-ckt 133/144] tcp: fix FRTO undo on cumulative ACK of SACKed range
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (131 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 132/144] xen-netfront: transmit fully GSO-sized packets Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 134/144] KVM: remove redundant assignments in __kvm_set_memory_region Luis Henriques
                   ` (10 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Neal Cardwell, Yuchung Cheng, David S. Miller, Luis Henriques

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

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

From: Neal Cardwell <ncardwell@google.com>

commit 666b805150efd62f05810ff0db08f44a2370c937 upstream.

On processing cumulative ACKs, the FRTO code was not checking the
SACKed bit, meaning that there could be a spurious FRTO undo on a
cumulative ACK of a previously SACKed skb.

The FRTO code should only consider a cumulative ACK to indicate that
an original/unretransmitted skb is newly ACKed if the skb was not yet
SACKed.

The effect of the spurious FRTO undo would typically be to make the
connection think that all previously-sent packets were in flight when
they really weren't, leading to a stall and an RTO.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Fixes: e33099f96d99c ("tcp: implement RFC5682 F-RTO")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_input.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a1bbebb03490..486f70050563 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3068,10 +3068,11 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 			if (!first_ackt.v64)
 				first_ackt = last_ackt;
 
-			if (!(sacked & TCPCB_SACKED_ACKED))
+			if (!(sacked & TCPCB_SACKED_ACKED)) {
 				reord = min(pkts_acked, reord);
-			if (!after(scb->end_seq, tp->high_seq))
-				flag |= FLAG_ORIG_SACK_ACKED;
+				if (!after(scb->end_seq, tp->high_seq))
+					flag |= FLAG_ORIG_SACK_ACKED;
+			}
 		}
 
 		if (sacked & TCPCB_SACKED_ACKED)

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

* [PATCH 3.16.y-ckt 134/144] KVM: remove redundant assignments in __kvm_set_memory_region
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (132 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 133/144] tcp: fix FRTO undo on cumulative ACK of SACKed range Luis Henriques
@ 2015-04-21 15:31 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 135/144] kvm: commonize allocation of the new memory slots Luis Henriques
                   ` (9 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:31 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christian Borntraeger, Paolo Bonzini, Luis Henriques

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

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

From: Christian Borntraeger <borntraeger@de.ibm.com>

commit f2a25160887e00434ce1361007009120e1fecbda upstream.

__kvm_set_memory_region sets r to EINVAL very early.
Doing it again is not necessary. The same is true later on, where
r is assigned -ENOMEM twice.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 virt/kvm/kvm_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 438851c2a797..7e76ce9254e2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -791,7 +791,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
 	base_gfn = mem->guest_phys_addr >> PAGE_SHIFT;
 	npages = mem->memory_size >> PAGE_SHIFT;
 
-	r = -EINVAL;
 	if (npages > KVM_MEM_MAX_NR_PAGES)
 		goto out;
 
@@ -805,7 +804,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
 	new.npages = npages;
 	new.flags = mem->flags;
 
-	r = -EINVAL;
 	if (npages) {
 		if (!old.npages)
 			change = KVM_MR_CREATE;
@@ -861,7 +859,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
 	}
 
 	if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) {
-		r = -ENOMEM;
 		slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
 				GFP_KERNEL);
 		if (!slots)

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

* [PATCH 3.16.y-ckt 135/144] kvm: commonize allocation of the new memory slots
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (133 preceding siblings ...)
  2015-04-21 15:31 ` [PATCH 3.16.y-ckt 134/144] KVM: remove redundant assignments in __kvm_set_memory_region Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 136/144] kvm: avoid page allocation failure in kvm_set_memory_region() Luis Henriques
                   ` (8 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Paolo Bonzini, Luis Henriques

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

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

From: Paolo Bonzini <pbonzini@redhat.com>

commit f2a81036516e2b97c07c49dd6d51d36bfa43593d upstream.

The two kmemdup invocations can be unified.  I find that the new
placement of the comment makes it easier to see what happens.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 virt/kvm/kvm_main.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 7e76ce9254e2..840b6ced58bb 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -858,11 +858,12 @@ int __kvm_set_memory_region(struct kvm *kvm,
 			goto out_free;
 	}
 
+	slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
+			GFP_KERNEL);
+	if (!slots)
+		goto out_free;
+
 	if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) {
-		slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
-				GFP_KERNEL);
-		if (!slots)
-			goto out_free;
 		slot = id_to_memslot(slots, mem->slot);
 		slot->flags |= KVM_MEMSLOT_INVALID;
 
@@ -878,6 +879,12 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		 * 	- kvm_is_visible_gfn (mmu_check_roots)
 		 */
 		kvm_arch_flush_shadow_memslot(kvm, slot);
+
+		/*
+		 * We can re-use the old_memslots from above, the only difference
+		 * from the currently installed memslots is the invalid flag.  This
+		 * will get overwritten by update_memslots anyway.
+		 */
 		slots = old_memslots;
 	}
 
@@ -885,19 +892,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
 	if (r)
 		goto out_slots;
 
-	r = -ENOMEM;
-	/*
-	 * We can re-use the old_memslots from above, the only difference
-	 * from the currently installed memslots is the invalid flag.  This
-	 * will get overwritten by update_memslots anyway.
-	 */
-	if (!slots) {
-		slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
-				GFP_KERNEL);
-		if (!slots)
-			goto out_free;
-	}
-
 	/* actual memory is freed via old in kvm_free_physmem_slot below */
 	if (change == KVM_MR_DELETE) {
 		new.dirty_bitmap = NULL;

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

* [PATCH 3.16.y-ckt 136/144] kvm: avoid page allocation failure in kvm_set_memory_region()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (134 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 135/144] kvm: commonize allocation of the new memory slots Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 137/144] hpsa: refine the pci enable/disable handling Luis Henriques
                   ` (7 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Igor Mammedov, Marcelo Tosatti, Paolo Bonzini, Luis Henriques

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

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

From: Igor Mammedov <imammedo@redhat.com>

commit 744961341d472db6272ed9b42319a90f5a2aa7c4 upstream.

KVM guest can fail to startup with following trace on host:

qemu-system-x86: page allocation failure: order:4, mode:0x40d0
Call Trace:
  dump_stack+0x47/0x67
  warn_alloc_failed+0xee/0x150
  __alloc_pages_direct_compact+0x14a/0x150
  __alloc_pages_nodemask+0x776/0xb80
  alloc_kmem_pages+0x3a/0x110
  kmalloc_order+0x13/0x50
  kmemdup+0x1b/0x40
  __kvm_set_memory_region+0x24a/0x9f0 [kvm]
  kvm_set_ioapic+0x130/0x130 [kvm]
  kvm_set_memory_region+0x21/0x40 [kvm]
  kvm_vm_ioctl+0x43f/0x750 [kvm]

Failure happens when attempting to allocate pages for
'struct kvm_memslots', however it doesn't have to be
present in physically contiguous (kmalloc-ed) address
space, change allocation to kvm_kvzalloc() so that
it will be vmalloc-ed when its size is more then a page.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 virt/kvm/kvm_main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 840b6ced58bb..27e140d5f073 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -470,7 +470,7 @@ static struct kvm *kvm_create_vm(unsigned long type)
 	BUILD_BUG_ON(KVM_MEM_SLOTS_NUM > SHRT_MAX);
 
 	r = -ENOMEM;
-	kvm->memslots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);
+	kvm->memslots = kvm_kvzalloc(sizeof(struct kvm_memslots));
 	if (!kvm->memslots)
 		goto out_err_no_srcu;
 
@@ -521,7 +521,7 @@ out_err_no_srcu:
 out_err_no_disable:
 	for (i = 0; i < KVM_NR_BUSES; i++)
 		kfree(kvm->buses[i]);
-	kfree(kvm->memslots);
+	kvfree(kvm->memslots);
 	kvm_arch_free_vm(kvm);
 	return ERR_PTR(r);
 }
@@ -577,7 +577,7 @@ static void kvm_free_physmem(struct kvm *kvm)
 	kvm_for_each_memslot(memslot, slots)
 		kvm_free_physmem_slot(kvm, memslot, NULL);
 
-	kfree(kvm->memslots);
+	kvfree(kvm->memslots);
 }
 
 static void kvm_destroy_devices(struct kvm *kvm)
@@ -858,10 +858,10 @@ int __kvm_set_memory_region(struct kvm *kvm,
 			goto out_free;
 	}
 
-	slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
-			GFP_KERNEL);
+	slots = kvm_kvzalloc(sizeof(struct kvm_memslots));
 	if (!slots)
 		goto out_free;
+	memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots));
 
 	if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) {
 		slot = id_to_memslot(slots, mem->slot);
@@ -903,7 +903,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 	kvm_arch_commit_memory_region(kvm, mem, &old, change);
 
 	kvm_free_physmem_slot(kvm, &old, &new);
-	kfree(old_memslots);
+	kvfree(old_memslots);
 
 	/*
 	 * IOMMU mapping:  New slots need to be mapped.  Old slots need to be
@@ -922,7 +922,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 	return 0;
 
 out_slots:
-	kfree(slots);
+	kvfree(slots);
 out_free:
 	kvm_free_physmem_slot(kvm, &new, &old);
 out:

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

* [PATCH 3.16.y-ckt 137/144] hpsa: refine the pci enable/disable handling
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (135 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 136/144] kvm: avoid page allocation failure in kvm_set_memory_region() Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 138/144] hpsa: add missing pci_set_master in kdump path Luis Henriques
                   ` (6 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tomas Henzl, Christoph Hellwig, Masoud Sharbiani, Vinson Lee,
	Luis Henriques

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

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

From: Tomas Henzl <thenzl@redhat.com>

commit 132aa220b45d60e9b20def1e9d8be9422eed9616 upstream.

When a second(kdump) kernel starts and the hard reset method is used
the driver calls pci_disable_device without previously enabling it,
so the kernel shows a warning -
[   16.876248] WARNING: at drivers/pci/pci.c:1431 pci_disable_device+0x84/0x90()
[   16.882686] Device hpsa
disabling already-disabled device
...
This patch fixes it, in addition to this I tried to balance also some other pairs
of enable/disable device in the driver.
Unfortunately I wasn't able to verify the functionality for the case of a sw reset,
because of a lack of proper hw.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Masoud Sharbiani <msharbiani@twopensource.com>
Cc: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/hpsa.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 489e83b6b5e1..67a8dfd9b3f5 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5972,10 +5972,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 
 	/* Save the PCI command register */
 	pci_read_config_word(pdev, 4, &command_register);
-	/* Turn the board off.  This is so that later pci_restore_state()
-	 * won't turn the board on before the rest of config space is ready.
-	 */
-	pci_disable_device(pdev);
 	pci_save_state(pdev);
 
 	/* find the first memory BAR, so we can find the cfg table */
@@ -6023,11 +6019,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 		goto unmap_cfgtable;
 
 	pci_restore_state(pdev);
-	rc = pci_enable_device(pdev);
-	if (rc) {
-		dev_warn(&pdev->dev, "failed to enable device.\n");
-		goto unmap_cfgtable;
-	}
 	pci_write_config_word(pdev, 4, command_register);
 
 	/* Some devices (notably the HP Smart Array 5i Controller)
@@ -6542,6 +6533,23 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
 	if (!reset_devices)
 		return 0;
 
+	/* kdump kernel is loading, we don't know in which state is
+	 * the pci interface. The dev->enable_cnt is equal zero
+	 * so we call enable+disable, wait a while and switch it on.
+	 */
+	rc = pci_enable_device(pdev);
+	if (rc) {
+		dev_warn(&pdev->dev, "Failed to enable PCI device\n");
+		return -ENODEV;
+	}
+	pci_disable_device(pdev);
+	msleep(260);			/* a randomly chosen number */
+	rc = pci_enable_device(pdev);
+	if (rc) {
+		dev_warn(&pdev->dev, "failed to enable device.\n");
+		return -ENODEV;
+	}
+
 	/* Reset the controller with a PCI power-cycle or via doorbell */
 	rc = hpsa_kdump_hard_reset_controller(pdev);
 
@@ -6550,10 +6558,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
 	 * "performant mode".  Or, it might be 640x, which can't reset
 	 * due to concerns about shared bbwc between 6402/6404 pair.
 	 */
-	if (rc == -ENOTSUPP)
-		return rc; /* just try to do the kdump anyhow. */
-	if (rc)
-		return -ENODEV;
+	if (rc) {
+		if (rc != -ENOTSUPP) /* just try to do the kdump anyhow. */
+			rc = -ENODEV;
+		goto out_disable;
+	}
 
 	/* Now try to get the controller to respond to a no-op */
 	dev_warn(&pdev->dev, "Waiting for controller to respond to no-op\n");
@@ -6564,7 +6573,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
 			dev_warn(&pdev->dev, "no-op failed%s\n",
 					(i < 11 ? "; re-trying" : ""));
 	}
-	return 0;
+
+out_disable:
+
+	pci_disable_device(pdev);
+	return rc;
 }
 
 static int hpsa_allocate_cmd_pool(struct ctlr_info *h)
@@ -6744,6 +6757,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
 		iounmap(h->transtable);
 	if (h->cfgtable)
 		iounmap(h->cfgtable);
+	pci_disable_device(h->pdev);
 	pci_release_regions(h->pdev);
 	kfree(h);
 }

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

* [PATCH 3.16.y-ckt 138/144] hpsa: add missing pci_set_master in kdump path
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (136 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 137/144] hpsa: refine the pci enable/disable handling Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 139/144] hpsa: fix memory leak in kdump hard reset Luis Henriques
                   ` (5 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tomas Henzl, Christoph Hellwig, Masoud Sharbiani, Vinson Lee,
	Luis Henriques

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

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

From: Tomas Henzl <thenzl@redhat.com>

commit 859c75aba20264d87dd026bab0d0ca3bff385955 upstream.

Add a call to pci_set_master(...)  missing in the previous
patch "hpsa: refine the pci enable/disable handling".
Found thanks to Rob Elliot.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Robert Elliott <elliott@hp.com>
Tested-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Masoud Sharbiani <msharbiani@twopensource.com>
Cc: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/hpsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 67a8dfd9b3f5..28533dbd3407 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6549,7 +6549,7 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
 		dev_warn(&pdev->dev, "failed to enable device.\n");
 		return -ENODEV;
 	}
-
+	pci_set_master(pdev);
 	/* Reset the controller with a PCI power-cycle or via doorbell */
 	rc = hpsa_kdump_hard_reset_controller(pdev);
 

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

* [PATCH 3.16.y-ckt 139/144] hpsa: fix memory leak in kdump hard reset
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (137 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 138/144] hpsa: add missing pci_set_master in kdump path Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 140/144] hpsa: turn off interrupts when kdump starts Luis Henriques
                   ` (4 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tomas Henzl, Don Brace, Christoph Hellwig, Masoud Sharbiani,
	Vinson Lee, Luis Henriques

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

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

From: Tomas Henzl <thenzl@redhat.com>

commit 03741d956eaac31264952e0afa181b62713892a5 upstream.

There is a potential memory leak in hpsa_kdump_hard_reset_controller.

Reviewed-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Masoud Sharbiani <msharbiani@twopensource.com>
Cc: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/hpsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 28533dbd3407..35996a829046 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5995,7 +5995,7 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 	}
 	rc = write_driver_ver_to_cfgtable(cfgtable);
 	if (rc)
-		goto unmap_vaddr;
+		goto unmap_cfgtable;
 
 	/* If reset via doorbell register is supported, use that.
 	 * There are two such methods.  Favor the newest method.

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

* [PATCH 3.16.y-ckt 140/144] hpsa: turn off interrupts when kdump starts
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (138 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 139/144] hpsa: fix memory leak in kdump hard reset Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 141/144] sb_edac: Fix erroneous bytes->gigabytes conversion Luis Henriques
                   ` (3 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Don Brace, Christoph Hellwig, Masoud Sharbiani, Vinson Lee,
	Luis Henriques

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

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

From: Tomas Henzl <thenzl@redhat.com>

commit 3b747298786355c6934b0892fc9ae4ca44105192 upstream.

Sometimes when the card is restarted it may cause -
"irq 16: nobody cared (try booting with the "irqpoll" option)"
that is likely caused so, that the card, after the hard reset
finishes, pulls on the irq. Disabling the ints before or after
the hpsa_kdump_hard_reset_controller fixes it.

At this point we can't know in which state the card is,
so using SA5_INTR_OFF + SA5_REPLY_INTR_MASK_OFFSET defines directly,
instead of the function the drivers provides, seems to be apropriate.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Masoud Sharbiani <msharbiani@twopensource.com>
Cc: Vinson Lee <vlee@twopensource.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/hpsa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 35996a829046..436ccec10305 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6529,6 +6529,7 @@ static void hpsa_hba_inquiry(struct ctlr_info *h)
 static int hpsa_init_reset_devices(struct pci_dev *pdev)
 {
 	int rc, i;
+	void __iomem *vaddr;
 
 	if (!reset_devices)
 		return 0;
@@ -6550,6 +6551,15 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
 		return -ENODEV;
 	}
 	pci_set_master(pdev);
+
+	vaddr = pci_ioremap_bar(pdev, 0);
+	if (vaddr == NULL) {
+		rc = -ENOMEM;
+		goto out_disable;
+	}
+	writel(SA5_INTR_OFF, vaddr + SA5_REPLY_INTR_MASK_OFFSET);
+	iounmap(vaddr);
+
 	/* Reset the controller with a PCI power-cycle or via doorbell */
 	rc = hpsa_kdump_hard_reset_controller(pdev);
 

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

* [PATCH 3.16.y-ckt 141/144] sb_edac: Fix erroneous bytes->gigabytes conversion
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (139 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 140/144] hpsa: turn off interrupts when kdump starts Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 142/144] sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel Luis Henriques
                   ` (2 subsequent siblings)
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jim Snow, Lukasz Anaczkowski, Mauro Carvalho Chehab, Vinson Lee,
	Luis Henriques

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

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

From: Jim Snow <jim.m.snow@intel.com>

commit 8c009100295597f23978c224aec5751a365bc965 upstream.

Signed-off-by: Jim Snow <jim.snow@intel.com>
Signed-off-by: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Vinson Lee <vlee@twopensource.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/edac/sb_edac.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index deea0dc9999b..aa174f3a9e45 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -764,7 +764,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 	u32 reg;
 	u64 limit, prv = 0;
 	u64 tmp_mb;
-	u32 mb, kb;
+	u32 gb, mb;
 	u32 rir_way;
 
 	/*
@@ -774,15 +774,17 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 	pvt->tolm = pvt->info.get_tolm(pvt);
 	tmp_mb = (1 + pvt->tolm) >> 20;
 
-	mb = div_u64_rem(tmp_mb, 1000, &kb);
-	edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm);
+	gb = div_u64_rem(tmp_mb, 1024, &mb);
+	edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n",
+		gb, (mb*1000)/1024, (u64)pvt->tolm);
 
 	/* Address range is already 45:25 */
 	pvt->tohm = pvt->info.get_tohm(pvt);
 	tmp_mb = (1 + pvt->tohm) >> 20;
 
-	mb = div_u64_rem(tmp_mb, 1000, &kb);
-	edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tohm);
+	gb = div_u64_rem(tmp_mb, 1024, &mb);
+	edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n",
+		gb, (mb*1000)/1024, (u64)pvt->tohm);
 
 	/*
 	 * Step 2) Get SAD range and SAD Interleave list
@@ -804,11 +806,11 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 			break;
 
 		tmp_mb = (limit + 1) >> 20;
-		mb = div_u64_rem(tmp_mb, 1000, &kb);
+		gb = div_u64_rem(tmp_mb, 1024, &mb);
 		edac_dbg(0, "SAD#%d %s up to %u.%03u GB (0x%016Lx) Interleave: %s reg=0x%08x\n",
 			 n_sads,
 			 get_dram_attr(reg),
-			 mb, kb,
+			 gb, (mb*1000)/1024,
 			 ((u64)tmp_mb) << 20L,
 			 INTERLEAVE_MODE(reg) ? "8:6" : "[8:6]XOR[18:16]",
 			 reg);
@@ -839,9 +841,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 			break;
 		tmp_mb = (limit + 1) >> 20;
 
-		mb = div_u64_rem(tmp_mb, 1000, &kb);
+		gb = div_u64_rem(tmp_mb, 1024, &mb);
 		edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n",
-			 n_tads, mb, kb,
+			 n_tads, gb, (mb*1000)/1024,
 			 ((u64)tmp_mb) << 20L,
 			 (u32)TAD_SOCK(reg),
 			 (u32)TAD_CH(reg),
@@ -864,10 +866,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 					      tad_ch_nilv_offset[j],
 					      &reg);
 			tmp_mb = TAD_OFFSET(reg) >> 20;
-			mb = div_u64_rem(tmp_mb, 1000, &kb);
+			gb = div_u64_rem(tmp_mb, 1024, &mb);
 			edac_dbg(0, "TAD CH#%d, offset #%d: %u.%03u GB (0x%016Lx), reg=0x%08x\n",
 				 i, j,
-				 mb, kb,
+				 gb, (mb*1000)/1024,
 				 ((u64)tmp_mb) << 20L,
 				 reg);
 		}
@@ -889,10 +891,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 
 			tmp_mb = RIR_LIMIT(reg) >> 20;
 			rir_way = 1 << RIR_WAY(reg);
-			mb = div_u64_rem(tmp_mb, 1000, &kb);
+			gb = div_u64_rem(tmp_mb, 1024, &mb);
 			edac_dbg(0, "CH#%d RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d, reg=0x%08x\n",
 				 i, j,
-				 mb, kb,
+				 gb, (mb*1000)/1024,
 				 ((u64)tmp_mb) << 20L,
 				 rir_way,
 				 reg);
@@ -903,10 +905,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 						      &reg);
 				tmp_mb = RIR_OFFSET(reg) << 6;
 
-				mb = div_u64_rem(tmp_mb, 1000, &kb);
+				gb = div_u64_rem(tmp_mb, 1024, &mb);
 				edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n",
 					 i, j, k,
-					 mb, kb,
+					 gb, (mb*1000)/1024,
 					 ((u64)tmp_mb) << 20L,
 					 (u32)RIR_RNK_TGT(reg),
 					 reg);
@@ -944,7 +946,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
 	u8			ch_way, sck_way, pkg, sad_ha = 0;
 	u32			tad_offset;
 	u32			rir_way;
-	u32			mb, kb;
+	u32			mb, gb;
 	u64			ch_addr, offset, limit = 0, prv = 0;
 
 
@@ -1182,10 +1184,10 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
 			continue;
 
 		limit = RIR_LIMIT(reg);
-		mb = div_u64_rem(limit >> 20, 1000, &kb);
+		gb = div_u64_rem(limit >> 20, 1024, &mb);
 		edac_dbg(0, "RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d\n",
 			 n_rir,
-			 mb, kb,
+			 gb, (mb*1000)/1024,
 			 limit,
 			 1 << RIR_WAY(reg));
 		if  (ch_addr <= limit)

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

* [PATCH 3.16.y-ckt 142/144] sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (140 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 141/144] sb_edac: Fix erroneous bytes->gigabytes conversion Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 143/144] NFS: fix BUG() crash in notify_change() with patch to chown_common() Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 144/144] tcp: Fix crash in TCP Fast Open Luis Henriques
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Seth Jennings, Mauro Carvalho Chehab, Vinson Lee, Luis Henriques

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

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

From: Seth Jennings <sjenning@redhat.com>

commit 351fc4a99d49fde63fe5ab7412beb35c40d27269 upstream.

Intel IA32 SDM Table 15-14 defines channel 0xf as 'not specified', but
EDAC doesn't know about this and returns and INTERNAL ERROR when the
channel is greater than NUM_CHANNELS:

kernel: [ 1538.886456] CPU 0: Machine Check Exception: 0 Bank 1: 940000000000009f
kernel: [ 1538.886669] TSC 2bc68b22e7e812 ADDR 46dae7000 MISC 0 PROCESSOR 0:306e4 TIME 1390414572 SOCKET 0 APIC 0
kernel: [ 1538.971948] EDAC MC1: INTERNAL ERROR: channel value is out of range (15 >= 4)
kernel: [ 1538.972203] EDAC MC1: 0 CE memory read error on unknown memory (slot:0 page:0x46dae7 offset:0x0 grain:0 syndrome:0x0 -  area:DRAM err_code:0000:009f socket:1 channel_mask:1 rank:0)

This commit changes sb_edac to forward a channel of -1 to EDAC if the
channel is not specified.  edac_mc_handle_error() sets the channel to -1
internally after the error message anyway, so this commit should have no
effect other than avoiding the INTERNAL ERROR message when the channel
is not specified.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/edac/sb_edac.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index aa174f3a9e45..ff75f8904735 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -285,8 +285,9 @@ static const u32 correrrthrsld[] = {
  * sbridge structs
  */
 
-#define NUM_CHANNELS	4
-#define MAX_DIMMS	3		/* Max DIMMS per channel */
+#define NUM_CHANNELS		4
+#define MAX_DIMMS		3	/* Max DIMMS per channel */
+#define CHANNEL_UNSPECIFIED	0xf	/* Intel IA32 SDM 15-14 */
 
 enum type {
 	SANDY_BRIDGE,
@@ -1752,6 +1753,9 @@ static void sbridge_mce_output_error(struct mem_ctl_info *mci,
 
 	/* FIXME: need support for channel mask */
 
+	if (channel == CHANNEL_UNSPECIFIED)
+		channel = -1;
+
 	/* Call the helper to output message */
 	edac_mc_handle_error(tp_event, mci, core_err_cnt,
 			     m->addr >> PAGE_SHIFT, m->addr & ~PAGE_MASK, 0,

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

* [PATCH 3.16.y-ckt 143/144] NFS: fix BUG() crash in notify_change() with patch to chown_common()
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (141 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 142/144] sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 144/144] tcp: Fix crash in TCP Fast Open Luis Henriques
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrew Elble, Al Viro, J. Bruce Fields, Luis Henriques

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

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

From: Andrew Elble <aweits@rit.edu>

commit c1b8940b42bb6487b10f2267a96b486276ce9ff7 upstream.

We have observed a BUG() crash in fs/attr.c:notify_change(). The crash
occurs during an rsync into a filesystem that is exported via NFS.

1.) fs/attr.c:notify_change() modifies the caller's version of attr.
2.) 6de0ec00ba8d ("VFS: make notify_change pass ATTR_KILL_S*ID to
    setattr operations") introduced a BUG() restriction such that "no
    function will ever call notify_change() with both ATTR_MODE and
    ATTR_KILL_S*ID set". Under some circumstances though, it will have
    assisted in setting the caller's version of attr to this very
    combination.
3.) 27ac0ffeac80 ("locks: break delegations on any attribute
    modification") introduced code to handle breaking
    delegations. This can result in notify_change() being re-called. attr
    _must_ be explicitly reset to avoid triggering the BUG() established
    in #2.
4.) The path that that triggers this is via fs/open.c:chmod_common().
    The combination of attr flags set here and in the first call to
    notify_change() along with a later failed break_deleg_wait()
    results in notify_change() being called again via retry_deleg
    without resetting attr.

Solution is to move retry_deleg in chmod_common() a bit further up to
ensure attr is completely reset.

There are other places where this seemingly could occur, such as
fs/utimes.c:utimes_common(), but the attr flags are not initially
set in such a way to trigger this.

Fixes: 27ac0ffeac80 ("locks: break delegations on any attribute modification")
Reported-by: Eric Meddaugh <etmsys@rit.edu>
Tested-by: Eric Meddaugh <etmsys@rit.edu>
Signed-off-by: Andrew Elble <aweits@rit.edu>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/open.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/open.c b/fs/open.c
index d6fd3acde134..50f5144f31ab 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -558,6 +558,7 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
 	uid = make_kuid(current_user_ns(), user);
 	gid = make_kgid(current_user_ns(), group);
 
+retry_deleg:
 	newattrs.ia_valid =  ATTR_CTIME;
 	if (user != (uid_t) -1) {
 		if (!uid_valid(uid))
@@ -574,7 +575,6 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
 	if (!S_ISDIR(inode->i_mode))
 		newattrs.ia_valid |=
 			ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
-retry_deleg:
 	mutex_lock(&inode->i_mutex);
 	error = security_path_chown(path, uid, gid);
 	if (!error)

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

* [PATCH 3.16.y-ckt 144/144] tcp: Fix crash in TCP Fast Open
  2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
                   ` (142 preceding siblings ...)
  2015-04-21 15:32 ` [PATCH 3.16.y-ckt 143/144] NFS: fix BUG() crash in notify_change() with patch to chown_common() Luis Henriques
@ 2015-04-21 15:32 ` Luis Henriques
  143 siblings, 0 replies; 145+ messages in thread
From: Luis Henriques @ 2015-04-21 15:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ben Hutchings, Luis Henriques

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

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

From: Ben Hutchings <ben@decadent.org.uk>

Commit 355a901e6cf1 ("tcp: make connect() mem charging friendly")
changed tcp_send_syn_data() to perform an open-coded copy of the 'syn'
skb rather than using skb_copy_expand().

The open-coded copy does not cover the skb_shared_info::gso_segs
field, so in the new skb it is left set to 0.  When this commit was
backported into stable branches between 3.10.y and 3.16.7-ckty
inclusive, it triggered the BUG() in tcp_transmit_skb().

Since Linux 3.18 the GSO segment count is kept in the
tcp_skb_cb::tcp_gso_segs field and tcp_send_syn_data() does copy the
tcp_skb_cb structure to the new skb, so mainline and newer stable
branches are not affected.

Set skb_shared_info::gso_segs to the correct value of 1.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_output.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index d5457e40f5be..1ea0a07ab0b5 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2992,6 +2992,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
 		goto fallback;
 	syn_data->ip_summed = CHECKSUM_PARTIAL;
 	memcpy(syn_data->cb, syn->cb, sizeof(syn->cb));
+	skb_shinfo(syn_data)->gso_segs = 1;
 	if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space),
 					 fo->data->msg_iov, 0, space))) {
 		kfree_skb(syn_data);

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

end of thread, other threads:[~2015-04-21 16:32 UTC | newest]

Thread overview: 145+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-21 15:29 [3.16.y-ckt stable] Linux 3.16.7-ckt10 stable review Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 001/144] fuse: notify: don't move pages Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 002/144] fuse: set stolen page uptodate Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 003/144] dm thin: fix to consistently zero-fill reads to unprovisioned blocks Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 004/144] dm: hold suspend_lock while suspending device during device deletion Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 005/144] dm snapshot: suspend origin when doing exception handover Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 006/144] dm snapshot: suspend merging snapshot " Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 007/144] dm io: deal with wandering queue limits when handling REQ_DISCARD and REQ_WRITE_SAME Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 008/144] crypto: arm/aes update NEON AES module to latest OpenSSL version Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 009/144] mac80211: drop unencrypted frames in mesh fwding Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 010/144] mac80211: disable u-APSD queues by default Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 011/144] ASoC: ak4671: Fix control-less DAPM routes Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 012/144] ASoC: da732x: " Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 013/144] ASoC: sn95031: " Luis Henriques
2015-04-21 15:29 ` [PATCH 3.16.y-ckt 014/144] virtio_console: init work unconditionally Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 015/144] virtio_console: avoid config access from irq Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 016/144] clocksource: efm32: Fix a NULL pointer dereference Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 017/144] clockevents: sun5i: Fix setup_irq init sequence Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 018/144] x86/vdso: Fix the build on GCC5 Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 019/144] ASoC: sgtl5000: remove useless register write clearing CHRGPUMP_POWERUP Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 020/144] regmap: regcache-rbtree: Fix present bitmap resize Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 021/144] regulator: Only enable disabled regulators on resume Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 022/144] regulator: core: Fix enable GPIO reference counting Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 023/144] Input: psmouse - add psmouse_matches_pnp_id helper function Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 024/144] Input: synaptics - split synaptics_resolution(), query first Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 025/144] Input: synaptics - log queried and quirked dimension values Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 026/144] Input: synaptics - query min dimensions for fw v8.1 Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 027/144] Input: synaptics - remove obsolete min/max quirk for X240 Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 028/144] Input: synaptics - support min/max board id in min_max_pnpid_table Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 029/144] Input: synaptics - skip quirks when post-2013 dimensions Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 030/144] Input: synaptics - fix middle button on Lenovo 2015 products Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 031/144] Input: synaptics - handle spurious release of trackstick buttons Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 032/144] Input: synaptics - do not retrieve the board id on old firmwares Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 033/144] vt6655: RFbSetPower fix missing rate RATE_12M Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 034/144] x86/asm/entry/32: Fix user_mode() misuses Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 035/144] ASoC: adav80x: Fix wrong value references for boolean kctl Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 036/144] ASoC: ak4641: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 037/144] ASoC: cs4271: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 038/144] ASoC: pcm1681: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 039/144] ASoC: tas5086: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 040/144] ASoC: wm2000: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 041/144] ASoC: wm8731: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 042/144] ASoC: wm8903: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 043/144] ASoC: wm8904: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 044/144] ASoC: wm8955: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 045/144] ASoC: wm8960: " Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 046/144] usb: phy: am335x-control: check return value of bus_find_device Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 047/144] crypto: aesni - fix memory usage in GCM decryption Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 048/144] phy: Find the right match in devm_phy_destroy() Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 049/144] x86/fpu: Avoid math_state_restore() without used_math() in __restore_xstate_sig() Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 050/144] x86/fpu: Drop_fpu() should not assume that tsk equals current Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 051/144] cpuidle: mvebu: Fix the CPU PM notifier usage Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 052/144] can: kvaser_usb: Fix tx queue start/stop race conditions Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 053/144] usb: chipidea: otg: add a_alt_hnp_support response for B device Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 054/144] mac80211: count interfaces correctly for combination checks Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 055/144] nl80211: ignore HT/VHT capabilities without QoS/WMM Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 056/144] ALSA: hda - Treat stereo-to-mono mix properly Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 057/144] pagemap: do not leak physical addresses to non-privileged userspace Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 058/144] uas: Add US_FL_NO_ATA_1X for Initio Corporation controllers / devices Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 059/144] usb: common: otg-fsm: only signal connect after switching to peripheral Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 060/144] of/irq: Fix of_irq_parse_one() returned error codes Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 061/144] iscsi-target: Avoid early conn_logout_comp for iser connections Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 062/144] tcm_qla2xxx: Fix incorrect use of __transport_register_session Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 063/144] target: Fix reference leak in target_get_sess_cmd() error path Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 064/144] tcm_fc: missing curly braces in ft_invl_hw_context() Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 065/144] target/pscsi: Fix NULL pointer dereference in get_device_type Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 066/144] target: Fix virtual LUN=0 target_configure_device failure OOPs Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 067/144] arm64: Honor __GFP_ZERO in dma allocations Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 068/144] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 069/144] dmaengine: dw: append MODULE_ALIAS for platform driver Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 070/144] xfrm: release dst_orig in case of error in xfrm_lookup() Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 071/144] staging: vt6656: vnt_rf_setpower: fix missing rate RATE_12M Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 072/144] Btrfs: make xattr replace operations atomic Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 073/144] x86/microcode/intel: Guard against stack overflow in the loader Luis Henriques
2015-04-21 15:30 ` [PATCH 3.16.y-ckt 074/144] powerpc/smp: Wait until secondaries are active & online Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 075/144] powerpc/iommu: Remove IOMMU device references via bus notifier Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 076/144] powerpc/mpc85xx: Add ranges to etsec2 nodes Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 077/144] IB/core: Avoid leakage from kernel to user space Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 078/144] timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 079/144] ALSA: hda - Add one more node in the EAPD supporting candidate list Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 080/144] serial: 8250_dw: Fix deadlock in LCR workaround Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 081/144] drm/i915/bdw: PCI IDs ending in 0xb are ULT Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 082/144] btrfs: simplify insert_orphan_item Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 083/144] ARM: sunxi: Have ARCH_SUNXI select RESET_CONTROLLER for clock driver usage Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 084/144] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 085/144] nbd: fix possible memory leak Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 086/144] spi: qup: Fix cs-num DT property parsing Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 087/144] mfd: kempld-core: Fix callback return value check Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 088/144] KVM: nVMX: mask unrestricted_guest if disabled on L0 Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 089/144] spi: trigger trace event for message-done before mesg->complete Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 090/144] regmap: introduce regmap_name to fix syscon regmap trace events Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 091/144] powerpc/pseries: Little endian fixes for post mobility device tree update Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 092/144] Fix bug in blk_rq_merge_ok Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 093/144] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 094/144] powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 095/144] perf: Fix irq_work 'tail' recursion Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 096/144] sched: Fix RLIMIT_RTTIME when PI-boosting to RT Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 097/144] ALSA: hda - Add dock support for Thinkpad T450s (17aa:5036) Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 098/144] arm64: Use the reserved TTBR0 if context switching to the init_mm Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 099/144] selinux: fix sel_write_enforce broken return value Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 100/144] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 101/144] mm/memory hotplug: postpone the reset of obsolete pgdat Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 102/144] hfsplus: fix B-tree corruption after insertion at position 0 Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 103/144] ARC: SA_SIGINFO ucontext regs off-by-one Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 104/144] writeback: fix possible underflow in write bandwidth calculation Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 105/144] ipv6: Don't reduce hop limit for an interface Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 106/144] iio: fix drivers that check buffer->scan_mask Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 107/144] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 108/144] iio: core: Fix double free Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 109/144] USB: ftdi_sio: Added custom PID for Synapse Wireless product Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 110/144] iwlwifi: dvm: run INIT firmware again upon .start() Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 111/144] USB: serial: keyspan_pda: fix Entrega company name spelling Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 112/144] USB: keyspan_pda: add new device id Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 113/144] cifs: smb2_clone_range() - exit on unhandled error Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 114/144] cifs: fix use-after-free bug in find_writable_file Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 115/144] can: flexcan: Deferred on Regulator return EPROBE_DEFER Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 116/144] xen/balloon: before adding hotplugged memory, set frames to invalid Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 117/144] usb: xhci: handle Config Error Change (CEC) in xhci driver Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 118/144] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 119/144] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 120/144] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 121/144] drm/radeon/dpm: fix 120hz handling harder Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 122/144] radeon: Do not directly dereference pointers to BIOS area Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 123/144] iio: adc: vf610: use ADC clock within specification Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 124/144] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 125/144] dmaengine: edma: fix memory leak when terminating running transfers Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 126/144] dmaengine: omap-dma: Fix memory leak when terminating running transfer Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 127/144] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 128/144] mac80211: fix RX A-MPDU session reorder timer deletion Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 129/144] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 130/144] net: use for_each_netdev_safe() in rtnl_group_changelink() Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 131/144] net/mlx4_en: Call register_netdevice in the proper location Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 132/144] xen-netfront: transmit fully GSO-sized packets Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 133/144] tcp: fix FRTO undo on cumulative ACK of SACKed range Luis Henriques
2015-04-21 15:31 ` [PATCH 3.16.y-ckt 134/144] KVM: remove redundant assignments in __kvm_set_memory_region Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 135/144] kvm: commonize allocation of the new memory slots Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 136/144] kvm: avoid page allocation failure in kvm_set_memory_region() Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 137/144] hpsa: refine the pci enable/disable handling Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 138/144] hpsa: add missing pci_set_master in kdump path Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 139/144] hpsa: fix memory leak in kdump hard reset Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 140/144] hpsa: turn off interrupts when kdump starts Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 141/144] sb_edac: Fix erroneous bytes->gigabytes conversion Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 142/144] sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 143/144] NFS: fix BUG() crash in notify_change() with patch to chown_common() Luis Henriques
2015-04-21 15:32 ` [PATCH 3.16.y-ckt 144/144] tcp: Fix crash in TCP Fast Open Luis Henriques

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).