All of lore.kernel.org
 help / color / mirror / Atom feed
* [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review
@ 2015-05-07  9:43 Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 001/180] n_tty: Fix read buffer overwrite when no newline Luis Henriques
                   ` (179 more replies)
  0 siblings, 180 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 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-ckt11 stable kernel.

This version contains 180 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/ubuntu/linux.git/log/?h=linux-3.16.y-review

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

The review period for version 3.16.7-ckt11 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

--
 arch/arm/boot/dts/dove.dtsi                        |   4 +-
 arch/arm/include/asm/elf.h                         |   2 +-
 arch/arm/kernel/hibernate.c                        |   8 +-
 arch/arm/kernel/process.c                          |  10 +-
 arch/arm/kernel/reboot.h                           |   6 +
 arch/arm/mach-s3c64xx/crag6410.h                   |   1 +
 arch/arm/mach-s3c64xx/mach-crag6410.c              |   1 +
 arch/arm/mach-shmobile/pm-r8a7790.c                |   2 +-
 arch/arm64/kernel/head.S                           |   1 +
 arch/arm64/kernel/vdso/Makefile                    |   2 +-
 arch/c6x/kernel/time.c                             |   2 +-
 arch/mips/include/asm/asm-eva.h                    | 137 ++++++++++++++-------
 arch/mips/include/asm/kvm_host.h                   |   2 +
 arch/mips/include/asm/suspend.h                    |   7 --
 arch/mips/kvm/kvm_mips.c                           |   4 +
 arch/mips/kvm/kvm_mips_emul.c                      |   1 +
 arch/mips/kvm/kvm_trap_emul.c                      |  28 +++++
 arch/mips/loongson/loongson-3/irq.c                |   1 +
 arch/mips/mti-malta/malta-memory.c                 |   6 +
 arch/mips/power/cpu.c                              |   2 +-
 arch/mips/power/hibernate.S                        |   3 +-
 arch/powerpc/kernel/cacheinfo.c                    |  44 +++++--
 arch/powerpc/kernel/suspend.c                      |   4 +-
 arch/powerpc/perf/callchain.c                      |   2 +-
 arch/powerpc/platforms/cell/iommu.c                |   2 +-
 arch/s390/kernel/suspend.c                         |  10 +-
 arch/s390/kvm/interrupt.c                          |   4 +-
 arch/s390/kvm/kvm-s390.h                           |   4 +-
 arch/s390/kvm/priv.c                               |  42 ++++---
 arch/sh/include/asm/sections.h                     |   1 -
 arch/sparc/power/hibernate.c                       |   4 +-
 arch/unicore32/include/mach/pm.h                   |   3 -
 arch/unicore32/kernel/hibernate.c                  |   1 +
 arch/x86/include/asm/mwait.h                       |   8 ++
 arch/x86/include/asm/pvclock.h                     |   1 +
 arch/x86/kernel/process.c                          |  50 ++++++++
 arch/x86/kernel/pvclock.c                          |  44 +++++++
 arch/x86/kvm/lapic.c                               |  18 ++-
 arch/x86/kvm/x86.c                                 |  10 +-
 arch/x86/power/hibernate_32.c                      |   4 +-
 arch/x86/power/hibernate_64.c                      |   4 +-
 arch/x86/vdso/vclock_gettime.c                     |  34 ++---
 arch/xtensa/Kconfig                                |  30 +++++
 arch/xtensa/include/uapi/asm/unistd.h              |   2 +-
 arch/xtensa/platforms/iss/network.c                |  29 ++---
 arch/xtensa/platforms/xtfpga/Makefile              |   3 +-
 .../platforms/xtfpga/include/platform/hardware.h   |   3 -
 .../xtensa/platforms/xtfpga/include/platform/lcd.h |  15 +++
 arch/xtensa/platforms/xtfpga/lcd.c                 |  55 +++++----
 drivers/acpi/acpica/tbinstal.c                     |   1 -
 drivers/acpi/processor_idle.c                      |   2 +-
 drivers/acpi/scan.c                                |   6 +-
 drivers/base/bus.c                                 |   4 +-
 drivers/bluetooth/ath3k.c                          |   1 +
 drivers/bluetooth/btusb.c                          |   1 +
 drivers/clk/at91/clk-usb.c                         |  29 ++---
 drivers/clk/qcom/clk-rcg2.c                        |   2 +-
 drivers/clk/tegra/clk.c                            |   2 +-
 drivers/cpufreq/cpufreq.c                          |  25 ++--
 drivers/cpuidle/cpuidle.c                          |   3 -
 drivers/cpuidle/sysfs.c                            |   5 +-
 drivers/crypto/omap-aes.c                          |  14 ++-
 drivers/gpio/gpio-mvebu.c                          |  24 ++--
 drivers/gpu/drm/i915/i915_drv.c                    |  18 +--
 drivers/gpu/drm/i915/i915_drv.h                    |   1 +
 drivers/gpu/drm/i915/i915_irq.c                    |   8 +-
 drivers/gpu/drm/i915/i915_reg.h                    |   1 +
 drivers/gpu/drm/i915/intel_i2c.c                   |  66 ++++++++--
 drivers/gpu/drm/radeon/atombios_crtc.c             |   8 +-
 drivers/hid/hid-ids.h                              |   5 +
 drivers/hid/usbhid/hid-quirks.c                    |   3 +
 drivers/hv/channel.c                               |   7 +-
 drivers/hv/channel_mgmt.c                          |  12 +-
 drivers/i2c/busses/i2c-rk3x.c                      |   2 +-
 drivers/i2c/i2c-core.c                             |   5 +
 drivers/infiniband/core/umem.c                     |   7 +-
 drivers/infiniband/hw/mlx4/qp.c                    |   3 +-
 drivers/infiniband/ulp/iser/iser_initiator.c       |   4 +-
 drivers/infiniband/ulp/isert/ib_isert.c            |  20 +--
 drivers/input/misc/twl4030-pwrbutton.c             |   1 +
 drivers/input/mouse/elantech.c                     |  57 ++++++++-
 drivers/input/mouse/elantech.h                     |   1 +
 drivers/md/raid0.c                                 |   3 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h    |   2 +-
 drivers/media/platform/sh_veu.c                    |   1 +
 drivers/media/rc/img-ir/img-ir-core.c              |   2 +-
 drivers/media/usb/stk1160/stk1160-v4l.c            |  17 ++-
 drivers/memstick/core/mspro_block.c                |   3 +-
 drivers/mmc/host/sunxi-mmc.c                       |   4 +-
 drivers/mtd/ubi/attach.c                           |   2 +-
 drivers/mtd/ubi/cdev.c                             |   2 +-
 drivers/mtd/ubi/eba.c                              |   3 +-
 drivers/mtd/ubi/wl.c                               |   2 +-
 drivers/net/bonding/bond_main.c                    |   3 +-
 drivers/net/ethernet/intel/e1000/e1000_main.c      |  10 +-
 .../net/ethernet/mellanox/mlx5/core/pagealloc.c    |  10 +-
 drivers/net/ppp/ppp_generic.c                      |   1 +
 drivers/net/usb/asix_common.c                      |   2 +
 drivers/net/usb/cdc_ncm.c                          |   6 +-
 drivers/net/usb/sr9800.c                           |   1 +
 drivers/net/usb/usbnet.c                           |  17 ++-
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c        |   2 +
 drivers/net/wireless/ti/wl18xx/debugfs.c           |   2 +-
 drivers/net/wireless/ti/wlcore/debugfs.h           |   4 +-
 drivers/of/address.c                               |  11 +-
 drivers/pci/hotplug/cpci_hotplug_pci.c             |   3 +-
 drivers/pci/pcie/aer/aerdrv_errprint.c             |  12 +-
 drivers/platform/x86/apple-gmux.c                  |  48 +++++++-
 drivers/platform/x86/compal-laptop.c               |  10 +-
 drivers/power/lp8788-charger.c                     |   4 +-
 drivers/power/twl4030_madc_battery.c               |   7 +-
 drivers/scsi/be2iscsi/be_main.c                    |   2 +-
 drivers/scsi/mvsas/mv_sas.c                        |   5 +-
 drivers/scsi/scsi_lib.c                            |   4 +-
 drivers/scsi/storvsc_drv.c                         |  15 +--
 drivers/spi/spidev.c                               |   5 +-
 drivers/staging/panel/panel.c                      |  12 +-
 drivers/target/iscsi/iscsi_target.c                | 106 +++++++---------
 drivers/target/iscsi/iscsi_target_core.h           |   7 ++
 drivers/target/iscsi/iscsi_target_erl0.c           |  13 +-
 drivers/target/iscsi/iscsi_target_login.c          |  59 ++++++++-
 drivers/target/target_core_file.c                  | 122 +++++++++++-------
 drivers/target/target_core_sbc.c                   |  15 ++-
 drivers/target/target_core_transport.c             |  37 +++++-
 drivers/tty/n_tty.c                                | 106 ++++++++++++----
 drivers/usb/class/cdc-wdm.c                        |  12 +-
 drivers/usb/core/hub.c                             |   4 +-
 drivers/usb/dwc2/hcd.c                             |   2 +-
 drivers/usb/gadget/composite.c                     |   2 +-
 drivers/usb/gadget/printer.c                       |   9 ++
 drivers/usb/host/ehci-hcd.c                        |  10 +-
 drivers/usb/host/ehci-hub.c                        |   9 +-
 drivers/usb/host/fotg210-hcd.c                     |   2 +-
 drivers/usb/host/fusbh200-hcd.c                    |   3 +-
 drivers/usb/host/isp116x-hcd.c                     |   2 +-
 drivers/usb/host/isp1760-hcd.c                     |   2 +-
 drivers/usb/host/oxu210hp-hcd.c                    |   7 +-
 drivers/usb/host/r8a66597-hcd.c                    |   2 +-
 drivers/usb/host/sl811-hcd.c                       |   2 +-
 drivers/usb/host/uhci-hub.c                        |   5 +-
 drivers/usb/host/xhci-ring.c                       |   2 +-
 drivers/usb/musb/musb_core.c                       |  49 +++++---
 drivers/usb/musb/musb_virthub.c                    |   2 +-
 drivers/usb/phy/phy.c                              |   4 +-
 drivers/usb/serial/generic.c                       |   2 +-
 drivers/usb/storage/uas-detect.h                   |  33 ++++-
 drivers/usb/storage/unusual_uas.h                  |   8 --
 firmware/ihex2fw.c                                 |   1 +
 fs/aio.c                                           |   3 +
 fs/binfmt_elf.c                                    |   9 +-
 fs/btrfs/extent-tree.c                             |   5 +-
 fs/btrfs/ioctl.c                                   |   8 ++
 fs/btrfs/xattr.c                                   |  53 +++++---
 fs/exec.c                                          |  76 +++++++-----
 fs/ext4/ext4.h                                     |   5 +-
 fs/ext4/extents.c                                  |  48 +++++---
 fs/ext4/indirect.c                                 | 105 +++++++++++-----
 fs/ext4/namei.c                                    |  20 +--
 fs/namei.c                                         |   6 +-
 fs/namespace.c                                     |  29 ++---
 fs/nfs/callback.c                                  |   6 +-
 fs/nfsd/nfsctl.c                                   |  16 +--
 fs/ocfs2/file.c                                    |  14 ++-
 fs/pnode.h                                         |   1 -
 include/asm-generic/sections.h                     |   4 +
 include/linux/blk_types.h                          |   4 +-
 include/linux/cpuidle.h                            |   1 -
 include/linux/jhash.h                              |  17 ++-
 include/linux/netdevice.h                          |   6 +
 include/linux/sched.h                              |   8 ++
 include/linux/skbuff.h                             |  13 ++
 include/linux/usb.h                                |  26 ++++
 include/linux/usb/usbnet.h                         |  16 ++-
 include/net/ip.h                                   |  16 ---
 include/net/ip6_route.h                            |   3 +-
 include/net/sock.h                                 |   2 +
 include/target/target_core_base.h                  |   2 +-
 kernel/ptrace.c                                    |  20 +++
 kernel/sched/core.c                                |  15 +++
 kernel/trace/ring_buffer.c                         |  11 +-
 lib/string.c                                       |   2 +-
 mm/hugetlb.c                                       |   3 +-
 net/core/dev.c                                     |   4 +-
 net/core/skbuff.c                                  |  39 ++++--
 net/core/sock.c                                    |  19 +++
 net/ipv4/ip_forward.c                              |   3 +
 net/ipv4/ping.c                                    |   1 +
 net/ipv4/tcp_ipv4.c                                |   2 +-
 net/ipv4/tcp_output.c                              |  66 +++++++---
 net/ipv6/ip6_output.c                              |   3 +-
 net/ipv6/ip6_vti.c                                 |   3 +-
 net/ipv6/tcp_ipv6.c                                |   2 +-
 net/netlink/af_netlink.c                           |   6 +-
 net/sunrpc/xprtrdma/verbs.c                        |   5 +-
 sound/firewire/bebob/bebob_maudio.c                |   8 +-
 sound/pci/emu10k1/emuproc.c                        |  12 --
 sound/pci/hda/patch_realtek.c                      |  13 ++
 sound/soc/codecs/cs4271.c                          |   4 +-
 sound/soc/codecs/pcm512x.c                         |   4 +-
 sound/soc/codecs/wm8741.c                          |   8 +-
 sound/soc/davinci/davinci-evm.c                    |  10 --
 sound/usb/mixer_quirks.c                           |   1 +
 tools/lib/traceevent/kbuffer-parse.c               |   1 -
 tools/power/x86/turbostat/Makefile                 |   6 +-
 virt/kvm/kvm_main.c                                |   4 +-
 205 files changed, 1855 insertions(+), 827 deletions(-)

Akinobu Mita (3):
      target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled
      target/file: Fix SG table for prot_buf initialization
      target/file: Fix UNMAP with DIF protection support

Al Viro (3):
      ioctx_alloc(): fix vma (and file) leak on failure
      ocfs2: _really_ sync the right range
      RCU pathwalk breakage when running into a symlink overmounting something

Alex Deucher (1):
      drm/radeon: fix doublescan modes (v2)

Alexander Duyck (1):
      jhash: Update jhash_[321]words functions to use correct initval

Alexander Ploumistos (1):
      Bluetooth: ath3k: Add support Atheros AR5B195 combo Mini PCIe card

Andrey Ryabinin (1):
      ARM: 8320/1: fix integer overflow in ELF_ET_DYN_BASE

Andrzej Pietrasiewicz (1):
      usb: gadget: printer: enqueue printer's response for setup request

Anton Blanchard (1):
      powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH

Anton Nayshtut (1):
      bonding: Bonding Overriding Configuration logic restored.

Archit Taneja (1):
      clk: qcom: fix RCG M/N counter configuration

Arun Chandran (1):
      arm64: vdso: fix build error when switching from LE to BE

Axel Lin (1):
      usb: phy: Find the right match in devm_usb_phy_match

Bart Van Assche (1):
      Defer processing of REQ_PREEMPT requests for blocked devices

Bartlomiej Zolnierkiewicz (1):
      cpuidle: remove state_count field from struct cpuidle_device

Ben Hutchings (2):
      usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers
      usbnet: Fix tx_bytes statistic running backward in cdc_ncm

Benjamin Herrenschmidt (1):
      drivers/of: Add empty ranges quirk for PA-Semi

Boris Brezillon (1):
      clk: at91: usb: fix at91sam9x5 recalc, round and set rate

Brian Norris (4):
      UBI: account for bitflips in both the VID header and data
      UBI: fix out of bounds write
      UBI: initialize LEB number variable
      UBI: fix check for "too many bytes"

Bruno Prémont (1):
      apple-gmux: lock iGP IO to protect from vgaarb changes

Charles Keepax (2):
      ARM: S3C64XX: Use fixed IRQ bases to avoid conflicts on Cragganmore
      i2c: Mark adapter devices with pm_runtime_no_callbacks

Chen-Yu Tsai (1):
      mmc: sunxi: Use devm_reset_control_get_optional() for reset control

Chuck Lever (1):
      xprtrdma: Prevent infinite loop in rpcrdma_ep_create()

Dan Carpenter (2):
      PCI: cpcihp: Add missing curly braces in cpci_configure_slot()
      memstick: mspro_block: add missing curly braces

Daniel Vetter (1):
      drm/i915: Dont enable CS_PARSER_ERROR interrupts at all

Dave Olson (1):
      powerpc: Fix missing L2 cache size in /sys/devices/system/cpu

David Hildenbrand (2):
      KVM: s390: fix handling of write errors in the tpi handler
      KVM: s390: reinjection of irqs can fail in the tpi handler

David S. Miller (1):
      ipv4: Missing sk_nulls_node_init() in ping_unhash().

David Sterba (1):
      btrfs: don't accept bare namespace as a valid xattr

Deepak S (1):
      drm/i915/chv: Remove Wait for a previous gfx force-off

Dmitry M. Fedin (1):
      ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support

Dmitry Torokhov (2):
      i2c: rk3x: report number of messages transmitted
      drm/i915: cope with large i2c transfers

Ekaterina Tumanova (1):
      KVM: s390: Zero out current VMDB of STSI before including level3 data.

Erez Shitrit (1):
      IB/mlx4: Fix WQE LSO segment calculation

Eric Dumazet (5):
      tcp: tcp_make_synack() should clear skb->tstamp
      tcp: fix possible deadlock in tcp_send_fin()
      tcp: avoid looping in tcp_send_fin()
      net: do not deplete pfmemalloc reserve
      net: fix crash in build_skb()

Eric W. Biederman (1):
      mnt: Improve the umount_tree flags

Ethan Zhao (1):
      cpufreq: fix a NULL pointer dereference in __cpufreq_governor()

Ezequiel Garcia (1):
      [media] stk1160: Make sure current buffer is released

Felipe Balbi (16):
      usb: gadget: composite: enable BESL support
      usb: musb: core: fix TX/RX endpoint order
      usb: define a generic USB_RESUME_TIMEOUT macro
      usb: host: xhci: use new USB_RESUME_TIMEOUT
      usb: host: ehci: use new USB_RESUME_TIMEOUT
      usb: host: uhci: use new USB_RESUME_TIMEOUT
      usb: musb: use new USB_RESUME_TIMEOUT
      usb: host: isp116x: use new USB_RESUME_TIMEOUT
      usb: host: fotg210: use new USB_RESUME_TIMEOUT
      usb: host: fusbh200: use new USB_RESUME_TIMEOUT
      usb: host: oxu210hp: use new USB_RESUME_TIMEOUT
      usb: host: r8a66597: use new USB_RESUME_TIMEOUT
      usb: host: sl811: use new USB_RESUME_TIMEOUT
      usb: dwc2: hcd: use new USB_RESUME_TIMEOUT
      usb: isp1760: hcd: use new USB_RESUME_TIMEOUT
      usb: core: hub: use new USB_RESUME_TIMEOUT

Filipe Manana (3):
      Btrfs: fix log tree corruption when fs mounted with -o discard
      Btrfs: fix inode eviction infinite loop after extent_same ioctl
      Btrfs: fix inode eviction infinite loop after cloning into it

Geert Uytterhoeven (1):
      nosave: consolidate __nosave_{begin,end} in <asm/sections.h>

Gerald Schaefer (1):
      mm/hugetlb: use pmd_page() in follow_huge_pmd()

Giuseppe Cantavenera (1):
      nfsd: fix nsfd startup race triggering BUG_ON

Gregory CLEMENT (1):
      gpio: mvebu: Fix mask/unmask managment per irq chip type

Hans Verkuil (1):
      [media] sh_veu: v4l2_dev wasn't set

Hans de Goede (1):
      uas: Do not blacklist ASM1153 disk enclosures

Heiko Carstens (1):
      s390/hibernate: fix save and restore of kernel text section

Herbert Xu (1):
      skbuff: Do not scrub skb mark within the same name space

Honggang LI (1):
      mlx5: wrong page mask if CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for 32Bit architectures

Howard Mitchell (1):
      ASoC: pcm512x: Add 'Analogue' prefix to analogue volume controls

Huacai Chen (2):
      MIPS: Loongson-3: Add IRQF_NO_SUSPEND to Cascade irqaction
      MIPS: Hibernate: flush TLB entries earlier

Ian Abbott (1):
      spi: spidev: fix possible arithmetic overflow for multi-transfer message

Imre Deak (1):
      drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg

James Bottomley (1):
      mvsas: fix panic on expander attached SATA devices

James Hogan (1):
      MIPS: KVM: Handle MSA Disabled exceptions from guest

Jann Horn (1):
      fs: take i_mutex during prepare_binprm for set[ug]id executables

Jeff Layton (1):
      nfs: fix high load average due to callback thread sleeping

Jeremiah Mahler (1):
      usb: serial: silence all non-critical read errors

Jesse Barnes (2):
      drm/i915/vlv: save/restore the power context base reg
      drm/i915/vlv: remove wait for previous GFX clk disable request

Jo-Philipp Wich (1):
      ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450

John Soni Jose (1):
      be2iscsi: Fix kernel panic when device initialization fails

Junjie Mao (1):
      driver core: bus: Goto appropriate labels on failure in bus_add_device

K. Y. Srinivasan (3):
      Drivers: hv: vmbus: Fix a bug in the error path in vmbus_open()
      Drivers: hv: vmbus: Don't wait after requesting offers
      scsi: storvsc: Fix a bug in copy_from_bounce_buffer()

Kailang Yang (1):
      ALSA: hda/realtek - Make more stable to get pin sense for ALC283

Krzysztof Kozlowski (4):
      power_supply: twl4030_madc: Check return value of power_supply_register
      power_supply: lp8788-charger: Fix leaked power supply on probe fail
      compal-laptop: Fix leaking hwmon device
      compal-laptop: Check return value of power_supply_register

Larry Finger (1):
      rtlwifi: rtl8192cu: Add new USB ID

Len Brown (1):
      sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance

Lukas Czerner (2):
      ext4: make fsync to sync parent dir in no-journal for real this time
      ext4: allocate entire range in zero range

Manish Badarkhe (1):
      ASoC: davinci-evm: drop un-necessary remove function

Marcelo Tosatti (1):
      x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

Marek Szyprowski (1):
      [media] media: s5p-mfc: fix mmap support for 64bit arch

Marek Vasut (1):
      rtlwifi: rtl8192cu: Add new device ID

Mark Brown (1):
      i2c: core: Export bus recovery functions

Mark Rutland (1):
      arm64: head.S: ensure visibility of page tables

Markos Chandras (2):
      MIPS: asm: asm-eva: Introduce kernel load/store variants
      MIPS: Malta: Detect and fix bad memsize values

Max Filippov (3):
      xtensa: xtfpga: fix hardware lockup caused by LCD driver
      xtensa: provide __NR_sync_file_range2 instead of __NR_sync_file_range
      xtensa: ISS: fix locking in TAP network adapter

Michael Davidson (1):
      fs/binfmt_elf.c: fix bug in loading of PIE binaries

Michael Ellerman (1):
      powerpc/cell: Fix cell iommu after it_page_shift changes

Michael Gernoth (1):
      ALSA: emu10k1: don't deadlock in proc-functions

Michal Kubeček (1):
      tcp: prevent fetching dst twice in early demux code

Mike Christie (1):
      iscsi target: fix oops when adding reject pdu

Nadav Amit (2):
      KVM: x86: Fix lost interrupt on irr_pending race
      KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save

NeilBrown (2):
      md/raid0: fix bug with chunksize not a power of 2.
      Input: twl4030-pwrbutton - ensure a wakeup event is recorded.

Nicholas Bellinger (2):
      iscsi-target: Convert iscsi_thread_set usage to kthread.h
      target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling

Nicolas Iooss (2):
      wl18xx: show rx_frames_per_rates as an array as it really is
      firmware/ihex2fw.c: restore missing default in switch statement

Nishanth Menon (1):
      C6x: time: Ensure consistency in __init

Octavian Purdila (1):
      ACPICA: Tables: Don't release ACPI_MTX_TABLES in acpi_tb_install_standard_table().

Oleg Nesterov (1):
      ptrace: fix race between ptrace_resume() and wait_task_stopped()

Oliver Neukum (3):
      HID: add HP OEM mouse to quirk ALWAYS_POLL
      HID: add quirk for PIXART OEM mouse used by HP
      cdc-wdm: fix endianness bug in debug statements

Omar Sandoval (1):
      ext4: fix indirect punch hole corruption

Pascal Huerst (1):
      ASoC: cs4271: Increase delay time after reset

Peter Hurley (1):
      n_tty: Fix read buffer overwrite when no newline

Radim Krčmář (2):
      x86: vdso: fix pvclock races with task migration
      KVM: use slowpath for cross page cached accesses

Rafael J. Wysocki (1):
      ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline()

Rainer Koenig (1):
      Input: elantech - add more Fujtisu notebooks to force crc_enabled

Rasmus Villemoes (1):
      PCI/AER: Avoid info leak in __print_tlp_header()

Roald Frederickx (1):
      compal-laptop: correct invalid hwmon name

Russell King (1):
      ARM: fix broken hibernation

Sabrina Dubroca (1):
      e1000: add dummy allocator to fix race condition between mtu change and netpoll

Sagi Grimberg (3):
      iser-target: Fix session hang in case of an rdma read DIF error
      iser-target: Fix possible deadlock in RDMA_CM connection error
      IB/iser: Fix wrong calculation of protection buffer length

Sebastian Hesselbarth (1):
      ARM: dts: dove: Fix uart[23] reg property

Sebastian Pöhn (1):
      ip_forward: Drop frames with attached skb->sk

Sergej Sawazki (1):
      ASoC: wm8741: Fix rates constraints values

Sifan Naeem (1):
      [media] rc: img-ir: fix error in parameters passed to irq_free()

Simon Horman (1):
      ARM: shmobile: r8a7790: Correct SYSCIER value

Steven Rostedt (1):
      ring-buffer: Replace this_cpu_*() with __this_cpu_*()

Steven Rostedt (Red Hat) (1):
      tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING

Sudip Mukherjee (1):
      staging: panel: fix lcd type

Takashi Iwai (1):
      ALSA: hda - Fix headphone pin config for Lifebook T731

Takashi Sakamoto (1):
      ALSA: bebob: fix to processing in big-endian machine for sending cue

Theodore Ts'o (2):
      ext4: fix accidental flag aliasing in ext4_map_blocks flags
      ext4: fix ZERO_RANGE bug hidden by flag aliasing

Thierry Reding (1):
      clk: tegra: Register the proper number of resets

Thomas D (1):
      tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in Makefile

Thomas Schlichter (1):
      cpuidle: ACPI: do not overwrite name and description of C0

Tom Herbert (2):
      net: add skb_checksum_complete_unset
      ppp: call skb_checksum_complete_unset in ppp_receive_frame

Ulrik De Bie (2):
      Input: elantech - fix absolute mode setting on some ASUS laptops
      Input: elantech - fix crc_enabled for Fujitsu H730

Viresh Kumar (1):
      cpufreq: Schedule work for the first-online CPU on resume

Vutla, Lokesh (1):
      crypto: omap-aes - Fix support for unequal lengths

Yann Droneaud (2):
      IB/core: disallow registering 0-sized memory region
      IB/core: don't disallow registering region starting at 0x0

Yao Xiwei (1):
      vti6: fix uninit when using x-netns

Yves-Alexis Perez (1):
      ALSA: hda - Add dock support for ThinkPad X250 (17aa:2226)

hannes@stressinduktion.org (1):
      ipv6: protect skb->sk accesses from recursive dereference inside the stack

mancha security (1):
      lib: memzero_explicit: use barrier instead of OPTIMIZER_HIDE_VAR

oliver@neukum.org (1):
      HID: add ALWAYS_POLL quirk for a Logitech 0xc007

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

* [PATCH 3.16.y-ckt 001/180] n_tty: Fix read buffer overwrite when no newline
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 002/180] spi: spidev: fix possible arithmetic overflow for multi-transfer message Luis Henriques
                   ` (178 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, Greg Kroah-Hartman, Joseph Salisbury, Luis Henriques

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

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

From: Peter Hurley <peter@hurleysoftware.com>

commit fb5ef9e7da39968fec6d6f37f20a23d23740c75e upstream.

In canon mode, the read buffer head will advance over the buffer tail
if the input > 4095 bytes without receiving a line termination char.

Discard additional input until a line termination is received.
Before evaluating for overflow, the 'room' value is normalized for
I_PARMRK and 1 byte is reserved for line termination (even in !icanon
mode, in case the mode is switched). The following table shows the
transform:

 actual buffer |  'room' value before overflow calc
  space avail  |    !I_PARMRK    |    I_PARMRK
 --------------------------------------------------
      0        |       -1        |       -1
      1        |        0        |        0
      2        |        1        |        0
      3        |        2        |        0
      4+       |        3        |        1

When !icanon or when icanon and the read buffer contains newlines,
normalized 'room' values of -1 and 0 are clamped to 0, and
'overflow' is 0, so read_head is not adjusted and the input i/o loop
exits (setting no_room if called from flush_to_ldisc()). No input
is discarded since the reader does have input available to read
which ensures forward progress.

When icanon and the read buffer does not contain newlines and the
normalized 'room' value is 0, then overflow and room are reset to 1,
so that the i/o loop will process the next input char normally
(except for parity errors which are ignored). Thus, erasures, signalling
chars, 7-bit mode, etc. will continue to be handled properly.

If the input char processed was not a line termination char, then
the canon_head index will not have advanced, so the normalized 'room'
value will now be -1 and 'overflow' will be set, which indicates the
read_head can safely be reset, effectively erasing the last char
processed.

If the input char processed was a line termination, then the
canon_head index will have advanced, so 'overflow' is cleared to 0,
the read_head is not reset, and 'room' is cleared to 0, which exits
the i/o loop (because the reader now have input available to read
which ensures forward progress).

Note that it is possible for a line termination to be received, and
for the reader to copy the line to the user buffer before the
input i/o loop is ready to process the next input char. This is
why the i/o loop recomputes the room/overflow state with every
input char while handling overflow.

Finally, if the input data was processed without receiving
a line termination (so that overflow is still set), the pty
driver must receive a write wakeup. A pty writer may be waiting
to write more data in n_tty_write() but without unthrottling
here that wakeup will not arrive, and forward progress will halt.
(Normally, the pty writer is woken when the reader reads data out
of the buffer and more space become available).

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/n_tty.c | 106 +++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 79 insertions(+), 27 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 662cbb3af586..35de4adc3f1d 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -247,8 +247,6 @@ static void n_tty_write_wakeup(struct tty_struct *tty)
 
 static void n_tty_check_throttle(struct tty_struct *tty)
 {
-	if (tty->driver->type == TTY_DRIVER_TYPE_PTY)
-		return;
 	/*
 	 * Check the remaining room for the input canonicalization
 	 * mode.  We don't want to throttle the driver if we're in
@@ -1512,23 +1510,6 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag)
 		n_tty_receive_char_flagged(tty, c, flag);
 }
 
-/**
- *	n_tty_receive_buf	-	data receive
- *	@tty: terminal device
- *	@cp: buffer
- *	@fp: flag buffer
- *	@count: characters
- *
- *	Called by the terminal driver when a block of characters has
- *	been received. This function must be called from soft contexts
- *	not from interrupt context. The driver is responsible for making
- *	calls one at a time and in order (or using flush_to_ldisc)
- *
- *	n_tty_receive_buf()/producer path:
- *		claims non-exclusive termios_rwsem
- *		publishes read_head and canon_head
- */
-
 static void
 n_tty_receive_buf_real_raw(struct tty_struct *tty, const unsigned char *cp,
 			   char *fp, int count)
@@ -1684,24 +1665,85 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
 	}
 }
 
+/**
+ *	n_tty_receive_buf_common	-	process input
+ *	@tty: device to receive input
+ *	@cp: input chars
+ *	@fp: flags for each char (if NULL, all chars are TTY_NORMAL)
+ *	@count: number of input chars in @cp
+ *
+ *	Called by the terminal driver when a block of characters has
+ *	been received. This function must be called from soft contexts
+ *	not from interrupt context. The driver is responsible for making
+ *	calls one at a time and in order (or using flush_to_ldisc)
+ *
+ *	Returns the # of input chars from @cp which were processed.
+ *
+ *	In canonical mode, the maximum line length is 4096 chars (including
+ *	the line termination char); lines longer than 4096 chars are
+ *	truncated. After 4095 chars, input data is still processed but
+ *	not stored. Overflow processing ensures the tty can always
+ *	receive more input until at least one line can be read.
+ *
+ *	In non-canonical mode, the read buffer will only accept 4095 chars;
+ *	this provides the necessary space for a newline char if the input
+ *	mode is switched to canonical.
+ *
+ *	Note it is possible for the read buffer to _contain_ 4096 chars
+ *	in non-canonical mode: the read buffer could already contain the
+ *	maximum canon line of 4096 chars when the mode is switched to
+ *	non-canonical.
+ *
+ *	n_tty_receive_buf()/producer path:
+ *		claims non-exclusive termios_rwsem
+ *		publishes commit_head or canon_head
+ */
 static int
 n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
 			 char *fp, int count, int flow)
 {
 	struct n_tty_data *ldata = tty->disc_data;
-	int room, n, rcvd = 0;
+	int room, n, rcvd = 0, overflow;
 
 	down_read(&tty->termios_rwsem);
 
 	while (1) {
-		room = receive_room(tty);
+		/*
+		 * When PARMRK is set, each input char may take up to 3 chars
+		 * in the read buf; reduce the buffer space avail by 3x
+		 *
+		 * If we are doing input canonicalization, and there are no
+		 * pending newlines, let characters through without limit, so
+		 * that erase characters will be handled.  Other excess
+		 * characters will be beeped.
+		 *
+		 * paired with store in *_copy_from_read_buf() -- guarantees
+		 * the consumer has loaded the data in read_buf up to the new
+		 * read_tail (so this producer will not overwrite unread data)
+		 */
+		size_t tail = ldata->read_tail;
+
+		room = N_TTY_BUF_SIZE - (ldata->read_head - tail);
+		if (I_PARMRK(tty))
+			room = (room + 2) / 3;
+		room--;
+		if (room <= 0) {
+			overflow = ldata->icanon && ldata->canon_head == tail;
+			if (overflow && room < 0)
+				ldata->read_head--;
+			room = overflow;
+			ldata->no_room = flow && !room;
+		} else
+			overflow = 0;
+
 		n = min(count, room);
-		if (!n) {
-			if (flow && !room)
-				ldata->no_room = 1;
+		if (!n)
 			break;
-		}
-		__receive_buf(tty, cp, fp, n);
+
+		/* ignore parity errors if handling overflow */
+		if (!overflow || !fp || *fp != TTY_PARITY)
+			__receive_buf(tty, cp, fp, n);
+
 		cp += n;
 		if (fp)
 			fp += n;
@@ -1710,7 +1752,17 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
 	}
 
 	tty->receive_room = room;
-	n_tty_check_throttle(tty);
+
+	/* Unthrottle if handling overflow on pty */
+	if (tty->driver->type == TTY_DRIVER_TYPE_PTY) {
+		if (overflow) {
+			tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE);
+			tty_unthrottle_safe(tty);
+			__tty_set_flow_change(tty, 0);
+		}
+	} else
+		n_tty_check_throttle(tty);
+
 	up_read(&tty->termios_rwsem);
 
 	return rcvd;

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

* [PATCH 3.16.y-ckt 002/180] spi: spidev: fix possible arithmetic overflow for multi-transfer message
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 001/180] n_tty: Fix read buffer overwrite when no newline Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 003/180] arm64: vdso: fix build error when switching from LE to BE Luis Henriques
                   ` (177 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ian Abbott, Mark Brown, Luis Henriques

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

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

From: Ian Abbott <abbotti@mev.co.uk>

commit f20fbaad7620af2df36a1f9d1c9ecf48ead5b747 upstream.

`spidev_message()` sums the lengths of the individual SPI transfers to
determine the overall SPI message length.  It restricts the total
length, returning an error if too long, but it does not check for
arithmetic overflow.  For example, if the SPI message consisted of two
transfers and the first has a length of 10 and the second has a length
of (__u32)(-1), the total length would be seen as 9, even though the
second transfer is actually very long.  If the second transfer specifies
a null `rx_buf` and a non-null `tx_buf`, the `copy_from_user()` could
overrun the spidev's pre-allocated tx buffer before it reaches an
invalid user memory address.  Fix it by checking that neither the total
nor the individual transfer lengths exceed the maximum allowed value.

Thanks to Dan Carpenter for reporting the potential integer overflow.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
[ luis: backported to 3.16: used backport provided by Ian ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spidev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index e3bc23bb5883..621df17214a5 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -244,7 +244,10 @@ static int spidev_message(struct spidev_data *spidev,
 		k_tmp->len = u_tmp->len;
 
 		total += k_tmp->len;
-		if (total > bufsiz) {
+		/* Check total length of transfers.  Also check each
+		 * transfer length to avoid arithmetic overflow.
+		 */
+		if (total > bufsiz || k_tmp->len > bufsiz) {
 			status = -EMSGSIZE;
 			goto done;
 		}

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

* [PATCH 3.16.y-ckt 003/180] arm64: vdso: fix build error when switching from LE to BE
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 001/180] n_tty: Fix read buffer overwrite when no newline Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 002/180] spi: spidev: fix possible arithmetic overflow for multi-transfer message Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 004/180] uas: Do not blacklist ASM1153 disk enclosures Luis Henriques
                   ` (176 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arun Chandran, Will Deacon, Guenter Roeck, Luis Henriques

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

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

From: Arun Chandran <achandran@mvista.com>

commit 1915e2ad1cf548217c963121e4076b3d44dd0169 upstream.

Building a kernel with CPU_BIG_ENDIAN fails if there are stale objects
from a !CPU_BIG_ENDIAN build. Due to a missing FORCE prerequisite on an
if_changed rule in the VDSO Makefile, we attempt to link a stale LE
object into the new BE kernel.

According to Documentation/kbuild/makefiles.txt, FORCE is required for
if_changed rules and forgetting it is a common mistake, so fix it by
'Forcing' the build of vdso. This patch fixes build errors like these:

arch/arm64/kernel/vdso/note.o: compiled for a little endian system and target is big endian
failed to merge target specific data of file arch/arm64/kernel/vdso/note.o

arch/arm64/kernel/vdso/sigreturn.o: compiled for a little endian system and target is big endian
failed to merge target specific data of file arch/arm64/kernel/vdso/sigreturn.o

Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Arun Chandran <achandran@mvista.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/kernel/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index 6d20b7d162d8..a268a9af0c2d 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -43,7 +43,7 @@ $(obj)/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
 	$(call if_changed,vdsosym)
 
 # Assembly rules for the .S files
-$(obj-vdso): %.o: %.S
+$(obj-vdso): %.o: %.S FORCE
 	$(call if_changed_dep,vdsoas)
 
 # Actual build commands

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

* [PATCH 3.16.y-ckt 004/180] uas: Do not blacklist ASM1153 disk enclosures
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (2 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 003/180] arm64: vdso: fix build error when switching from LE to BE Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 005/180] KVM: x86: Fix lost interrupt on irr_pending race Luis Henriques
                   ` (175 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Greg Kroah-Hartman, Luis Henriques

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

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

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

commit 078fd7d6308a30121b80c297e9b38a2e53711942 upstream.

Our detection logic to avoid doing UAS on ASM1051 bridge chips causes problems
with newer ASM1153 disk enclosures in 2 ways:

1) Some ASM1153 disk enclosures re-use the ASM1051 device-id of 5106, which
   we assume is always an ASM1051, so remove the quirk for 5106, and instead
   use the same detection logic as we already use for device-id 55aa, which is
   used for all of ASM1051, ASM1053 and ASM1153 devices <sigh>.

2) Our detection logic to differentiate between ASM1051 and ASM1053 sees
   ASM1153 devices as ASM1051 because they have 32 streams like ASM1051 devs.
   Luckily the ASM1153 descriptors are not 100% identical, unlike the previous
   models the ASM1153 has bMaxPower == 0, so use that to differentiate it.

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/uas-detect.h  | 33 ++++++++++++++++++++++++++++-----
 drivers/usb/storage/unusual_uas.h |  8 --------
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h
index 8a6f371ed6e7..9893d696fc97 100644
--- a/drivers/usb/storage/uas-detect.h
+++ b/drivers/usb/storage/uas-detect.h
@@ -69,16 +69,39 @@ static int uas_use_uas_driver(struct usb_interface *intf,
 		return 0;
 
 	/*
-	 * ASM1051 and older ASM1053 devices have the same usb-id, and UAS is
-	 * broken on the ASM1051, use the number of streams to differentiate.
-	 * New ASM1053-s also support 32 streams, but have a different prod-id.
+	 * ASMedia has a number of usb3 to sata bridge chips, at the time of
+	 * this writing the following versions exist:
+	 * ASM1051 - no uas support version
+	 * ASM1051 - with broken (*) uas support
+	 * ASM1053 - with working uas support
+	 * ASM1153 - with working uas support
+	 *
+	 * Devices with these chips re-use a number of device-ids over the
+	 * entire line, so the device-id is useless to determine if we're
+	 * dealing with an ASM1051 (which we want to avoid).
+	 *
+	 * The ASM1153 can be identified by config.MaxPower == 0,
+	 * where as the ASM105x models have config.MaxPower == 36.
+	 *
+	 * Differentiating between the ASM1053 and ASM1051 is trickier, when
+	 * connected over USB-3 we can look at the number of streams supported,
+	 * ASM1051 supports 32 streams, where as early ASM1053 versions support
+	 * 16 streams, newer ASM1053-s also support 32 streams, but have a
+	 * different prod-id.
+	 *
+	 * (*) ASM1051 chips do work with UAS with some disks (with the
+	 *     US_FL_NO_REPORT_OPCODES quirk), but are broken with other disks
 	 */
 	if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c &&
-			le16_to_cpu(udev->descriptor.idProduct) == 0x55aa) {
-		if (udev->speed < USB_SPEED_SUPER) {
+			(le16_to_cpu(udev->descriptor.idProduct) == 0x5106 ||
+			 le16_to_cpu(udev->descriptor.idProduct) == 0x55aa)) {
+		if (udev->actconfig->desc.bMaxPower == 0) {
+			/* ASM1153, do nothing */
+		} else if (udev->speed < USB_SPEED_SUPER) {
 			/* No streams info, assume ASM1051 */
 			flags |= US_FL_IGNORE_UAS;
 		} else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) {
+			/* Possibly an ASM1051, disable uas */
 			flags |= US_FL_IGNORE_UAS;
 		}
 	}
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
index cd4ba61330c8..30ec9be3b198 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -124,14 +124,6 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999,
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_NO_REPORT_OPCODES),
 
-/* Most ASM1051 based devices have issues with uas, blacklist them all */
-/* Reported-by: Hans de Goede <hdegoede@redhat.com> */
-UNUSUAL_DEV(0x174c, 0x5106, 0x0000, 0x9999,
-		"ASMedia",
-		"ASM1051",
-		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
-		US_FL_IGNORE_UAS),
-
 /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
 UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
 		"VIA",

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

* [PATCH 3.16.y-ckt 005/180] KVM: x86: Fix lost interrupt on irr_pending race
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (3 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 004/180] uas: Do not blacklist ASM1153 disk enclosures Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 006/180] tcp: prevent fetching dst twice in early demux code Luis Henriques
                   ` (174 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nadav Amit, Paolo Bonzini, Luis Henriques

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

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

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

commit f210f7572bedf3320599e8b2d8e8ec2d96270d0b upstream.

apic_find_highest_irr assumes irr_pending is set if any vector in APIC_IRR is
set.  If this assumption is broken and apicv is disabled, the injection of
interrupts may be deferred until another interrupt is delivered to the guest.
Ultimately, if no other interrupt should be injected to that vCPU, the pending
interrupt may be lost.

commit 56cc2406d68c ("KVM: nVMX: fix "acknowledge interrupt on exit" when APICv
is in use") changed the behavior of apic_clear_irr so irr_pending is cleared
after setting APIC_IRR vector. After this commit, if apic_set_irr and
apic_clear_irr run simultaneously, a race may occur, resulting in APIC_IRR
vector set, and irr_pending cleared. In the following example, assume a single
vector is set in IRR prior to calling apic_clear_irr:

apic_set_irr				apic_clear_irr
------------				--------------
apic->irr_pending = true;
					apic_clear_vector(...);
					vec = apic_search_irr(apic);
					// => vec == -1
apic_set_vector(...);
					apic->irr_pending = (vec != -1);
					// => apic->irr_pending == false

Nonetheless, it appears the race might even occur prior to this commit:

apic_set_irr				apic_clear_irr
------------				--------------
apic->irr_pending = true;
					apic->irr_pending = false;
					apic_clear_vector(...);
					if (apic_search_irr(apic) != -1)
						apic->irr_pending = true;
					// => apic->irr_pending == false
apic_set_vector(...);

Fixing this issue by:
1. Restoring the previous behavior of apic_clear_irr: clear irr_pending, call
   apic_clear_vector, and then if APIC_IRR is non-zero, set irr_pending.
2. On apic_set_irr: first call apic_set_vector, then set irr_pending.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kvm/lapic.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 453e5fbbb7ae..f96b8a4d3fed 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -323,8 +323,12 @@ EXPORT_SYMBOL_GPL(kvm_apic_update_irr);
 
 static inline void apic_set_irr(int vec, struct kvm_lapic *apic)
 {
-	apic->irr_pending = true;
 	apic_set_vector(vec, apic->regs + APIC_IRR);
+	/*
+	 * irr_pending must be true if any interrupt is pending; set it after
+	 * APIC_IRR to avoid race with apic_clear_irr
+	 */
+	apic->irr_pending = true;
 }
 
 static inline int apic_search_irr(struct kvm_lapic *apic)
@@ -356,13 +360,15 @@ static inline void apic_clear_irr(int vec, struct kvm_lapic *apic)
 
 	vcpu = apic->vcpu;
 
-	apic_clear_vector(vec, apic->regs + APIC_IRR);
-	if (unlikely(kvm_apic_vid_enabled(vcpu->kvm)))
+	if (unlikely(kvm_apic_vid_enabled(vcpu->kvm))) {
 		/* try to update RVI */
+		apic_clear_vector(vec, apic->regs + APIC_IRR);
 		kvm_make_request(KVM_REQ_EVENT, vcpu);
-	else {
-		vec = apic_search_irr(apic);
-		apic->irr_pending = (vec != -1);
+	} else {
+		apic->irr_pending = false;
+		apic_clear_vector(vec, apic->regs + APIC_IRR);
+		if (apic_search_irr(apic) != -1)
+			apic->irr_pending = true;
 	}
 }
 

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

* [PATCH 3.16.y-ckt 006/180] tcp: prevent fetching dst twice in early demux code
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (4 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 005/180] KVM: x86: Fix lost interrupt on irr_pending race Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 007/180] ipv6: protect skb->sk accesses from recursive dereference inside the stack Luis Henriques
                   ` (173 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kubecek, David S. Miller, Luis Henriques

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

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

From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= <mkubecek@suse.cz>

commit d0c294c53a771ae7e84506dfbd8c18c30f078735 upstream.

On s390x, gcc 4.8 compiles this part of tcp_v6_early_demux()

        struct dst_entry *dst = sk->sk_rx_dst;

        if (dst)
                dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);

to code reading sk->sk_rx_dst twice, once for the test and once for
the argument of ip6_dst_check() (dst_check() is inline). This allows
ip6_dst_check() to be called with null first argument, causing a crash.

Protect sk->sk_rx_dst access by READ_ONCE() both in IPv4 and IPv6
TCP early demux code.

Fixes: 41063e9dd119 ("ipv4: Early TCP socket demux.")
Fixes: c7109986db3c ("ipv6: Early TCP socket demux")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: used davem's backport to 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_ipv4.c | 2 +-
 net/ipv6/tcp_ipv6.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index ac7752f4f777..b68fd0d65411 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1637,7 +1637,7 @@ void tcp_v4_early_demux(struct sk_buff *skb)
 		skb->sk = sk;
 		skb->destructor = sock_edemux;
 		if (sk->sk_state != TCP_TIME_WAIT) {
-			struct dst_entry *dst = sk->sk_rx_dst;
+			struct dst_entry *dst = ACCESS_ONCE(sk->sk_rx_dst);
 
 			if (dst)
 				dst = dst_check(dst, 0);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index cb5125c5328d..d15a5484076f 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1646,7 +1646,7 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
 		skb->sk = sk;
 		skb->destructor = sock_edemux;
 		if (sk->sk_state != TCP_TIME_WAIT) {
-			struct dst_entry *dst = sk->sk_rx_dst;
+			struct dst_entry *dst = ACCESS_ONCE(sk->sk_rx_dst);
 
 			if (dst)
 				dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);

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

* [PATCH 3.16.y-ckt 007/180] ipv6: protect skb->sk accesses from recursive dereference inside the stack
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (5 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 006/180] tcp: prevent fetching dst twice in early demux code Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 008/180] tcp: tcp_make_synack() should clear skb->tstamp Luis Henriques
                   ` (172 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Pirko, Hannes Frederic Sowa, David S. Miller, Luis Henriques

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

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

From: "hannes@stressinduktion.org" <hannes@stressinduktion.org>

commit f60e5990d9c1424af9dbca60a23ba2a1c7c1ce90 upstream.

We should not consult skb->sk for output decisions in xmit recursion
levels > 0 in the stack. Otherwise local socket settings could influence
the result of e.g. tunnel encapsulation process.

ipv6 does not conform with this in three places:

1) ip6_fragment: we do consult ipv6_npinfo for frag_size

2) sk_mc_loop in ipv6 uses skb->sk and checks if we should
   loop the packet back to the local socket

3) ip6_skb_dst_mtu could query the settings from the user socket and
   force a wrong MTU

Furthermore:
In sk_mc_loop we could potentially land in WARN_ON(1) if we use a
PF_PACKET socket ontop of an IPv6-backed vxlan device.

Reuse xmit_recursion as we are currently only interested in protecting
tunnel devices.

Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
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>
---
 include/linux/netdevice.h |  6 ++++++
 include/net/ip.h          | 16 ----------------
 include/net/ip6_route.h   |  3 ++-
 include/net/sock.h        |  2 ++
 net/core/dev.c            |  4 +++-
 net/core/sock.c           | 19 +++++++++++++++++++
 net/ipv6/ip6_output.c     |  3 ++-
 7 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 66f9a04ec270..ab4ce78c5bb8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1977,6 +1977,12 @@ void netdev_freemem(struct net_device *dev);
 void synchronize_net(void);
 int init_dummy_netdev(struct net_device *dev);
 
+DECLARE_PER_CPU(int, xmit_recursion);
+static inline int dev_recursion_level(void)
+{
+	return this_cpu_read(xmit_recursion);
+}
+
 struct net_device *dev_get_by_index(struct net *net, int ifindex);
 struct net_device *__dev_get_by_index(struct net *net, int ifindex);
 struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
diff --git a/include/net/ip.h b/include/net/ip.h
index fdef22d88203..f2254fe1a39c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -425,22 +425,6 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
 
 #endif
 
-static inline int sk_mc_loop(struct sock *sk)
-{
-	if (!sk)
-		return 1;
-	switch (sk->sk_family) {
-	case AF_INET:
-		return inet_sk(sk)->mc_loop;
-#if IS_ENABLED(CONFIG_IPV6)
-	case AF_INET6:
-		return inet6_sk(sk)->mc_loop;
-#endif
-	}
-	WARN_ON(1);
-	return 1;
-}
-
 bool ip_call_ra_chain(struct sk_buff *skb);
 
 /*
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 1d09b46c1e48..eda131d179d9 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -174,7 +174,8 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
 
 static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
 {
-	struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
+	struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
+				inet6_sk(skb->sk) : NULL;
 
 	return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ?
 	       skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
diff --git a/include/net/sock.h b/include/net/sock.h
index 6cc7944d65bf..927cfc56b76a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1790,6 +1790,8 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
 
 struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
 
+bool sk_mc_loop(struct sock *sk);
+
 static inline bool sk_can_gso(const struct sock *sk)
 {
 	return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
diff --git a/net/core/dev.c b/net/core/dev.c
index 58bf1016a521..9742052fb55e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2821,7 +2821,9 @@ static void skb_update_prio(struct sk_buff *skb)
 #define skb_update_prio(skb)
 #endif
 
-static DEFINE_PER_CPU(int, xmit_recursion);
+DEFINE_PER_CPU(int, xmit_recursion);
+EXPORT_SYMBOL(xmit_recursion);
+
 #define RECURSION_LIMIT 10
 
 /**
diff --git a/net/core/sock.c b/net/core/sock.c
index 026e01f70274..a6ddd4ada315 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -659,6 +659,25 @@ static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool)
 		sock_reset_flag(sk, bit);
 }
 
+bool sk_mc_loop(struct sock *sk)
+{
+	if (dev_recursion_level())
+		return false;
+	if (!sk)
+		return true;
+	switch (sk->sk_family) {
+	case AF_INET:
+		return inet_sk(sk)->mc_loop;
+#if IS_ENABLED(CONFIG_IPV6)
+	case AF_INET6:
+		return inet6_sk(sk)->mc_loop;
+#endif
+	}
+	WARN_ON(1);
+	return true;
+}
+EXPORT_SYMBOL(sk_mc_loop);
+
 /*
  *	This is meant for all protocols to use and covers goings on
  *	at the socket level. Everything here is generic.
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index f709462b1a77..264bcf784926 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -555,7 +555,8 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 {
 	struct sk_buff *frag;
 	struct rt6_info *rt = (struct rt6_info*)skb_dst(skb);
-	struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
+	struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
+				inet6_sk(skb->sk) : NULL;
 	struct ipv6hdr *tmp_hdr;
 	struct frag_hdr *fh;
 	unsigned int mtu, hlen, left, len;

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

* [PATCH 3.16.y-ckt 008/180] tcp: tcp_make_synack() should clear skb->tstamp
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (6 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 007/180] ipv6: protect skb->sk accesses from recursive dereference inside the stack Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 009/180] usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers Luis Henriques
                   ` (171 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit b50edd7812852d989f2ef09dcfc729690f54a42d upstream.

I noticed tcpdump was giving funky timestamps for locally
generated SYNACK messages on loopback interface.

11:42:46.938990 IP 127.0.0.1.48245 > 127.0.0.2.23850: S
945476042:945476042(0) win 43690 <mss 65495,nop,nop,sackOK,nop,wscale 7>

20:28:58.502209 IP 127.0.0.2.23850 > 127.0.0.1.48245: S
3160535375:3160535375(0) ack 945476043 win 43690 <mss
65495,nop,nop,sackOK,nop,wscale 7>

This is because we need to clear skb->tstamp before
entering lower stack, otherwise net_timestamp_check()
does not set skb->tstamp.

Fixes: 7faee5c0d514 ("tcp: remove TCP_SKB_CB(skb)->when")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_output.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 1ea0a07ab0b5..144af9539ceb 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2855,6 +2855,8 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 	}
 #endif
 
+	/* Do not fool tcpdump (if any), clean our debris */
+	skb->tstamp.tv64 = 0;
 	return skb;
 }
 EXPORT_SYMBOL(tcp_make_synack);

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

* [PATCH 3.16.y-ckt 009/180] usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (7 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 008/180] tcp: tcp_make_synack() should clear skb->tstamp Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 010/180] usbnet: Fix tx_bytes statistic running backward in cdc_ncm Luis Henriques
                   ` (170 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Hutchings, David S. Miller, Luis Henriques

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

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

From: Ben Hutchings <ben.hutchings@codethink.co.uk>

commit 1e9e39f4a29857a396ac7b669d109f697f66695e upstream.

Currently the usbnet core does not update the tx_packets statistic for
drivers with FLAG_MULTI_PACKET and there is no hook in the TX
completion path where they could do this.

cdc_ncm and dependent drivers are bumping tx_packets stat on the
transmit path while asix and sr9800 aren't updating it at all.

Add a packet count in struct skb_data so these drivers can fill it
in, initialise it to 1 for other drivers, and add the packet count
to the tx_packets statistic on completion.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Tested-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/asix_common.c |  2 ++
 drivers/net/usb/cdc_ncm.c     |  3 ++-
 drivers/net/usb/sr9800.c      |  1 +
 drivers/net/usb/usbnet.c      |  5 +++--
 include/linux/usb/usbnet.h    | 12 ++++++++++++
 5 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 5c55f11572ba..724a9b50df7a 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -188,6 +188,8 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
 		memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
 		skb_put(skb, sizeof(padbytes));
 	}
+
+	usbnet_set_skb_tx_stats(skb, 1);
 	return skb;
 }
 
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 80a844e0ae03..70cbea551139 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1172,7 +1172,6 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
 
 	/* return skb */
 	ctx->tx_curr_skb = NULL;
-	dev->net->stats.tx_packets += ctx->tx_curr_frame_num;
 
 	/* keep private stats: framing overhead and number of NTBs */
 	ctx->tx_overhead += skb_out->len - ctx->tx_curr_frame_payload;
@@ -1184,6 +1183,8 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
 	 */
 	dev->net->stats.tx_bytes -= skb_out->len - ctx->tx_curr_frame_payload;
 
+	usbnet_set_skb_tx_stats(skb_out, n);
+
 	return skb_out;
 
 exit_no_skb:
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index b94a0fbb8b3b..7650cdc8fe6b 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -144,6 +144,7 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
 		skb_put(skb, sizeof(padbytes));
 	}
 
+	usbnet_set_skb_tx_stats(skb, 1);
 	return skb;
 }
 
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index f9e96c427558..3243b91c67b2 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1169,8 +1169,7 @@ static void tx_complete (struct urb *urb)
 	struct usbnet		*dev = entry->dev;
 
 	if (urb->status == 0) {
-		if (!(dev->driver_info->flags & FLAG_MULTI_PACKET))
-			dev->net->stats.tx_packets++;
+		dev->net->stats.tx_packets += entry->packets;
 		dev->net->stats.tx_bytes += entry->length;
 	} else {
 		dev->net->stats.tx_errors++;
@@ -1324,6 +1323,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
 			urb->transfer_flags |= URB_ZERO_PACKET;
 	}
 	entry->length = urb->transfer_buffer_length = length;
+	if (!(info->flags & FLAG_MULTI_PACKET))
+		usbnet_set_skb_tx_stats(skb, 1);
 
 	spin_lock_irqsave(&dev->txq.lock, flags);
 	retval = usb_autopm_get_interface_async(dev->intf);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0662e98fef72..539eea72129c 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -221,8 +221,20 @@ struct skb_data {	/* skb->cb is one of these */
 	struct usbnet		*dev;
 	enum skb_state		state;
 	size_t			length;
+	unsigned long		packets;
 };
 
+/* Drivers that set FLAG_MULTI_PACKET must call this in their
+ * tx_fixup method before returning an skb.
+ */
+static inline void
+usbnet_set_skb_tx_stats(struct sk_buff *skb, unsigned long packets)
+{
+	struct skb_data *entry = (struct skb_data *) skb->cb;
+
+	entry->packets = packets;
+}
+
 extern int usbnet_open(struct net_device *net);
 extern int usbnet_stop(struct net_device *net);
 extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,

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

* [PATCH 3.16.y-ckt 010/180] usbnet: Fix tx_bytes statistic running backward in cdc_ncm
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (8 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 009/180] usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 011/180] bonding: Bonding Overriding Configuration logic restored Luis Henriques
                   ` (169 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Hutchings, Bjørn Mork, Luis Henriques

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

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

From: Ben Hutchings <ben.hutchings@codethink.co.uk>

commit 7a1e890e2168e33fb62d84528e996b8b4b478fea upstream.

cdc_ncm disagrees with usbnet about how much framing overhead should
be counted in the tx_bytes statistics, and tries 'fix' this by
decrementing tx_bytes on the transmit path.  But statistics must never
be decremented except due to roll-over; this will thoroughly confuse
user-space.  Also, tx_bytes is only incremented by usbnet in the
completion path.

Fix this by requiring drivers that set FLAG_MULTI_FRAME to set a
tx_bytes delta along with the tx_packets count.

Fixes: beeecd42c3b4 ("net: cdc_ncm/cdc_mbim: adding NCM protocol statistics")
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/asix_common.c |  2 +-
 drivers/net/usb/cdc_ncm.c     |  7 +++----
 drivers/net/usb/sr9800.c      |  2 +-
 drivers/net/usb/usbnet.c      | 16 +++++++++++++---
 include/linux/usb/usbnet.h    |  6 ++++--
 5 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 724a9b50df7a..75d6f26729a3 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -189,7 +189,7 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
 		skb_put(skb, sizeof(padbytes));
 	}
 
-	usbnet_set_skb_tx_stats(skb, 1);
+	usbnet_set_skb_tx_stats(skb, 1, 0);
 	return skb;
 }
 
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 70cbea551139..c3e4da9e79ca 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1177,13 +1177,12 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
 	ctx->tx_overhead += skb_out->len - ctx->tx_curr_frame_payload;
 	ctx->tx_ntbs++;
 
-	/* usbnet has already counted all the framing overhead.
+	/* usbnet will count all the framing overhead by default.
 	 * Adjust the stats so that the tx_bytes counter show real
 	 * payload data instead.
 	 */
-	dev->net->stats.tx_bytes -= skb_out->len - ctx->tx_curr_frame_payload;
-
-	usbnet_set_skb_tx_stats(skb_out, n);
+	usbnet_set_skb_tx_stats(skb_out, n,
+				ctx->tx_curr_frame_payload - skb_out->len);
 
 	return skb_out;
 
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index 7650cdc8fe6b..953de13267df 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -144,7 +144,7 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
 		skb_put(skb, sizeof(padbytes));
 	}
 
-	usbnet_set_skb_tx_stats(skb, 1);
+	usbnet_set_skb_tx_stats(skb, 1, 0);
 	return skb;
 }
 
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3243b91c67b2..c5a2ad29d53c 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1322,9 +1322,19 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
 		} else
 			urb->transfer_flags |= URB_ZERO_PACKET;
 	}
-	entry->length = urb->transfer_buffer_length = length;
-	if (!(info->flags & FLAG_MULTI_PACKET))
-		usbnet_set_skb_tx_stats(skb, 1);
+	urb->transfer_buffer_length = length;
+
+	if (info->flags & FLAG_MULTI_PACKET) {
+		/* Driver has set number of packets and a length delta.
+		 * Calculate the complete length and ensure that it's
+		 * positive.
+		 */
+		entry->length += length;
+		if (WARN_ON_ONCE(entry->length <= 0))
+			entry->length = length;
+	} else {
+		usbnet_set_skb_tx_stats(skb, 1, length);
+	}
 
 	spin_lock_irqsave(&dev->txq.lock, flags);
 	retval = usb_autopm_get_interface_async(dev->intf);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 539eea72129c..36afcd9ca57d 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -220,7 +220,7 @@ struct skb_data {	/* skb->cb is one of these */
 	struct urb		*urb;
 	struct usbnet		*dev;
 	enum skb_state		state;
-	size_t			length;
+	long			length;
 	unsigned long		packets;
 };
 
@@ -228,11 +228,13 @@ struct skb_data {	/* skb->cb is one of these */
  * tx_fixup method before returning an skb.
  */
 static inline void
-usbnet_set_skb_tx_stats(struct sk_buff *skb, unsigned long packets)
+usbnet_set_skb_tx_stats(struct sk_buff *skb,
+			unsigned long packets, long bytes_delta)
 {
 	struct skb_data *entry = (struct skb_data *) skb->cb;
 
 	entry->packets = packets;
+	entry->length = bytes_delta;
 }
 
 extern int usbnet_open(struct net_device *net);

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

* [PATCH 3.16.y-ckt 011/180] bonding: Bonding Overriding Configuration logic restored.
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (9 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 010/180] usbnet: Fix tx_bytes statistic running backward in cdc_ncm Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 012/180] HID: add ALWAYS_POLL quirk for a Logitech 0xc007 Luis Henriques
                   ` (168 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Anton Nayshtut, Alexey Bogoslavsky, Andy Gospodarek,
	David S. Miller, Luis Henriques

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

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

From: Anton Nayshtut <anton@swortex.com>

commit f5e2dc5d7fe78fe4d8748d217338f4f7b6a5d7ea upstream.

Before commit 3900f29021f0bc7fe9815aa32f1a993b7dfdd402 ("bonding: slight
optimizztion for bond_slave_override()") the override logic was to send packets
with non-zero queue_id through the slave with corresponding queue_id, under two
conditions only - if the slave can transmit and it's up.

The above mentioned commit changed this logic by introducing an additional
condition - whether the bond is active (indirectly, using the slave_can_tx and
later - bond_is_active_slave), that prevents the user from implementing more
complex policies according to the Documentation/networking/bonding.txt.

Signed-off-by: Anton Nayshtut <anton@swortex.com>
Signed-off-by: Alexey Bogoslavsky <alexey@swortex.com>
Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/bonding/bond_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6c795cfd6bbc..14faf3ec7c7f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3763,7 +3763,8 @@ static inline int bond_slave_override(struct bonding *bond,
 	/* Find out if any slaves have the same mapping as this skb. */
 	bond_for_each_slave_rcu(bond, slave, iter) {
 		if (slave->queue_id == skb->queue_mapping) {
-			if (bond_slave_can_tx(slave)) {
+			if (bond_slave_is_up(slave) &&
+			    slave->link == BOND_LINK_UP) {
 				bond_dev_queue_xmit(bond, skb, slave->dev);
 				return 0;
 			}

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

* [PATCH 3.16.y-ckt 012/180] HID: add ALWAYS_POLL quirk for a Logitech 0xc007
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (10 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 011/180] bonding: Bonding Overriding Configuration logic restored Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 013/180] PCI/AER: Avoid info leak in __print_tlp_header() Luis Henriques
                   ` (167 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Jiri Kosina, Luis Henriques

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

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

From: "oliver@neukum.org" <oliver@neukum.org>

commit a415457733b5fa40bc996bf1f4df471cd98d3608 upstream.

This device disconnects every 60s without X

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 51a4d9bbbc9d..057ca39c029a 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -575,6 +575,7 @@
 
 #define USB_VENDOR_ID_LOGITECH		0x046d
 #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
+#define USB_DEVICE_ID_LOGITECH_C077	0xc007
 #define USB_DEVICE_ID_LOGITECH_RECEIVER	0xc101
 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST  0xc110
 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 913c9e0d2963..8c2f6cb90444 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -78,6 +78,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS },

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

* [PATCH 3.16.y-ckt 013/180] PCI/AER: Avoid info leak in __print_tlp_header()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (11 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 012/180] HID: add ALWAYS_POLL quirk for a Logitech 0xc007 Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 014/180] PCI: cpcihp: Add missing curly braces in cpci_configure_slot() Luis Henriques
                   ` (166 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rasmus Villemoes, Bjorn Helgaas, Luis Henriques

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

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

From: Rasmus Villemoes <linux@rasmusvillemoes.dk>

commit a1b7f2f6367944d445c6853035830a35c6343939 upstream.

Commit fab4c256a58b ("PCI/AER: Add a TLP header print helper") introduced
the helper function __print_tlp_header(), but contrary to the intention,
the behaviour did change: Since we're taking the address of the parameter
t, the first 4 or 8 bytes printed will be the value of the pointer t
itself, and the remaining 12 or 8 bytes will be who-knows-what (something
from the stack).

We want to show the values of the four members of the struct
aer_header_log_regs; that can be done without ugly and error-prone casts.
On little-endian this should produce the same output as originally
intended, and since no-one has complained about getting garbage output so
far, I think big-endian should be ok too.

Fixes: fab4c256a58b ("PCI/AER: Add a TLP header print helper")
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pci/pcie/aer/aerdrv_errprint.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
index 36ed31b52198..3f893dd8fa89 100644
--- a/drivers/pci/pcie/aer/aerdrv_errprint.c
+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
@@ -127,16 +127,8 @@ static const char *aer_agent_string[] = {
 static void __print_tlp_header(struct pci_dev *dev,
 			       struct aer_header_log_regs *t)
 {
-	unsigned char *tlp = (unsigned char *)&t;
-
-	dev_err(&dev->dev, "  TLP Header:"
-		" %02x%02x%02x%02x %02x%02x%02x%02x"
-		" %02x%02x%02x%02x %02x%02x%02x%02x\n",
-		*(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
-		*(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
-		*(tlp + 11), *(tlp + 10), *(tlp + 9),
-		*(tlp + 8), *(tlp + 15), *(tlp + 14),
-		*(tlp + 13), *(tlp + 12));
+	dev_err(&dev->dev, "  TLP Header: %08x %08x %08x %08x\n",
+		t->dw0, t->dw1, t->dw2, t->dw3);
 }
 
 static void __aer_print_error(struct pci_dev *dev,

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

* [PATCH 3.16.y-ckt 014/180] PCI: cpcihp: Add missing curly braces in cpci_configure_slot()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (12 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 013/180] PCI/AER: Avoid info leak in __print_tlp_header() Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 015/180] [media] sh_veu: v4l2_dev wasn't set Luis Henriques
                   ` (165 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Bjorn Helgaas, Luis Henriques

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

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

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

commit bc3b5b47c80da8838758731d423179262c9c36ec upstream.

I don't have this hardware but it looks like we weren't adding bridge
devices as intended.  Maybe the bridge is always the last device?

Fixes: 05b125004815 ("PCI: cpcihp: Iterate over all devices in slot, not functions 0-7")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pci/hotplug/cpci_hotplug_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 7d48ecae6695..788db48dbbad 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -286,11 +286,12 @@ int cpci_configure_slot(struct slot *slot)
 	}
 	parent = slot->dev->bus;
 
-	list_for_each_entry(dev, &parent->devices, bus_list)
+	list_for_each_entry(dev, &parent->devices, bus_list) {
 		if (PCI_SLOT(dev->devfn) != PCI_SLOT(slot->devfn))
 			continue;
 		if (pci_is_bridge(dev))
 			pci_hp_add_bridge(dev);
+	}
 
 
 	pci_assign_unassigned_bridge_resources(parent->self);

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

* [PATCH 3.16.y-ckt 015/180] [media] sh_veu: v4l2_dev wasn't set
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (13 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 014/180] PCI: cpcihp: Add missing curly braces in cpci_configure_slot() Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 016/180] [media] media: s5p-mfc: fix mmap support for 64bit arch Luis Henriques
                   ` (164 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans Verkuil, Mauro Carvalho Chehab, Luis Henriques

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

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

From: Hans Verkuil <hverkuil@xs4all.nl>

commit ab3120300be067a2d41a027c41db0b2c662ab200 upstream.

The v4l2_dev field of struct video_device must be set correctly.
This was never done for this driver, so no video nodes were created
anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/media/platform/sh_veu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c
index 744e43b480bc..f698e322a1cd 100644
--- a/drivers/media/platform/sh_veu.c
+++ b/drivers/media/platform/sh_veu.c
@@ -1183,6 +1183,7 @@ static int sh_veu_probe(struct platform_device *pdev)
 	}
 
 	*vdev = sh_veu_videodev;
+	vdev->v4l2_dev = &veu->v4l2_dev;
 	spin_lock_init(&veu->lock);
 	mutex_init(&veu->fop_lock);
 	vdev->lock = &veu->fop_lock;

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

* [PATCH 3.16.y-ckt 016/180] [media] media: s5p-mfc: fix mmap support for 64bit arch
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (14 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 015/180] [media] sh_veu: v4l2_dev wasn't set Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 017/180] cpufreq: Schedule work for the first-online CPU on resume Luis Henriques
                   ` (163 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Szyprowski, Kamil Debski, Mauro Carvalho Chehab, Luis Henriques

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

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

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit 05b676ab42f624425d5f6519276e506b812fa058 upstream.

TASK_SIZE is depends on the systems architecture (32 or 64 bits) and it
should not be used for defining offset boundary for mmaping buffers for
CAPTURE and OUTPUT queues. This patch fixes support for MMAP calls on
the CAPTURE queue on 64bit architectures (like ARM64).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index b04360cd34f0..d45779798d65 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -29,7 +29,7 @@
 
 /* Offset base used to differentiate between CAPTURE and OUTPUT
 *  while mmaping */
-#define DST_QUEUE_OFF_BASE      (TASK_SIZE / 2)
+#define DST_QUEUE_OFF_BASE	(1 << 30)
 
 #define MFC_BANK1_ALLOC_CTX	0
 #define MFC_BANK2_ALLOC_CTX	1

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

* [PATCH 3.16.y-ckt 017/180] cpufreq: Schedule work for the first-online CPU on resume
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (15 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 016/180] [media] media: s5p-mfc: fix mmap support for 64bit arch Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 018/180] cpuidle: remove state_count field from struct cpuidle_device Luis Henriques
                   ` (162 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Viresh Kumar, Rafael J. Wysocki, Luis Henriques

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

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

From: Viresh Kumar <viresh.kumar@linaro.org>

commit c75de0ac0756d4b442f460e10461720c7c2412c2 upstream.

All CPUs leaving the first-online CPU are hotplugged out on suspend and
and cpufreq core stops managing them.

On resume, we need to call cpufreq_update_policy() for this CPU's policy
to make sure its frequency is in sync with cpufreq's cached value, as it
might have got updated by hardware during suspend/resume.

The policies are always added to the top of the policy-list. So, in
normal circumstances, CPU 0's policy will be the last one in the list.
And so the code checks for the last policy.

But there are cases where it will fail. Consider quad-core system, with
policy-per core. If CPU0 is hotplugged out and added back again, the
last policy will be on CPU1 :(

To fix this in a proper way, always look for the policy of the first
online CPU. That way we will be sure that we are calling
cpufreq_update_policy() for the only CPU that wasn't hotplugged out.

Fixes: 2f0aea936360 ("cpufreq: suspend governors on system suspend/hibernate")
Reported-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/cpufreq/cpufreq.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index f1c5e49ece97..8afa0a96f9dd 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1725,15 +1725,18 @@ void cpufreq_resume(void)
 		    || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))
 			pr_err("%s: Failed to start governor for policy: %p\n",
 				__func__, policy);
-
-		/*
-		 * schedule call cpufreq_update_policy() for boot CPU, i.e. last
-		 * policy in list. It will verify that the current freq is in
-		 * sync with what we believe it to be.
-		 */
-		if (list_is_last(&policy->policy_list, &cpufreq_policy_list))
-			schedule_work(&policy->update);
 	}
+
+	/*
+	 * schedule call cpufreq_update_policy() for first-online CPU, as that
+	 * wouldn't be hotplugged-out on suspend. It will verify that the
+	 * current freq is in sync with what we believe it to be.
+	 */
+	policy = cpufreq_cpu_get_raw(cpumask_first(cpu_online_mask));
+	if (WARN_ON(!policy))
+		return;
+
+	schedule_work(&policy->update);
 }
 
 /**

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

* [PATCH 3.16.y-ckt 018/180] cpuidle: remove state_count field from struct cpuidle_device
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (16 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 017/180] cpufreq: Schedule work for the first-online CPU on resume Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 019/180] cpuidle: ACPI: do not overwrite name and description of C0 Luis Henriques
                   ` (161 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bartlomiej Zolnierkiewicz, Kyungmin Park, Rafael J. Wysocki,
	Luis Henriques

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

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

From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

commit d75e4af14e228bbe3f86e29bcecb8e6be98d4e04 upstream.

Thomas Schlichter reports the following issue on his Samsung NC20:

"The C-states C1 and C2 to the OS when connected to AC, and additionally
 provides the C3 C-state when disconnected from AC.  However, the number
 of C-states shown in sysfs is fixed to the number of C-states present
 at boot.
   If I boot with AC connected, I always only see the C-states up to C2
   even if I disconnect AC.

   The reason is commit 130a5f692425 (ACPI / cpuidle: remove dev->state_count
   setting).  It removes the update of dev->state_count, but sysfs uses
   exactly this variable to show the C-states.

   The fix is to use drv->state_count in sysfs.  As this is currently the
   last user of dev->state_count, this variable can be completely removed."

Remove dev->state_count as per the above.

Reported-by: Thomas Schlichter <thomas.schlichter@web.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/cpuidle/cpuidle.c | 3 ---
 drivers/cpuidle/sysfs.c   | 5 +++--
 include/linux/cpuidle.h   | 1 -
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index cb7019977c50..d3185606473a 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -289,9 +289,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 	if (!dev->registered)
 		return -EINVAL;
 
-	if (!dev->state_count)
-		dev->state_count = drv->state_count;
-
 	ret = cpuidle_add_device_sysfs(dev);
 	if (ret)
 		return ret;
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index efe2f175168f..3368c50ef0ea 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -401,7 +401,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
 	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
 
 	/* state statistics */
-	for (i = 0; i < device->state_count; i++) {
+	for (i = 0; i < drv->state_count; i++) {
 		kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL);
 		if (!kobj)
 			goto error_state;
@@ -433,9 +433,10 @@ error_state:
  */
 static void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
 {
+	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
 	int i;
 
-	for (i = 0; i < device->state_count; i++)
+	for (i = 0; i < drv->state_count; i++)
 		cpuidle_free_state_kobj(device, i);
 }
 
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 25e0df6155a4..575b7166cb08 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -69,7 +69,6 @@ struct cpuidle_device {
 	unsigned int		cpu;
 
 	int			last_residency;
-	int			state_count;
 	struct cpuidle_state_usage	states_usage[CPUIDLE_STATE_MAX];
 	struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
 	struct cpuidle_driver_kobj *kobj_driver;

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

* [PATCH 3.16.y-ckt 019/180] cpuidle: ACPI: do not overwrite name and description of C0
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (17 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 018/180] cpuidle: remove state_count field from struct cpuidle_device Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 020/180] ioctx_alloc(): fix vma (and file) leak on failure Luis Henriques
                   ` (160 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Schlichter, Rafael J. Wysocki, Luis Henriques

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

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

From: Thomas Schlichter <thomas.schlichter@web.de>

commit c7e8bdf5872c5a8f5a6494e16fe839c38a0d3d3d upstream.

Fix a bug that leads to showing the name and description of C-state C0
as "<null>" in sysfs after the ACPI C-states changed (e.g. after AC->DC
or DC->AC
transition).

The function poll_idle_init() in drivers/cpuidle/driver.c initializes the
state 0 during cpuidle_register_driver(), so we better do not overwrite it
again with '\0' during acpi_processor_cst_has_changed().

Signed-off-by: Thomas Schlichter <thomas.schlichter@web.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/processor_idle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 17f9ec501972..fd8496a92b45 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -962,7 +962,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
 		return -EINVAL;
 
 	drv->safe_state_index = -1;
-	for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
+	for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++) {
 		drv->states[i].name[0] = '\0';
 		drv->states[i].desc[0] = '\0';
 	}

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

* [PATCH 3.16.y-ckt 020/180] ioctx_alloc(): fix vma (and file) leak on failure
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (18 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 019/180] cpuidle: ACPI: do not overwrite name and description of C0 Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 021/180] drm/i915/vlv: save/restore the power context base reg Luis Henriques
                   ` (159 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Luis Henriques

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit deeb8525f9bcea60f5e86521880c1161de7a5829 upstream.

If we fail past the aio_setup_ring(), we need to destroy the
mapping.  We don't need to care about anybody having found ctx,
or added requests to it, since the last failure exit is exactly
the failure to make ctx visible to lookups.

Reproducer (based on one by Joe Mario <jmario@redhat.com>):

void count(char *p)
{
	char s[80];
	printf("%s: ", p);
	fflush(stdout);
	sprintf(s, "/bin/cat /proc/%d/maps|/bin/fgrep -c '/[aio] (deleted)'", getpid());
	system(s);
}

int main()
{
	io_context_t *ctx;
	int created, limit, i, destroyed;
	FILE *f;

	count("before");
	if ((f = fopen("/proc/sys/fs/aio-max-nr", "r")) == NULL)
		perror("opening aio-max-nr");
	else if (fscanf(f, "%d", &limit) != 1)
		fprintf(stderr, "can't parse aio-max-nr\n");
	else if ((ctx = calloc(limit, sizeof(io_context_t))) == NULL)
		perror("allocating aio_context_t array");
	else {
		for (i = 0, created = 0; i < limit; i++) {
			if (io_setup(1000, ctx + created) == 0)
				created++;
		}
		for (i = 0, destroyed = 0; i < created; i++)
			if (io_destroy(ctx[i]) == 0)
				destroyed++;
		printf("created %d, failed %d, destroyed %d\n",
			created, limit - created, destroyed);
		count("after");
	}
}

Found-by: Joe Mario <jmario@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/aio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/aio.c b/fs/aio.c
index b645387b6d57..a6f86dae34be 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -719,6 +719,9 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
 err_cleanup:
 	aio_nr_sub(ctx->max_reqs);
 err_ctx:
+	atomic_set(&ctx->dead, 1);
+	if (ctx->mmap_size)
+		vm_munmap(ctx->mmap_base, ctx->mmap_size);
 	aio_free_ring(ctx);
 err:
 	mutex_unlock(&ctx->ring_lock);

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

* [PATCH 3.16.y-ckt 021/180] drm/i915/vlv: save/restore the power context base reg
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (19 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 020/180] ioctx_alloc(): fix vma (and file) leak on failure Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 022/180] drm/i915/chv: Remove Wait for a previous gfx force-off Luis Henriques
                   ` (158 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jesse Barnes, Jani Nikula, Luis Henriques

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

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

From: Jesse Barnes <jbarnes@virtuousgeek.org>

commit 9c25210fd30991e68f93e2ec0857de2d967b5766 upstream.

Some BIOSes (e.g. the one on the Minnowboard) don't save/restore this
reg.  If it's unlocked, we can just restore the previous value, and if
it's locked (in case the BIOS re-programmed it for us) the write will be
ignored and we'll still have "did it move" sanity check in the PM code to
warn us if something is still amiss.

References: https://bugs.freedesktop.org/show_bug.cgi?id=89611
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Deepak S <deepak.s@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 2 ++
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index e35e32f33e31..a458e8393378 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1071,6 +1071,7 @@ static void vlv_save_gunit_s0ix_state(struct drm_i915_private *dev_priv)
 	/* Gunit-Display CZ domain, 0x182028-0x1821CF */
 	s->gu_ctl0		= I915_READ(VLV_GU_CTL0);
 	s->gu_ctl1		= I915_READ(VLV_GU_CTL1);
+	s->pcbr			= I915_READ(VLV_PCBR);
 	s->clock_gate_dis2	= I915_READ(VLV_GUNIT_CLOCK_GATE2);
 
 	/*
@@ -1165,6 +1166,7 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *dev_priv)
 	/* Gunit-Display CZ domain, 0x182028-0x1821CF */
 	I915_WRITE(VLV_GU_CTL0,			s->gu_ctl0);
 	I915_WRITE(VLV_GU_CTL1,			s->gu_ctl1);
+	I915_WRITE(VLV_PCBR,			s->pcbr);
 	I915_WRITE(VLV_GUNIT_CLOCK_GATE2,	s->clock_gate_dis2);
 }
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 09501070d7cd..28c7afdfffbc 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -878,6 +878,7 @@ struct vlv_s0ix_state {
 	/* Display 2 CZ domain */
 	u32 gu_ctl0;
 	u32 gu_ctl1;
+	u32 pcbr;
 	u32 clock_gate_dis2;
 };
 

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

* [PATCH 3.16.y-ckt 022/180] drm/i915/chv: Remove Wait for a previous gfx force-off
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (20 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 021/180] drm/i915/vlv: save/restore the power context base reg Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 023/180] drm/i915/vlv: remove wait for previous GFX clk disable request Luis Henriques
                   ` (157 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Deepak S, Daniel Vetter, Jani Nikula, Luis Henriques

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

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

From: Deepak S <deepak.s@linux.intel.com>

commit c9c52e24194a741f9fca96e7aa965f0fa36af504 upstream.

On CHV, PUNIT team confirmed that 'VLV_GFX_CLK_STATUS_BIT' is not a
sticky bit and it will always be set. So ignore Check for previous
Gfx force off during suspend and allow the force clk as part S0ix
Sequence

Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index a458e8393378..7a0fc58d372e 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1176,11 +1176,13 @@ int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool force_on)
 	int err;
 
 	val = I915_READ(VLV_GTLC_SURVIVABILITY_REG);
-	WARN_ON(!!(val & VLV_GFX_CLK_FORCE_ON_BIT) == force_on);
 
 #define COND (I915_READ(VLV_GTLC_SURVIVABILITY_REG) & VLV_GFX_CLK_STATUS_BIT)
 	/* Wait for a previous force-off to settle */
-	if (force_on) {
+	if (force_on && !IS_CHERRYVIEW(dev_priv->dev)) {
+		/* WARN_ON only for the Valleyview */
+		WARN_ON(!!(val & VLV_GFX_CLK_FORCE_ON_BIT) == force_on);
+
 		err = wait_for(!COND, 20);
 		if (err) {
 			DRM_ERROR("timeout waiting for GFX clock force-off (%08x)\n",

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

* [PATCH 3.16.y-ckt 023/180] drm/i915/vlv: remove wait for previous GFX clk disable request
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (21 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 022/180] drm/i915/chv: Remove Wait for a previous gfx force-off Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 024/180] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Luis Henriques
                   ` (156 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jesse Barnes, Jani Nikula, Luis Henriques

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

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

From: Jesse Barnes <jbarnes@virtuousgeek.org>

commit 5df0582bf036bb5f9a8ad8db5884fe13a55347d1 upstream.

Looks like it was introduced in:

commit 650ad970a39f8b6164fe8613edc150f585315289
Author: Imre Deak <imre.deak@intel.com>
Date:   Fri Apr 18 16:35:02 2014 +0300

    drm/i915: vlv: factor out vlv_force_gfx_clock and check for pending force-of

but I'm not sure why.  It has caused problems for us in the past (see
85250ddff7a6 "drm/i915/chv: Remove Wait for a previous gfx force-off"
and 8d4eee9cd7a1 "drm/i915: vlv: increase timeout when forcing on the
GFX clock") and doesn't seem to be required, so let's just drop it.

References: https://bugs.freedesktop.org/show_bug.cgi?id=89611
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Reviewed-by: Deepak S <deepak.s@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 7a0fc58d372e..caef2e1774b3 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1175,21 +1175,7 @@ int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool force_on)
 	u32 val;
 	int err;
 
-	val = I915_READ(VLV_GTLC_SURVIVABILITY_REG);
-
 #define COND (I915_READ(VLV_GTLC_SURVIVABILITY_REG) & VLV_GFX_CLK_STATUS_BIT)
-	/* Wait for a previous force-off to settle */
-	if (force_on && !IS_CHERRYVIEW(dev_priv->dev)) {
-		/* WARN_ON only for the Valleyview */
-		WARN_ON(!!(val & VLV_GFX_CLK_FORCE_ON_BIT) == force_on);
-
-		err = wait_for(!COND, 20);
-		if (err) {
-			DRM_ERROR("timeout waiting for GFX clock force-off (%08x)\n",
-				  I915_READ(VLV_GTLC_SURVIVABILITY_REG));
-			return err;
-		}
-	}
 
 	val = I915_READ(VLV_GTLC_SURVIVABILITY_REG);
 	val &= ~VLV_GFX_CLK_FORCE_ON_BIT;

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

* [PATCH 3.16.y-ckt 024/180] ALSA: hda/realtek - Make more stable to get pin sense for ALC283
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (22 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 023/180] drm/i915/vlv: remove wait for previous GFX clk disable request Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 025/180] ALSA: bebob: fix to processing in big-endian machine for sending cue Luis Henriques
                   ` (155 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kailang Yang, Takashi Iwai, Luis Henriques

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

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

From: Kailang Yang <kailang@realtek.com>

commit a59d7199f62b8336570972dcc288321d0ec999fe upstream.

Pin sense will active when power pin is wake up.
Power pin will not wake up immediately during resume state.
Add some delay to wait for power pin activated.

Signed-off-by: Kailang Yang <kailang@realtek.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, 2 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4a6d7a0ee242..fc102967a74c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3057,6 +3057,8 @@ static void alc283_init(struct hda_codec *codec)
 
 	if (!hp_pin)
 		return;
+
+	msleep(30);
 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
 
 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */

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

* [PATCH 3.16.y-ckt 025/180] ALSA: bebob: fix to processing in big-endian machine for sending cue
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (23 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 024/180] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 026/180] be2iscsi: Fix kernel panic when device initialization fails Luis Henriques
                   ` (154 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takayuki Shiroma, Takashi Sakamoto, Takashi Iwai, Luis Henriques

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

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

From: Takashi Sakamoto <o-takashi@sakamocchi.jp>

commit a053fc318bc5d28cd25168c948255fd48a29ea26 upstream.

Some M-Audio devices require to receive bootup command just after
powering on, while codes in BeBoB driver doesn't work properly in
big-endian machine because the command should be aligned by
little-endian.

This commit fixes this bug. This fix should go to stable kernel.

Cc: Takayuki Shiroma <t.shiroma.oki@gmail.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/firewire/bebob/bebob_maudio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
index 70faa3a32526..0215a9194d88 100644
--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -96,10 +96,10 @@ int snd_bebob_maudio_load_firmware(struct fw_unit *unit)
 	struct fw_device *device = fw_parent_device(unit);
 	int err, rcode;
 	u64 date;
-	__be32 cues[3] = {
-		MAUDIO_BOOTLOADER_CUE1,
-		MAUDIO_BOOTLOADER_CUE2,
-		MAUDIO_BOOTLOADER_CUE3
+	__le32 cues[3] = {
+		cpu_to_le32(MAUDIO_BOOTLOADER_CUE1),
+		cpu_to_le32(MAUDIO_BOOTLOADER_CUE2),
+		cpu_to_le32(MAUDIO_BOOTLOADER_CUE3)
 	};
 
 	/* check date of software used to build */

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

* [PATCH 3.16.y-ckt 026/180] be2iscsi: Fix kernel panic when device initialization fails
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (24 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 025/180] ALSA: bebob: fix to processing in big-endian machine for sending cue Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 027/180] Defer processing of REQ_PREEMPT requests for blocked devices Luis Henriques
                   ` (153 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: John Soni Jose, James Bottomley, Luis Henriques

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

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

From: John Soni Jose <sony.john-n@emulex.com>

commit 2e7cee027b26cbe7e6685a7a14bd2850bfe55d33 upstream.

Kernel panic was happening as iscsi_host_remove() was called on
a host which was not yet added.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index f7e9c531cc26..5d13d109d9a2 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5707,9 +5707,9 @@ free_port:
 hba_free:
 	if (phba->msix_enabled)
 		pci_disable_msix(phba->pcidev);
-	iscsi_host_remove(phba->shost);
 	pci_dev_put(phba->pcidev);
 	iscsi_host_free(phba->shost);
+	pci_set_drvdata(pcidev, NULL);
 disable_pci:
 	pci_disable_device(pcidev);
 	return ret;

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

* [PATCH 3.16.y-ckt 027/180] Defer processing of REQ_PREEMPT requests for blocked devices
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (25 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 026/180] be2iscsi: Fix kernel panic when device initialization fails Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 028/180] ALSA: hda - Fix headphone pin config for Lifebook T731 Luis Henriques
                   ` (152 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bart Van Assche, James Bottomley, Luis Henriques

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

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

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

commit bba0bdd7ad4713d82338bcd9b72d57e9335a664b upstream.

SCSI transport drivers and SCSI LLDs block a SCSI device if the
transport layer is not operational. This means that in this state
no requests should be processed, even if the REQ_PREEMPT flag has
been set. This patch avoids that a rescan shortly after a cable
pull sporadically triggers the following kernel oops:

BUG: unable to handle kernel paging request at ffffc9001a6bc084
IP: [<ffffffffa04e08f2>] mlx4_ib_post_send+0xd2/0xb30 [mlx4_ib]
Process rescan-scsi-bus (pid: 9241, threadinfo ffff88053484a000, task ffff880534aae100)
Call Trace:
 [<ffffffffa0718135>] srp_post_send+0x65/0x70 [ib_srp]
 [<ffffffffa071b9df>] srp_queuecommand+0x1cf/0x3e0 [ib_srp]
 [<ffffffffa0001ff1>] scsi_dispatch_cmd+0x101/0x280 [scsi_mod]
 [<ffffffffa0009ad1>] scsi_request_fn+0x411/0x4d0 [scsi_mod]
 [<ffffffff81223b37>] __blk_run_queue+0x27/0x30
 [<ffffffff8122a8d2>] blk_execute_rq_nowait+0x82/0x110
 [<ffffffff8122a9c2>] blk_execute_rq+0x62/0xf0
 [<ffffffffa000b0e8>] scsi_execute+0xe8/0x190 [scsi_mod]
 [<ffffffffa000b2f3>] scsi_execute_req+0xa3/0x130 [scsi_mod]
 [<ffffffffa000c1aa>] scsi_probe_lun+0x17a/0x450 [scsi_mod]
 [<ffffffffa000ce86>] scsi_probe_and_add_lun+0x156/0x480 [scsi_mod]
 [<ffffffffa000dc2f>] __scsi_scan_target+0xdf/0x1f0 [scsi_mod]
 [<ffffffffa000dfa3>] scsi_scan_host_selected+0x183/0x1c0 [scsi_mod]
 [<ffffffffa000edfb>] scsi_scan+0xdb/0xe0 [scsi_mod]
 [<ffffffffa000ee13>] store_scan+0x13/0x20 [scsi_mod]
 [<ffffffff811c8d9b>] sysfs_write_file+0xcb/0x160
 [<ffffffff811589de>] vfs_write+0xce/0x140
 [<ffffffff81158b53>] sys_write+0x53/0xa0
 [<ffffffff81464592>] system_call_fastpath+0x16/0x1b
 [<00007f611c9d9300>] 0x7f611c9d92ff

Reported-by: Max Gurtuvoy <maxg@mellanox.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/scsi_lib.c   | 4 +++-
 include/linux/blk_types.h | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3f50dfcb3227..d7062a06f72e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1172,9 +1172,11 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
 				    "rejecting I/O to dead device\n");
 			ret = BLKPREP_KILL;
 			break;
-		case SDEV_QUIESCE:
 		case SDEV_BLOCK:
 		case SDEV_CREATED_BLOCK:
+			ret = BLKPREP_DEFER;
+			break;
+		case SDEV_QUIESCE:
 			/*
 			 * If the devices is blocked we defer normal commands.
 			 */
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 66c2167f04a9..37ac4b1ed28f 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -180,7 +180,9 @@ enum rq_flag_bits {
 	__REQ_ELVPRIV,		/* elevator private data attached */
 	__REQ_FAILED,		/* set if the request failed */
 	__REQ_QUIET,		/* don't worry about errors */
-	__REQ_PREEMPT,		/* set for "ide_preempt" requests */
+	__REQ_PREEMPT,		/* set for "ide_preempt" requests and also
+				   for requests for which the SCSI "quiesce"
+				   state must be ignored. */
 	__REQ_ALLOCED,		/* request came from our alloc pool */
 	__REQ_COPY_USER,	/* contains copies of user pages */
 	__REQ_FLUSH_SEQ,	/* request for flush sequence */

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

* [PATCH 3.16.y-ckt 028/180] ALSA: hda - Fix headphone pin config for Lifebook T731
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (26 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 027/180] Defer processing of REQ_PREEMPT requests for blocked devices Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 029/180] ocfs2: _really_ sync the right range Luis Henriques
                   ` (151 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit cc7016ab1a22fb26f388c2fb2b692b89897cbc3e upstream.

Some BIOS version of Fujitsu Lifebook T731 seems to set up the
headphone pin (0x21) without the assoc number 0x0f while it's set only
to the output on the docking port (0x1a).  With the recent commit
[03ad6a8c93b6: ALSA: hda - Fix "PCM" name being used on one DAC when
 there are two DACs], this resulted in the weird mixer element
mapping where the headphone on the laptop is assigned as a shared
volume with the speaker and the docking port is assigned as an
individual headphone.

This patch improves the situation by correcting the headphone pin
config to the more appropriate value.

Reported-and-tested-by: Taylor Smock <smocktaylor@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fc102967a74c..0b179484014d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4267,6 +4267,7 @@ enum {
 	ALC269_FIXUP_QUANTA_MUTE,
 	ALC269_FIXUP_LIFEBOOK,
 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
+	ALC269_FIXUP_LIFEBOOK_HP_PIN,
 	ALC269_FIXUP_AMIC,
 	ALC269_FIXUP_DMIC,
 	ALC269VB_FIXUP_AMIC,
@@ -4411,6 +4412,13 @@ static const struct hda_fixup alc269_fixups[] = {
 			{ }
 		},
 	},
+	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x21, 0x0221102f }, /* HP out */
+			{ }
+		},
+	},
 	[ALC269_FIXUP_AMIC] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
@@ -4870,6 +4878,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
+	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),

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

* [PATCH 3.16.y-ckt 029/180] ocfs2: _really_ sync the right range
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (27 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 028/180] ALSA: hda - Fix headphone pin config for Lifebook T731 Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 030/180] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Luis Henriques
                   ` (150 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Luis Henriques

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 64b4e2526d1cf6e6a4db6213d6e2b6e6ab59479a upstream.

"ocfs2 syncs the wrong range" had been broken; prior to it the
code was doing the wrong thing in case of O_APPEND, all right,
but _after_ it we were syncing the wrong range in 100% cases.
*ppos, aka iocb->ki_pos is incremented prior to that point,
so we are always doing sync on the area _after_ the one we'd
written to.

Spotted by Joseph Qi <joseph.qi@huawei.com> back in January;
unfortunately, I'd missed his mail back then ;-/

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ocfs2/file.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 2930e231f3f9..fd106d136983 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2375,10 +2375,14 @@ out_dio:
 	/* buffered aio wouldn't have proper lock coverage today */
 	BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
 
+	if (unlikely(written <= 0))
+		goto no_sync;
+
 	if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) ||
 	    ((file->f_flags & O_DIRECT) && !direct_io)) {
-		ret = filemap_fdatawrite_range(file->f_mapping, *ppos,
-					       *ppos + count - 1);
+		ret = filemap_fdatawrite_range(file->f_mapping,
+					       iocb->ki_pos - written,
+					       iocb->ki_pos - 1);
 		if (ret < 0)
 			written = ret;
 
@@ -2391,10 +2395,12 @@ out_dio:
 		}
 
 		if (!ret)
-			ret = filemap_fdatawait_range(file->f_mapping, *ppos,
-						      *ppos + count - 1);
+			ret = filemap_fdatawait_range(file->f_mapping,
+						      iocb->ki_pos - written,
+						      iocb->ki_pos - 1);
 	}
 
+no_sync:
 	/*
 	 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
 	 * function pointer which is called when o_direct io completes so that

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

* [PATCH 3.16.y-ckt 030/180] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (28 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 029/180] ocfs2: _really_ sync the right range Luis Henriques
@ 2015-05-07  9:43 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 031/180] iscsi target: fix oops when adding reject pdu Luis Henriques
                   ` (149 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:43 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry M. Fedin, Takashi Iwai, Luis Henriques

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

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

From: "Dmitry M. Fedin" <dmitry.fedin@gmail.com>

commit 3dc8523fa7412e731441c01fb33f003eb3cfece1 upstream.

Adds an entry for Creative USB X-Fi to the rc_config array in
mixer_quirks.c to allow use of volume knob on the device.
Adds support for newer X-Fi Pro card, known as "Model No. SB1095"
with USB ID "041e:3237"

Signed-off-by: Dmitry M. Fedin <dmitry.fedin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/usb/mixer_quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 7c83bab69dee..9484d02d5f2c 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -178,6 +178,7 @@ static const struct rc_config {
 	{ USB_ID(0x041e, 0x3040), 2, 2, 6, 6,  2,  0x6e91 }, /* Live! 24-bit */
 	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 */
 	{ USB_ID(0x041e, 0x30df), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 Pro */
+	{ USB_ID(0x041e, 0x3237), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 Pro */
 	{ USB_ID(0x041e, 0x3048), 2, 2, 6, 6,  2,  0x6e91 }, /* Toshiba SB0500 */
 };
 

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

* [PATCH 3.16.y-ckt 031/180] iscsi target: fix oops when adding reject pdu
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (29 preceding siblings ...)
  2015-05-07  9:43 ` [PATCH 3.16.y-ckt 030/180] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 032/180] ext4: fix indirect punch hole corruption Luis Henriques
                   ` (148 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mike Christie, Nicholas Bellinger, Luis Henriques

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

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

From: Mike Christie <michaelc@cs.wisc.edu>

commit b815fc12d4dd2b5586184fb4f867caff05a810d4 upstream.

This fixes a oops due to a double list add when adding a reject PDU for
iscsit_allocate_iovecs allocation failures. The cmd has already been
added to the conn_cmd_list in iscsit_setup_scsi_cmd, so this has us call
iscsit_reject_cmd.

Note that for ERL0 the reject PDU is not actually sent, so this patch
is not completely tested. Just verified we do not oops. The problem is the
add reject functions return -1 which is returned all the way up to
iscsi_target_rx_thread which for ERL0 will drop the connection.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/iscsi/iscsi_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 209eb58b5d3a..ef91651a3714 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1184,7 +1184,7 @@ iscsit_handle_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	 * traditional iSCSI block I/O.
 	 */
 	if (iscsit_allocate_iovecs(cmd) < 0) {
-		return iscsit_add_reject_cmd(cmd,
+		return iscsit_reject_cmd(cmd,
 				ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf);
 	}
 	immed_data = cmd->immediate_data;

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

* [PATCH 3.16.y-ckt 032/180] ext4: fix indirect punch hole corruption
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (30 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 031/180] iscsi target: fix oops when adding reject pdu Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 033/180] fs: take i_mutex during prepare_binprm for set[ug]id executables Luis Henriques
                   ` (147 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Omar Sandoval, Luis Henriques

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

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

From: Omar Sandoval <osandov@osandov.com>

commit 6f30b7e37a8239f9d27db626a1d3427bc7951908 upstream.

Commit 4f579ae7de56 (ext4: fix punch hole on files with indirect
mapping) rewrote FALLOC_FL_PUNCH_HOLE for ext4 files with indirect
mapping. However, there are bugs in several corner cases. This fixes 5
distinct bugs:

1. When there is at least one entire level of indirection between the
start and end of the punch range and the end of the punch range is the
first block of its level, we can't return early; we have to free the
intervening levels.

2. When the end is at a higher level of indirection than the start and
ext4_find_shared returns a top branch for the end, we still need to free
the rest of the shared branch it returns; we can't decrement partial2.

3. When a punch happens within one level of indirection, we need to
converge on an indirect block that contains the start and end. However,
because the branches returned from ext4_find_shared do not necessarily
start at the same level (e.g., the partial2 chain will be shallower if
the last block occurs at the beginning of an indirect group), the walk
of the two chains can end up "missing" each other and freeing a bunch of
extra blocks in the process. This mismatch can be handled by first
making sure that the chains are at the same level, then walking them
together until they converge.

4. When the punch happens within one level of indirection and
ext4_find_shared returns a top branch for the start, we must free it,
but only if the end does not occur within that branch.

5. When the punch happens within one level of indirection and
ext4_find_shared returns a top branch for the end, then we shouldn't
free the block referenced by the end of the returned chain (this mirrors
the different levels case).

Signed-off-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/indirect.c | 105 ++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 71 insertions(+), 34 deletions(-)

diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index e75f840000a0..944c49dd83e3 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -1395,10 +1395,7 @@ end_range:
 				 * to free. Everything was covered by the start
 				 * of the range.
 				 */
-				return 0;
-			} else {
-				/* Shared branch grows from an indirect block */
-				partial2--;
+				goto do_indirects;
 			}
 		} else {
 			/*
@@ -1429,56 +1426,96 @@ end_range:
 	/* Punch happened within the same level (n == n2) */
 	partial = ext4_find_shared(inode, n, offsets, chain, &nr);
 	partial2 = ext4_find_shared(inode, n2, offsets2, chain2, &nr2);
-	/*
-	 * ext4_find_shared returns Indirect structure which
-	 * points to the last element which should not be
-	 * removed by truncate. But this is end of the range
-	 * in punch_hole so we need to point to the next element
-	 */
-	partial2->p++;
-	while ((partial > chain) || (partial2 > chain2)) {
-		/* We're at the same block, so we're almost finished */
-		if ((partial->bh && partial2->bh) &&
-		    (partial->bh->b_blocknr == partial2->bh->b_blocknr)) {
-			if ((partial > chain) && (partial2 > chain2)) {
+
+	/* Free top, but only if partial2 isn't its subtree. */
+	if (nr) {
+		int level = min(partial - chain, partial2 - chain2);
+		int i;
+		int subtree = 1;
+
+		for (i = 0; i <= level; i++) {
+			if (offsets[i] != offsets2[i]) {
+				subtree = 0;
+				break;
+			}
+		}
+
+		if (!subtree) {
+			if (partial == chain) {
+				/* Shared branch grows from the inode */
+				ext4_free_branches(handle, inode, NULL,
+						   &nr, &nr+1,
+						   (chain+n-1) - partial);
+				*partial->p = 0;
+			} else {
+				/* Shared branch grows from an indirect block */
+				BUFFER_TRACE(partial->bh, "get_write_access");
 				ext4_free_branches(handle, inode, partial->bh,
-						   partial->p + 1,
-						   partial2->p,
+						   partial->p,
+						   partial->p+1,
 						   (chain+n-1) - partial);
-				BUFFER_TRACE(partial->bh, "call brelse");
-				brelse(partial->bh);
-				BUFFER_TRACE(partial2->bh, "call brelse");
-				brelse(partial2->bh);
 			}
-			return 0;
 		}
+	}
+
+	if (!nr2) {
 		/*
-		 * Clear the ends of indirect blocks on the shared branch
-		 * at the start of the range
+		 * ext4_find_shared returns Indirect structure which
+		 * points to the last element which should not be
+		 * removed by truncate. But this is end of the range
+		 * in punch_hole so we need to point to the next element
 		 */
-		if (partial > chain) {
+		partial2->p++;
+	}
+
+	while (partial > chain || partial2 > chain2) {
+		int depth = (chain+n-1) - partial;
+		int depth2 = (chain2+n2-1) - partial2;
+
+		if (partial > chain && partial2 > chain2 &&
+		    partial->bh->b_blocknr == partial2->bh->b_blocknr) {
+			/*
+			 * We've converged on the same block. Clear the range,
+			 * then we're done.
+			 */
 			ext4_free_branches(handle, inode, partial->bh,
-				   partial->p + 1,
-				   (__le32 *)partial->bh->b_data+addr_per_block,
-				   (chain+n-1) - partial);
+					   partial->p + 1,
+					   partial2->p,
+					   (chain+n-1) - partial);
 			BUFFER_TRACE(partial->bh, "call brelse");
 			brelse(partial->bh);
-			partial--;
+			BUFFER_TRACE(partial2->bh, "call brelse");
+			brelse(partial2->bh);
+			return 0;
 		}
+
 		/*
-		 * Clear the ends of indirect blocks on the shared branch
-		 * at the end of the range
+		 * The start and end partial branches may not be at the same
+		 * level even though the punch happened within one level. So, we
+		 * give them a chance to arrive at the same level, then walk
+		 * them in step with each other until we converge on the same
+		 * block.
 		 */
-		if (partial2 > chain2) {
+		if (partial > chain && depth <= depth2) {
+			ext4_free_branches(handle, inode, partial->bh,
+					   partial->p + 1,
+					   (__le32 *)partial->bh->b_data+addr_per_block,
+					   (chain+n-1) - partial);
+			BUFFER_TRACE(partial->bh, "call brelse");
+			brelse(partial->bh);
+			partial--;
+		}
+		if (partial2 > chain2 && depth2 <= depth) {
 			ext4_free_branches(handle, inode, partial2->bh,
 					   (__le32 *)partial2->bh->b_data,
 					   partial2->p,
-					   (chain2+n-1) - partial2);
+					   (chain2+n2-1) - partial2);
 			BUFFER_TRACE(partial2->bh, "call brelse");
 			brelse(partial2->bh);
 			partial2--;
 		}
 	}
+	return 0;
 
 do_indirects:
 	/* Kill the remaining (whole) subtrees */

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

* [PATCH 3.16.y-ckt 033/180] fs: take i_mutex during prepare_binprm for set[ug]id executables
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (31 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 032/180] ext4: fix indirect punch hole corruption Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 034/180] ip_forward: Drop frames with attached skb->sk Luis Henriques
                   ` (146 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jann Horn, Linus Torvalds, Luis Henriques

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

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

From: Jann Horn <jann@thejh.net>

commit 8b01fc86b9f425899f8a3a8fc1c47d73c2c20543 upstream.

This prevents a race between chown() and execve(), where chowning a
setuid-user binary to root would momentarily make the binary setuid
root.

This patch was mostly written by Linus Torvalds.

Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ luis: backported to 3.16:
  - relaced task_no_new_privs() by current->no_new_privs
  - replaced READ_ONCE() by ACCESS_ONCE() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/exec.c | 76 ++++++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 28 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index a3d33fe592d6..68a0843250c9 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1254,6 +1254,53 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
 	spin_unlock(&p->fs->lock);
 }
 
+static void bprm_fill_uid(struct linux_binprm *bprm)
+{
+	struct inode *inode;
+	unsigned int mode;
+	kuid_t uid;
+	kgid_t gid;
+
+	/* clear any previous set[ug]id data from a previous binary */
+	bprm->cred->euid = current_euid();
+	bprm->cred->egid = current_egid();
+
+	if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
+		return;
+
+	if (current->no_new_privs)
+		return;
+
+	inode = file_inode(bprm->file);
+	mode = ACCESS_ONCE(inode->i_mode);
+	if (!(mode & (S_ISUID|S_ISGID)))
+		return;
+
+	/* Be careful if suid/sgid is set */
+	mutex_lock(&inode->i_mutex);
+
+	/* reload atomically mode/uid/gid now that lock held */
+	mode = inode->i_mode;
+	uid = inode->i_uid;
+	gid = inode->i_gid;
+	mutex_unlock(&inode->i_mutex);
+
+	/* We ignore suid/sgid if there are no mappings for them in the ns */
+	if (!kuid_has_mapping(bprm->cred->user_ns, uid) ||
+		 !kgid_has_mapping(bprm->cred->user_ns, gid))
+		return;
+
+	if (mode & S_ISUID) {
+		bprm->per_clear |= PER_CLEAR_ON_SETID;
+		bprm->cred->euid = uid;
+	}
+
+	if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
+		bprm->per_clear |= PER_CLEAR_ON_SETID;
+		bprm->cred->egid = gid;
+	}
+}
+
 /*
  * Fill the binprm structure from the inode.
  * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
@@ -1262,36 +1309,9 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
  */
 int prepare_binprm(struct linux_binprm *bprm)
 {
-	struct inode *inode = file_inode(bprm->file);
-	umode_t mode = inode->i_mode;
 	int retval;
 
-
-	/* clear any previous set[ug]id data from a previous binary */
-	bprm->cred->euid = current_euid();
-	bprm->cred->egid = current_egid();
-
-	if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) &&
-	    !current->no_new_privs &&
-	    kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) &&
-	    kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) {
-		/* Set-uid? */
-		if (mode & S_ISUID) {
-			bprm->per_clear |= PER_CLEAR_ON_SETID;
-			bprm->cred->euid = inode->i_uid;
-		}
-
-		/* Set-gid? */
-		/*
-		 * If setgid is set but no group execute bit then this
-		 * is a candidate for mandatory locking, not a setgid
-		 * executable.
-		 */
-		if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
-			bprm->per_clear |= PER_CLEAR_ON_SETID;
-			bprm->cred->egid = inode->i_gid;
-		}
-	}
+	bprm_fill_uid(bprm);
 
 	/* fill in binprm security blob */
 	retval = security_bprm_set_creds(bprm);

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

* [PATCH 3.16.y-ckt 034/180] ip_forward: Drop frames with attached skb->sk
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (32 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 033/180] fs: take i_mutex during prepare_binprm for set[ug]id executables Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 035/180] net: add skb_checksum_complete_unset Luis Henriques
                   ` (145 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Poehn, David S. Miller, Luis Henriques

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

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

From: =?UTF-8?q?Sebastian=20P=C3=B6hn?= <sebastian.poehn@gmail.com>

commit 2ab957492d13bb819400ac29ae55911d50a82a13 upstream.

Initial discussion was:
[FYI] xfrm: Don't lookup sk_policy for timewait sockets

Forwarded frames should not have a socket attached. Especially
tw sockets will lead to panics later-on in the stack.

This was observed with TPROXY assigning a tw socket and broken
policy routing (misconfigured). As a result frame enters
forwarding path instead of input. We cannot solve this in
TPROXY as it cannot know that policy routing is broken.

v2:
Remove useless comment

Signed-off-by: Sebastian Poehn <sebastian.poehn@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ip_forward.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 787b3c294ce6..d5410b57da19 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -81,6 +81,9 @@ int ip_forward(struct sk_buff *skb)
 	if (skb->pkt_type != PACKET_HOST)
 		goto drop;
 
+	if (unlikely(skb->sk))
+		goto drop;
+
 	if (skb_warn_if_lro(skb))
 		goto drop;
 

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

* [PATCH 3.16.y-ckt 035/180] net: add skb_checksum_complete_unset
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (33 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 034/180] ip_forward: Drop frames with attached skb->sk Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 036/180] ppp: call skb_checksum_complete_unset in ppp_receive_frame Luis Henriques
                   ` (144 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tom Herbert, David S. Miller, Luis Henriques

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

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

From: Tom Herbert <tom@herbertland.com>

commit 4e18b9adf2f910ec4d30b811a74a5b626e6c6125 upstream.

This function changes ip_summed to CHECKSUM_NONE if CHECKSUM_COMPLETE
is set. This is called to discard checksum-complete when packet
is being modified and checksum is not pulled for headers in a layer.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/skbuff.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6bb6bd86b0dc..e6c09cffb995 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2798,6 +2798,18 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
  */
 #define CHECKSUM_BREAK 76
 
+/* Unset checksum-complete
+ *
+ * Unset checksum complete can be done when packet is being modified
+ * (uncompressed for instance) and checksum-complete value is
+ * invalidated.
+ */
+static inline void skb_checksum_complete_unset(struct sk_buff *skb)
+{
+	if (skb->ip_summed == CHECKSUM_COMPLETE)
+		skb->ip_summed = CHECKSUM_NONE;
+}
+
 /* Validate (init) checksum based on checksum complete.
  *
  * Return values:

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

* [PATCH 3.16.y-ckt 036/180] ppp: call skb_checksum_complete_unset in ppp_receive_frame
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (34 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 035/180] net: add skb_checksum_complete_unset Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 037/180] tcp: fix possible deadlock in tcp_send_fin() Luis Henriques
                   ` (143 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tom Herbert, David S. Miller, Luis Henriques

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

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

From: Tom Herbert <tom@herbertland.com>

commit 3dfb05340ec6676e6fc71a9ae87bbbe66d3c2998 upstream.

Call checksum_complete_unset in PPP receive to discard checksum-complete
value. PPP does not pull checksum for headers and also modifies packet
as in VJ compression.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ppp/ppp_generic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index a75a411b1c27..dbf56debb7e3 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1710,6 +1710,7 @@ ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
 {
 	/* note: a 0-length skb is used as an error indication */
 	if (skb->len > 0) {
+		skb_checksum_complete_unset(skb);
 #ifdef CONFIG_PPP_MULTILINK
 		/* XXX do channel-level decompression here */
 		if (PPP_PROTO(skb) == PPP_MP)

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

* [PATCH 3.16.y-ckt 037/180] tcp: fix possible deadlock in tcp_send_fin()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (35 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 036/180] ppp: call skb_checksum_complete_unset in ppp_receive_frame Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 038/180] tcp: avoid looping " Luis Henriques
                   ` (142 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit d83769a580f1132ac26439f50068a29b02be535e upstream.

Using sk_stream_alloc_skb() in tcp_send_fin() is dangerous in
case a huge process is killed by OOM, and tcp_mem[2] is hit.

To be able to free memory we need to make progress, so this
patch allows FIN packets to not care about tcp_mem[2], if
skb allocation succeeded.

In a follow-up patch, we might abort tcp_send_fin() infinite loop
in case TIF_MEMDIE is set on this thread, as memory allocator
did its best getting extra memory already.

This patch reverts d22e15371811 ("tcp: fix tcp fin memory accounting")

Fixes: d22e15371811 ("tcp: fix tcp fin memory accounting")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_output.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 144af9539ceb..f704fdd6133d 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2675,6 +2675,21 @@ begin_fwd:
 	}
 }
 
+/* We allow to exceed memory limits for FIN packets to expedite
+ * connection tear down and (memory) recovery.
+ * Otherwise tcp_send_fin() could loop forever.
+ */
+static void sk_forced_wmem_schedule(struct sock *sk, int size)
+{
+	int amt, status;
+
+	if (size <= sk->sk_forward_alloc)
+		return;
+	amt = sk_mem_pages(size);
+	sk->sk_forward_alloc += amt * SK_MEM_QUANTUM;
+	sk_memory_allocated_add(sk, amt, &status);
+}
+
 /* Send a fin.  The caller locks the socket for us.  This cannot be
  * allowed to fail queueing a FIN frame under any circumstances.
  */
@@ -2697,11 +2712,14 @@ void tcp_send_fin(struct sock *sk)
 	} else {
 		/* Socket is locked, keep trying until memory is available. */
 		for (;;) {
-			skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
+			skb = alloc_skb_fclone(MAX_TCP_HEADER,
+					       sk->sk_allocation);
 			if (skb)
 				break;
 			yield();
 		}
+		skb_reserve(skb, MAX_TCP_HEADER);
+		sk_forced_wmem_schedule(sk, skb->truesize);
 		/* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
 		tcp_init_nondata_skb(skb, tp->write_seq,
 				     TCPHDR_ACK | TCPHDR_FIN);

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

* [PATCH 3.16.y-ckt 038/180] tcp: avoid looping in tcp_send_fin()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (36 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 037/180] tcp: fix possible deadlock in tcp_send_fin() Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 039/180] net: do not deplete pfmemalloc reserve Luis Henriques
                   ` (141 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit 845704a535e9b3c76448f52af1b70e4422ea03fd upstream.

Presence of an unbound loop in tcp_send_fin() had always been hard
to explain when analyzing crash dumps involving gigantic dying processes
with millions of sockets.

Lets try a different strategy :

In case of memory pressure, try to add the FIN flag to last packet
in write queue, even if packet was already sent. TCP stack will
be able to deliver this FIN after a timeout event. Note that this
FIN being delivered by a retransmit, it also carries a Push flag
given our current implementation.

By checking sk_under_memory_pressure(), we anticipate that cooking
many FIN packets might deplete tcp memory.

In the case we could not allocate a packet, even with __GFP_WAIT
allocation, then not sending a FIN seems quite reasonable if it allows
to get rid of this socket, free memory, and not block the process from
eventually doing other useful work.

Signed-off-by: Eric Dumazet <edumazet@google.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>
---
 net/ipv4/tcp_output.c | 50 +++++++++++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f704fdd6133d..9d26f4569a2e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2677,7 +2677,8 @@ begin_fwd:
 
 /* We allow to exceed memory limits for FIN packets to expedite
  * connection tear down and (memory) recovery.
- * Otherwise tcp_send_fin() could loop forever.
+ * Otherwise tcp_send_fin() could be tempted to either delay FIN
+ * or even be forced to close flow without any FIN.
  */
 static void sk_forced_wmem_schedule(struct sock *sk, int size)
 {
@@ -2690,33 +2691,40 @@ static void sk_forced_wmem_schedule(struct sock *sk, int size)
 	sk_memory_allocated_add(sk, amt, &status);
 }
 
-/* Send a fin.  The caller locks the socket for us.  This cannot be
- * allowed to fail queueing a FIN frame under any circumstances.
+/* Send a FIN. The caller locks the socket for us.
+ * We should try to send a FIN packet really hard, but eventually give up.
  */
 void tcp_send_fin(struct sock *sk)
 {
+	struct sk_buff *skb, *tskb = tcp_write_queue_tail(sk);
 	struct tcp_sock *tp = tcp_sk(sk);
-	struct sk_buff *skb = tcp_write_queue_tail(sk);
-	int mss_now;
 
-	/* Optimization, tack on the FIN if we have a queue of
-	 * unsent frames.  But be careful about outgoing SACKS
-	 * and IP options.
+	/* Optimization, tack on the FIN if we have one skb in write queue and
+	 * this skb was not yet sent, or we are under memory pressure.
+	 * Note: in the latter case, FIN packet will be sent after a timeout,
+	 * as TCP stack thinks it has already been transmitted.
 	 */
-	mss_now = tcp_current_mss(sk);
-
-	if (tcp_send_head(sk) != NULL) {
-		TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_FIN;
-		TCP_SKB_CB(skb)->end_seq++;
+	if (tskb && (tcp_send_head(sk) || sk_under_memory_pressure(sk))) {
+coalesce:
+		TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN;
+		TCP_SKB_CB(tskb)->end_seq++;
 		tp->write_seq++;
+		if (!tcp_send_head(sk)) {
+			/* This means tskb was already sent.
+			 * Pretend we included the FIN on previous transmit.
+			 * We need to set tp->snd_nxt to the value it would have
+			 * if FIN had been sent. This is because retransmit path
+			 * does not change tp->snd_nxt.
+			 */
+			tp->snd_nxt++;
+			return;
+		}
 	} else {
-		/* Socket is locked, keep trying until memory is available. */
-		for (;;) {
-			skb = alloc_skb_fclone(MAX_TCP_HEADER,
-					       sk->sk_allocation);
-			if (skb)
-				break;
-			yield();
+		skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation);
+		if (unlikely(!skb)) {
+			if (tskb)
+				goto coalesce;
+			return;
 		}
 		skb_reserve(skb, MAX_TCP_HEADER);
 		sk_forced_wmem_schedule(sk, skb->truesize);
@@ -2725,7 +2733,7 @@ void tcp_send_fin(struct sock *sk)
 				     TCPHDR_ACK | TCPHDR_FIN);
 		tcp_queue_skb(sk, skb);
 	}
-	__tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_OFF);
+	__tcp_push_pending_frames(sk, tcp_current_mss(sk), TCP_NAGLE_OFF);
 }
 
 /* We get here when a process closes a file descriptor (either due to

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

* [PATCH 3.16.y-ckt 039/180] net: do not deplete pfmemalloc reserve
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (37 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 038/180] tcp: avoid looping " Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 040/180] net: fix crash in build_skb() Luis Henriques
                   ` (140 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit 79930f5892e134c6da1254389577fffb8bd72c66 upstream.

build_skb() should look at the page pfmemalloc status.
If set, this means page allocator allocated this page in the
expectation it would help to free other pages. Networking
stack can do that only if skb->pfmemalloc is also set.

Also, we must refrain using high order pages from the pfmemalloc
reserve, so __page_frag_refill() must also use __GFP_NOMEMALLOC for
them. Under memory pressure, using order-0 pages is probably the best
strategy.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: used davem's backport to 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/skbuff.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index fe07faaed256..0f27eae2ccc1 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -309,7 +309,11 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
 
 	memset(skb, 0, offsetof(struct sk_buff, tail));
 	skb->truesize = SKB_TRUESIZE(size);
-	skb->head_frag = frag_size != 0;
+	if (frag_size) {
+		skb->head_frag = 1;
+		if (virt_to_head_page(data)->pfmemalloc)
+			skb->pfmemalloc = 1;
+	}
 	atomic_set(&skb->users, 1);
 	skb->head = data;
 	skb->data = data;
@@ -352,7 +356,8 @@ refill:
 			gfp_t gfp = gfp_mask;
 
 			if (order)
-				gfp |= __GFP_COMP | __GFP_NOWARN;
+				gfp |= __GFP_COMP | __GFP_NOWARN |
+				       __GFP_NOMEMALLOC;
 			nc->frag.page = alloc_pages(gfp, order);
 			if (likely(nc->frag.page))
 				break;

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

* [PATCH 3.16.y-ckt 040/180] net: fix crash in build_skb()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (38 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 039/180] net: do not deplete pfmemalloc reserve Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 041/180] usb: serial: silence all non-critical read errors Luis Henriques
                   ` (139 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit 2ea2f62c8bda242433809c7f4e9eae1c52c40bbe upstream.

When I added pfmemalloc support in build_skb(), I forgot netlink
was using build_skb() with a vmalloc() area.

In this patch I introduce __build_skb() for netlink use,
and build_skb() is a wrapper handling both skb->head_frag and
skb->pfmemalloc

This means netlink no longer has to hack skb->head_frag

[ 1567.700067] kernel BUG at arch/x86/mm/physaddr.c:26!
[ 1567.700067] invalid opcode: 0000 [#1] PREEMPT SMP KASAN
[ 1567.700067] Dumping ftrace buffer:
[ 1567.700067]    (ftrace buffer empty)
[ 1567.700067] Modules linked in:
[ 1567.700067] CPU: 9 PID: 16186 Comm: trinity-c182 Not tainted 4.0.0-next-20150424-sasha-00037-g4796e21 #2167
[ 1567.700067] task: ffff880127efb000 ti: ffff880246770000 task.ti: ffff880246770000
[ 1567.700067] RIP: __phys_addr (arch/x86/mm/physaddr.c:26 (discriminator 3))
[ 1567.700067] RSP: 0018:ffff8802467779d8  EFLAGS: 00010202
[ 1567.700067] RAX: 000041000ed8e000 RBX: ffffc9008ed8e000 RCX: 000000000000002c
[ 1567.700067] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffffffffb3fd6049
[ 1567.700067] RBP: ffff8802467779f8 R08: 0000000000000019 R09: ffff8801d0168000
[ 1567.700067] R10: ffff8801d01680c7 R11: ffffed003a02d019 R12: ffffc9000ed8e000
[ 1567.700067] R13: 0000000000000f40 R14: 0000000000001180 R15: ffffc9000ed8e000
[ 1567.700067] FS:  00007f2a7da3f700(0000) GS:ffff8801d1000000(0000) knlGS:0000000000000000
[ 1567.700067] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1567.700067] CR2: 0000000000738308 CR3: 000000022e329000 CR4: 00000000000007e0
[ 1567.700067] Stack:
[ 1567.700067]  ffffc9000ed8e000 ffff8801d0168000 ffffc9000ed8e000 ffff8801d0168000
[ 1567.700067]  ffff880246777a28 ffffffffad7c0a21 0000000000001080 ffff880246777c08
[ 1567.700067]  ffff88060d302e68 ffff880246777b58 ffff880246777b88 ffffffffad9a6821
[ 1567.700067] Call Trace:
[ 1567.700067] build_skb (include/linux/mm.h:508 net/core/skbuff.c:316)
[ 1567.700067] netlink_sendmsg (net/netlink/af_netlink.c:1633 net/netlink/af_netlink.c:2329)
[ 1567.774369] ? sched_clock_cpu (kernel/sched/clock.c:311)
[ 1567.774369] ? netlink_unicast (net/netlink/af_netlink.c:2273)
[ 1567.774369] ? netlink_unicast (net/netlink/af_netlink.c:2273)
[ 1567.774369] sock_sendmsg (net/socket.c:614 net/socket.c:623)
[ 1567.774369] sock_write_iter (net/socket.c:823)
[ 1567.774369] ? sock_sendmsg (net/socket.c:806)
[ 1567.774369] __vfs_write (fs/read_write.c:479 fs/read_write.c:491)
[ 1567.774369] ? get_lock_stats (kernel/locking/lockdep.c:249)
[ 1567.774369] ? default_llseek (fs/read_write.c:487)
[ 1567.774369] ? vtime_account_user (kernel/sched/cputime.c:701)
[ 1567.774369] ? rw_verify_area (fs/read_write.c:406 (discriminator 4))
[ 1567.774369] vfs_write (fs/read_write.c:539)
[ 1567.774369] SyS_write (fs/read_write.c:586 fs/read_write.c:577)
[ 1567.774369] ? SyS_read (fs/read_write.c:577)
[ 1567.774369] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 1567.774369] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2594 kernel/locking/lockdep.c:2636)
[ 1567.774369] ? trace_hardirqs_on_thunk (arch/x86/lib/thunk_64.S:42)
[ 1567.774369] system_call_fastpath (arch/x86/kernel/entry_64.S:261)

Fixes: 79930f5892e ("net: do not deplete pfmemalloc reserve")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/skbuff.h   |  1 +
 net/core/skbuff.c        | 31 ++++++++++++++++++++++---------
 net/netlink/af_netlink.c |  6 ++----
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index e6c09cffb995..89524732dd5e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -724,6 +724,7 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
 
 struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags,
 			    int node);
+struct sk_buff *__build_skb(void *data, unsigned int frag_size);
 struct sk_buff *build_skb(void *data, unsigned int frag_size);
 static inline struct sk_buff *alloc_skb(unsigned int size,
 					gfp_t priority)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0f27eae2ccc1..1b89e2a52926 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -278,13 +278,14 @@ nodata:
 EXPORT_SYMBOL(__alloc_skb);
 
 /**
- * build_skb - build a network buffer
+ * __build_skb - build a network buffer
  * @data: data buffer provided by caller
- * @frag_size: size of fragment, or 0 if head was kmalloced
+ * @frag_size: size of data, or 0 if head was kmalloced
  *
  * Allocate a new &sk_buff. Caller provides space holding head and
  * skb_shared_info. @data must have been allocated by kmalloc() only if
- * @frag_size is 0, otherwise data should come from the page allocator.
+ * @frag_size is 0, otherwise data should come from the page allocator
+ *  or vmalloc()
  * The return is the new skb buffer.
  * On a failure the return is %NULL, and @data is not freed.
  * Notes :
@@ -295,7 +296,7 @@ EXPORT_SYMBOL(__alloc_skb);
  *  before giving packet to stack.
  *  RX rings only contains data buffers, not full skbs.
  */
-struct sk_buff *build_skb(void *data, unsigned int frag_size)
+struct sk_buff *__build_skb(void *data, unsigned int frag_size)
 {
 	struct skb_shared_info *shinfo;
 	struct sk_buff *skb;
@@ -309,11 +310,6 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
 
 	memset(skb, 0, offsetof(struct sk_buff, tail));
 	skb->truesize = SKB_TRUESIZE(size);
-	if (frag_size) {
-		skb->head_frag = 1;
-		if (virt_to_head_page(data)->pfmemalloc)
-			skb->pfmemalloc = 1;
-	}
 	atomic_set(&skb->users, 1);
 	skb->head = data;
 	skb->data = data;
@@ -330,6 +326,23 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
 
 	return skb;
 }
+
+/* build_skb() is wrapper over __build_skb(), that specifically
+ * takes care of skb->head and skb->pfmemalloc
+ * This means that if @frag_size is not zero, then @data must be backed
+ * by a page fragment, not kmalloc() or vmalloc()
+ */
+struct sk_buff *build_skb(void *data, unsigned int frag_size)
+{
+	struct sk_buff *skb = __build_skb(data, frag_size);
+
+	if (skb && frag_size) {
+		skb->head_frag = 1;
+		if (virt_to_head_page(data)->pfmemalloc)
+			skb->pfmemalloc = 1;
+	}
+	return skb;
+}
 EXPORT_SYMBOL(build_skb);
 
 struct netdev_alloc_cache {
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 256ce8b84456..5dcb2baaf2c2 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1650,13 +1650,11 @@ static struct sk_buff *netlink_alloc_large_skb(unsigned int size,
 	if (data == NULL)
 		return NULL;
 
-	skb = build_skb(data, size);
+	skb = __build_skb(data, size);
 	if (skb == NULL)
 		vfree(data);
-	else {
-		skb->head_frag = 0;
+	else
 		skb->destructor = netlink_skb_destructor;
-	}
 
 	return skb;
 }

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

* [PATCH 3.16.y-ckt 041/180] usb: serial: silence all non-critical read errors
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (39 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 040/180] net: fix crash in build_skb() Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 042/180] usb: gadget: composite: enable BESL support Luis Henriques
                   ` (138 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jeremiah Mahler, Johan Hovold, Luis Henriques

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

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

From: Jeremiah Mahler <jmmahler@gmail.com>

commit aa8e22128b40590b291cd13512098bf258a7e6c5 upstream.

If a USB serial device is unplugged while there is an active program
using the device it may spam the logs with -EPROTO (71) messages as it
attempts to retry.

Most serial usb drivers (metro-usb, pl2303, mos7840, ...) only output
these messages for debugging.  The generic driver treats these as
errors.

Change the default output for the generic serial driver from error to
debug to silence these non-critical errors.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 904ab353ecf2..c44b911937e8 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -374,7 +374,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
 							__func__, urb->status);
 		return;
 	default:
-		dev_err(&port->dev, "%s - nonzero urb status: %d\n",
+		dev_dbg(&port->dev, "%s - nonzero urb status: %d\n",
 							__func__, urb->status);
 		goto resubmit;
 	}

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

* [PATCH 3.16.y-ckt 042/180] usb: gadget: composite: enable BESL support
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (40 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 041/180] usb: serial: silence all non-critical read errors Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 043/180] rtlwifi: rtl8192cu: Add new device ID Luis Henriques
                   ` (137 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Felipe Balbi, Du, Changbin, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit a6615937bcd9234e6d6bb817c3701fce44d0a84d upstream.

According to USB 2.0 ECN Errata for Link Power
Management (USB2-LPM-Errata-final.pdf), BESL
must be enabled if LPM is enabled.

This helps with USB30CV TD 9.21 LPM L1
Suspend Resume Test.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Cc: Du, Changbin <changbin.du@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/gadget/composite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index f80151932053..9536b6abf65b 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -560,7 +560,7 @@ static int bos_desc(struct usb_composite_dev *cdev)
 	usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE;
 	usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY;
 	usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT;
-	usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT);
+	usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT | USB_BESL_SUPPORT);
 
 	/*
 	 * The Superspeed USB Capability descriptor shall be implemented by all

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

* [PATCH 3.16.y-ckt 043/180] rtlwifi: rtl8192cu: Add new device ID
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (41 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 042/180] usb: gadget: composite: enable BESL support Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 044/180] rtlwifi: rtl8192cu: Add new USB ID Luis Henriques
                   ` (136 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Vasut, Larry Finger, John W. Linville, Kalle Valo, Luis Henriques

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

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

From: Marek Vasut <marex@denx.de>

commit 9374e7d2fdcad3c36dafc8d3effd554bc702c4b6 upstream.

Add new ID for ASUS N10 WiFi dongle.

Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: John W. Linville <linville@tuxdriver.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 1ac6383e7947..20f9ad9f74d2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -314,6 +314,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
 	{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
 	{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
 	{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+	{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
 	{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
 	{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
 	{RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/

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

* [PATCH 3.16.y-ckt 044/180] rtlwifi: rtl8192cu: Add new USB ID
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (42 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 043/180] rtlwifi: rtl8192cu: Add new device ID Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 045/180] Bluetooth: ath3k: Add support Atheros AR5B195 combo Mini PCIe card Luis Henriques
                   ` (135 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Larry Finger, Kalle Valo, Luis Henriques

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

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

From: Larry Finger <Larry.Finger@lwfinger.net>

commit 2f92b314f4daff2117847ac5343c54d3d041bf78 upstream.

USB ID 2001:330d is used for a D-Link DWA-131.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 20f9ad9f74d2..7ada8cb0f0da 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -371,6 +371,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
 	{RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
 	{RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
 	{RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
+	{RTL_USB_DEVICE(0x2001, 0x330d, rtl92cu_hal_cfg)}, /*D-Link DWA-131 */
 	{RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
 	{RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
 	{RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/

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

* [PATCH 3.16.y-ckt 045/180] Bluetooth: ath3k: Add support Atheros AR5B195 combo Mini PCIe card
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (43 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 044/180] rtlwifi: rtl8192cu: Add new USB ID Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 046/180] power_supply: twl4030_madc: Check return value of power_supply_register Luis Henriques
                   ` (134 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Ploumistos, Marcel Holtmann, Luis Henriques

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

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

From: Alexander Ploumistos <alex.ploumistos@gmail.com>

commit 2eeff0b4317a02f0e281df891d990194f0737aae upstream.

Add 04f2:aff1 to ath3k.c supported devices list and btusb.c blacklist, so
that the device can load the ath3k firmware and re-enumerate itself as an
AR3011 device.

T:  Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=04f2 ProdID=aff1 Rev= 0.01
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms

Signed-off-by: Alexander Ploumistos <alexpl@fedoraproject.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/bluetooth/ath3k.c | 1 +
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 6f08271c1d99..b526e7c7b109 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -65,6 +65,7 @@ static const struct usb_device_id ath3k_table[] = {
 	/* Atheros AR3011 with sflash firmware*/
 	{ USB_DEVICE(0x0489, 0xE027) },
 	{ USB_DEVICE(0x0489, 0xE03D) },
+	{ USB_DEVICE(0x04F2, 0xAFF1) },
 	{ USB_DEVICE(0x0930, 0x0215) },
 	{ USB_DEVICE(0x0CF3, 0x3002) },
 	{ USB_DEVICE(0x0CF3, 0xE019) },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 35b8e75eb6fb..ae854bab7dfa 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -155,6 +155,7 @@ static const struct usb_device_id blacklist_table[] = {
 	/* Atheros 3011 with sflash firmware */
 	{ USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
 	{ USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
+	{ USB_DEVICE(0x04f2, 0xaff1), .driver_info = BTUSB_IGNORE },
 	{ USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
 	{ USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
 	{ USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },

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

* [PATCH 3.16.y-ckt 046/180] power_supply: twl4030_madc: Check return value of power_supply_register
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (44 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 045/180] Bluetooth: ath3k: Add support Atheros AR5B195 combo Mini PCIe card Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 047/180] power_supply: lp8788-charger: Fix leaked power supply on probe fail Luis Henriques
                   ` (133 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Sebastian Reichel, Luis Henriques

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

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

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

commit 68c3ed6fa7e0d69529ced772d650ab128916a81d upstream.

The return value of power_supply_register() call was not checked and
even on error probe() function returned 0. If registering failed then
during unbind the driver tried to unregister power supply which was not
actually registered.

This could lead to memory corruption because power_supply_unregister()
unconditionally cleans up given power supply.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: da0a00ebc239 ("power: Add twl4030_madc battery driver.")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/power/twl4030_madc_battery.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/power/twl4030_madc_battery.c b/drivers/power/twl4030_madc_battery.c
index 7ef445a6cfa6..cf907609ec49 100644
--- a/drivers/power/twl4030_madc_battery.c
+++ b/drivers/power/twl4030_madc_battery.c
@@ -192,6 +192,7 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev)
 {
 	struct twl4030_madc_battery *twl4030_madc_bat;
 	struct twl4030_madc_bat_platform_data *pdata = pdev->dev.platform_data;
+	int ret = 0;
 
 	twl4030_madc_bat = kzalloc(sizeof(*twl4030_madc_bat), GFP_KERNEL);
 	if (!twl4030_madc_bat)
@@ -216,9 +217,11 @@ static int twl4030_madc_battery_probe(struct platform_device *pdev)
 
 	twl4030_madc_bat->pdata = pdata;
 	platform_set_drvdata(pdev, twl4030_madc_bat);
-	power_supply_register(&pdev->dev, &twl4030_madc_bat->psy);
+	ret = power_supply_register(&pdev->dev, &twl4030_madc_bat->psy);
+	if (ret < 0)
+		kfree(twl4030_madc_bat);
 
-	return 0;
+	return ret;
 }
 
 static int twl4030_madc_battery_remove(struct platform_device *pdev)

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

* [PATCH 3.16.y-ckt 047/180] power_supply: lp8788-charger: Fix leaked power supply on probe fail
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (45 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 046/180] power_supply: twl4030_madc: Check return value of power_supply_register Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 048/180] ARM: dts: dove: Fix uart[23] reg property Luis Henriques
                   ` (132 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Sebastian Reichel, Luis Henriques

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

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

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

commit a7117f81e8391e035c49b3440792f7e6cea28173 upstream.

Driver forgot to unregister charger power supply if registering of
battery supply failed in probe(). In such case the memory associated
with power supply leaked.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 98a276649358 ("power_supply: Add new lp8788 charger driver")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/power/lp8788-charger.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c
index ed49b50b220b..72da2a6c22db 100644
--- a/drivers/power/lp8788-charger.c
+++ b/drivers/power/lp8788-charger.c
@@ -417,8 +417,10 @@ static int lp8788_psy_register(struct platform_device *pdev,
 	pchg->battery.num_properties = ARRAY_SIZE(lp8788_battery_prop);
 	pchg->battery.get_property = lp8788_battery_get_property;
 
-	if (power_supply_register(&pdev->dev, &pchg->battery))
+	if (power_supply_register(&pdev->dev, &pchg->battery)) {
+		power_supply_unregister(&pchg->charger);
 		return -EPERM;
+	}
 
 	return 0;
 }

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

* [PATCH 3.16.y-ckt 048/180] ARM: dts: dove: Fix uart[23] reg property
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (46 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 047/180] power_supply: lp8788-charger: Fix leaked power supply on probe fail Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 049/180] xtensa: xtfpga: fix hardware lockup caused by LCD driver Luis Henriques
                   ` (131 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Hesselbarth, Gregory CLEMENT, Luis Henriques

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

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

From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

commit a74cd13b807029397f7232449df929bac11fb228 upstream.

Fix Dove's register addresses of uart2 and uart3 nodes that seem to
be broken since ages due to a copy-and-paste error.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/boot/dts/dove.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 3b891dd20993..c00078d237fa 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -154,7 +154,7 @@
 
 			uart2: serial@12200 {
 				compatible = "ns16550a";
-				reg = <0x12000 0x100>;
+				reg = <0x12200 0x100>;
 				reg-shift = <2>;
 				interrupts = <9>;
 				clocks = <&core_clk 0>;
@@ -163,7 +163,7 @@
 
 			uart3: serial@12300 {
 				compatible = "ns16550a";
-				reg = <0x12100 0x100>;
+				reg = <0x12300 0x100>;
 				reg-shift = <2>;
 				interrupts = <10>;
 				clocks = <&core_clk 0>;

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

* [PATCH 3.16.y-ckt 049/180] xtensa: xtfpga: fix hardware lockup caused by LCD driver
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (47 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 048/180] ARM: dts: dove: Fix uart[23] reg property Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 050/180] Drivers: hv: vmbus: Fix a bug in the error path in vmbus_open() Luis Henriques
                   ` (130 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Luis Henriques

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

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

From: Max Filippov <jcmvbkbc@gmail.com>

commit 4949009eb8d40a441dcddcd96e101e77d31cf1b2 upstream.

LCD driver is always built for the XTFPGA platform, but its base address
is not configurable, and is wrong for ML605/KC705. Its initialization
locks up KC705 board hardware.

Make the whole driver optional, and its base address and bus width
configurable. Implement 4-bit bus access method.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/xtensa/Kconfig                                | 30 ++++++++++++
 arch/xtensa/platforms/xtfpga/Makefile              |  3 +-
 .../platforms/xtfpga/include/platform/hardware.h   |  3 --
 .../xtensa/platforms/xtfpga/include/platform/lcd.h | 15 ++++++
 arch/xtensa/platforms/xtfpga/lcd.c                 | 55 +++++++++++++---------
 5 files changed, 81 insertions(+), 25 deletions(-)

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 3a617af60d46..6f30b98d8280 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -348,6 +348,36 @@ source "drivers/pcmcia/Kconfig"
 
 source "drivers/pci/hotplug/Kconfig"
 
+config XTFPGA_LCD
+	bool "Enable XTFPGA LCD driver"
+	depends on XTENSA_PLATFORM_XTFPGA
+	default n
+	help
+	  There's a 2x16 LCD on most of XTFPGA boards, kernel may output
+	  progress messages there during bootup/shutdown. It may be useful
+	  during board bringup.
+
+	  If unsure, say N.
+
+config XTFPGA_LCD_BASE_ADDR
+	hex "XTFPGA LCD base address"
+	depends on XTFPGA_LCD
+	default "0x0d0c0000"
+	help
+	  Base address of the LCD controller inside KIO region.
+	  Different boards from XTFPGA family have LCD controller at different
+	  addresses. Please consult prototyping user guide for your board for
+	  the correct address. Wrong address here may lead to hardware lockup.
+
+config XTFPGA_LCD_8BIT_ACCESS
+	bool "Use 8-bit access to XTFPGA LCD"
+	depends on XTFPGA_LCD
+	default n
+	help
+	  LCD may be connected with 4- or 8-bit interface, 8-bit access may
+	  only be used with 8-bit interface. Please consult prototyping user
+	  guide for your board for the correct interface width.
+
 endmenu
 
 menu "Executable file formats"
diff --git a/arch/xtensa/platforms/xtfpga/Makefile b/arch/xtensa/platforms/xtfpga/Makefile
index b9ae206340cd..7839d38b2337 100644
--- a/arch/xtensa/platforms/xtfpga/Makefile
+++ b/arch/xtensa/platforms/xtfpga/Makefile
@@ -6,4 +6,5 @@
 #
 # Note 2! The CFLAGS definitions are in the main makefile...
 
-obj-y			= setup.o lcd.o
+obj-y			+= setup.o
+obj-$(CONFIG_XTFPGA_LCD) += lcd.o
diff --git a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
index aeb316b7ff88..e8cc86fbba09 100644
--- a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
+++ b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
@@ -40,9 +40,6 @@
 
 /* UART */
 #define DUART16552_PADDR	(XCHAL_KIO_PADDR + 0x0D050020)
-/* LCD instruction and data addresses. */
-#define LCD_INSTR_ADDR		((char *)IOADDR(0x0D040000))
-#define LCD_DATA_ADDR		((char *)IOADDR(0x0D040004))
 
 /* Misc. */
 #define XTFPGA_FPGAREGS_VADDR	IOADDR(0x0D020000)
diff --git a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
index 0e435645af5a..4c8541ed1139 100644
--- a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
+++ b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
@@ -11,10 +11,25 @@
 #ifndef __XTENSA_XTAVNET_LCD_H
 #define __XTENSA_XTAVNET_LCD_H
 
+#ifdef CONFIG_XTFPGA_LCD
 /* Display string STR at position POS on the LCD. */
 void lcd_disp_at_pos(char *str, unsigned char pos);
 
 /* Shift the contents of the LCD display left or right. */
 void lcd_shiftleft(void);
 void lcd_shiftright(void);
+#else
+static inline void lcd_disp_at_pos(char *str, unsigned char pos)
+{
+}
+
+static inline void lcd_shiftleft(void)
+{
+}
+
+static inline void lcd_shiftright(void)
+{
+}
+#endif
+
 #endif
diff --git a/arch/xtensa/platforms/xtfpga/lcd.c b/arch/xtensa/platforms/xtfpga/lcd.c
index 2872301598df..4dc0c1b43f4b 100644
--- a/arch/xtensa/platforms/xtfpga/lcd.c
+++ b/arch/xtensa/platforms/xtfpga/lcd.c
@@ -1,50 +1,63 @@
 /*
- * Driver for the LCD display on the Tensilica LX60 Board.
+ * Driver for the LCD display on the Tensilica XTFPGA board family.
+ * http://www.mytechcorp.com/cfdata/productFile/File1/MOC-16216B-B-A0A04.pdf
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
  * Copyright (C) 2001, 2006 Tensilica Inc.
+ * Copyright (C) 2015 Cadence Design Systems Inc.
  */
 
-/*
- *
- * FIXME: this code is from the examples from the LX60 user guide.
- *
- * The lcd_pause function does busy waiting, which is probably not
- * great. Maybe the code could be changed to use kernel timers, or
- * change the hardware to not need to wait.
- */
-
+#include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/io.h>
 
 #include <platform/hardware.h>
 #include <platform/lcd.h>
-#include <linux/delay.h>
 
-#define LCD_PAUSE_ITERATIONS	4000
+/* LCD instruction and data addresses. */
+#define LCD_INSTR_ADDR		((char *)IOADDR(CONFIG_XTFPGA_LCD_BASE_ADDR))
+#define LCD_DATA_ADDR		(LCD_INSTR_ADDR + 4)
+
 #define LCD_CLEAR		0x1
 #define LCD_DISPLAY_ON		0xc
 
 /* 8bit and 2 lines display */
 #define LCD_DISPLAY_MODE8BIT	0x38
+#define LCD_DISPLAY_MODE4BIT	0x28
 #define LCD_DISPLAY_POS		0x80
 #define LCD_SHIFT_LEFT		0x18
 #define LCD_SHIFT_RIGHT		0x1c
 
+static void lcd_put_byte(u8 *addr, u8 data)
+{
+#ifdef CONFIG_XTFPGA_LCD_8BIT_ACCESS
+	ACCESS_ONCE(*addr) = data;
+#else
+	ACCESS_ONCE(*addr) = data & 0xf0;
+	ACCESS_ONCE(*addr) = (data << 4) & 0xf0;
+#endif
+}
+
 static int __init lcd_init(void)
 {
-	*LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
+	ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
 	mdelay(5);
-	*LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
+	ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
 	udelay(200);
-	*LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
+	ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
+	udelay(50);
+#ifndef CONFIG_XTFPGA_LCD_8BIT_ACCESS
+	ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE4BIT;
+	udelay(50);
+	lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_MODE4BIT);
 	udelay(50);
-	*LCD_INSTR_ADDR = LCD_DISPLAY_ON;
+#endif
+	lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_ON);
 	udelay(50);
-	*LCD_INSTR_ADDR = LCD_CLEAR;
+	lcd_put_byte(LCD_INSTR_ADDR, LCD_CLEAR);
 	mdelay(10);
 	lcd_disp_at_pos("XTENSA LINUX", 0);
 	return 0;
@@ -52,10 +65,10 @@ static int __init lcd_init(void)
 
 void lcd_disp_at_pos(char *str, unsigned char pos)
 {
-	*LCD_INSTR_ADDR = LCD_DISPLAY_POS | pos;
+	lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_POS | pos);
 	udelay(100);
 	while (*str != 0) {
-		*LCD_DATA_ADDR = *str;
+		lcd_put_byte(LCD_DATA_ADDR, *str);
 		udelay(200);
 		str++;
 	}
@@ -63,13 +76,13 @@ void lcd_disp_at_pos(char *str, unsigned char pos)
 
 void lcd_shiftleft(void)
 {
-	*LCD_INSTR_ADDR = LCD_SHIFT_LEFT;
+	lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_LEFT);
 	udelay(50);
 }
 
 void lcd_shiftright(void)
 {
-	*LCD_INSTR_ADDR = LCD_SHIFT_RIGHT;
+	lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_RIGHT);
 	udelay(50);
 }
 

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

* [PATCH 3.16.y-ckt 050/180] Drivers: hv: vmbus: Fix a bug in the error path in vmbus_open()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (48 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 049/180] xtensa: xtfpga: fix hardware lockup caused by LCD driver Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 051/180] xtensa: provide __NR_sync_file_range2 instead of __NR_sync_file_range Luis Henriques
                   ` (129 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, Greg Kroah-Hartman, Luis Henriques

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

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

From: "K. Y. Srinivasan" <kys@microsoft.com>

commit 40384e4bbeb9f2651fe9bffc0062d9f31ef625bf upstream.

Correctly rollback state if the failure occurs after we have handed over
the ownership of the buffer to the host.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hv/channel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index bec55ed2917a..1e951c507c0d 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -135,7 +135,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
 			   GFP_KERNEL);
 	if (!open_info) {
 		err = -ENOMEM;
-		goto error0;
+		goto error_gpadl;
 	}
 
 	init_completion(&open_info->waitevent);
@@ -151,7 +151,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
 
 	if (userdatalen > MAX_USER_DEFINED_BYTES) {
 		err = -EINVAL;
-		goto error0;
+		goto error_gpadl;
 	}
 
 	if (userdatalen)
@@ -195,6 +195,9 @@ error1:
 	list_del(&open_info->msglistentry);
 	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
 
+error_gpadl:
+	vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle);
+
 error0:
 	free_pages((unsigned long)out,
 		get_order(send_ringbuffer_size + recv_ringbuffer_size));

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

* [PATCH 3.16.y-ckt 051/180] xtensa: provide __NR_sync_file_range2 instead of __NR_sync_file_range
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (49 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 050/180] Drivers: hv: vmbus: Fix a bug in the error path in vmbus_open() Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 052/180] KVM: s390: Zero out current VMDB of STSI before including level3 data Luis Henriques
                   ` (128 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Luis Henriques

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

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

From: Max Filippov <jcmvbkbc@gmail.com>

commit 01e84c70fe40c8111f960987bcf7f931842e6d07 upstream.

xtensa actually uses sync_file_range2 implementation, so it should
define __NR_sync_file_range2 as other architectures that use that
function. That fixes userspace interface (that apparently never worked)
and avoids special-casing xtensa in libc implementations.
See the thread ending at
http://lists.busybox.net/pipermail/uclibc/2015-February/048833.html
for more details.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/xtensa/include/uapi/asm/unistd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
index 50084f7c01c8..b54fa1bd7f7e 100644
--- a/arch/xtensa/include/uapi/asm/unistd.h
+++ b/arch/xtensa/include/uapi/asm/unistd.h
@@ -715,7 +715,7 @@ __SYSCALL(323, sys_process_vm_writev, 6)
 __SYSCALL(324, sys_name_to_handle_at, 5)
 #define __NR_open_by_handle_at			325
 __SYSCALL(325, sys_open_by_handle_at, 3)
-#define __NR_sync_file_range			326
+#define __NR_sync_file_range2			326
 __SYSCALL(326, sys_sync_file_range2, 6)
 #define __NR_perf_event_open			327
 __SYSCALL(327, sys_perf_event_open, 5)

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

* [PATCH 3.16.y-ckt 052/180] KVM: s390: Zero out current VMDB of STSI before including level3 data.
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (50 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 051/180] xtensa: provide __NR_sync_file_range2 instead of __NR_sync_file_range Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 053/180] KVM: s390: fix handling of write errors in the tpi handler Luis Henriques
                   ` (127 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ekaterina Tumanova, Christian Borntraeger, Luis Henriques

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

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

From: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>

commit b75f4c9afac2604feb971441116c07a24ecca1ec upstream.

s390 documentation requires words 0 and 10-15 to be reserved and stored as
zeros. As we fill out all other fields, we can memset the full structure.

Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/s390/kvm/priv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 9f41229df1aa..3d2e3b7c50db 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -470,6 +470,7 @@ static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem)
 	for (n = mem->count - 1; n > 0 ; n--)
 		memcpy(&mem->vm[n], &mem->vm[n - 1], sizeof(mem->vm[0]));
 
+	memset(&mem->vm[0], 0, sizeof(mem->vm[0]));
 	mem->vm[0].cpus_total = cpus;
 	mem->vm[0].cpus_configured = cpus;
 	mem->vm[0].cpus_standby = 0;

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

* [PATCH 3.16.y-ckt 053/180] KVM: s390: fix handling of write errors in the tpi handler
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (51 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 052/180] KVM: s390: Zero out current VMDB of STSI before including level3 data Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 054/180] KVM: s390: reinjection of irqs can fail " Luis Henriques
                   ` (126 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Hildenbrand, Christian Borntraeger, Luis Henriques

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

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

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

commit 261520dcfcba93ca5dfe671b88ffab038cd940c8 upstream.

If the I/O interrupt could not be written to the guest provided
area (e.g. access exception), a program exception was injected into the
guest but "inti" wasn't freed, therefore resulting in a memory leak.

In addition, the I/O interrupt wasn't reinjected. Therefore the dequeued
interrupt is lost.

This patch fixes the problem while cleaning up the function and making the
cc and rc logic easier to handle.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/s390/kvm/priv.c | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 3d2e3b7c50db..a07965490779 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -228,18 +228,19 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
 	struct kvm_s390_interrupt_info *inti;
 	unsigned long len;
 	u32 tpi_data[3];
-	int cc, rc;
+	int rc;
 	u64 addr;
 
-	rc = 0;
 	addr = kvm_s390_get_base_disp_s(vcpu);
 	if (addr & 3)
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-	cc = 0;
+
 	inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->arch.sie_block->gcr[6], 0);
-	if (!inti)
-		goto no_interrupt;
-	cc = 1;
+	if (!inti) {
+		kvm_s390_set_psw_cc(vcpu, 0);
+		return 0;
+	}
+
 	tpi_data[0] = inti->io.subchannel_id << 16 | inti->io.subchannel_nr;
 	tpi_data[1] = inti->io.io_int_parm;
 	tpi_data[2] = inti->io.io_int_word;
@@ -250,30 +251,35 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
 		 */
 		len = sizeof(tpi_data) - 4;
 		rc = write_guest(vcpu, addr, &tpi_data, len);
-		if (rc)
-			return kvm_s390_inject_prog_cond(vcpu, rc);
+		if (rc) {
+			rc = kvm_s390_inject_prog_cond(vcpu, rc);
+			goto reinject_interrupt;
+		}
 	} else {
 		/*
 		 * Store the three-word I/O interruption code into
 		 * the appropriate lowcore area.
 		 */
 		len = sizeof(tpi_data);
-		if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len))
+		if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len)) {
+			/* failed writes to the low core are not recoverable */
 			rc = -EFAULT;
+			goto reinject_interrupt;
+		}
 	}
+
+	/* irq was successfully handed to the guest */
+	kfree(inti);
+	kvm_s390_set_psw_cc(vcpu, 1);
+	return 0;
+reinject_interrupt:
 	/*
 	 * If we encounter a problem storing the interruption code, the
 	 * instruction is suppressed from the guest's view: reinject the
 	 * interrupt.
 	 */
-	if (!rc)
-		kfree(inti);
-	else
-		kvm_s390_reinject_io_int(vcpu->kvm, inti);
-no_interrupt:
-	/* Set condition code and we're done. */
-	if (!rc)
-		kvm_s390_set_psw_cc(vcpu, cc);
+	kvm_s390_reinject_io_int(vcpu->kvm, inti);
+	/* don't set the cc, a pgm irq was injected or we drop to user space */
 	return rc ? -EFAULT : 0;
 }
 

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

* [PATCH 3.16.y-ckt 054/180] KVM: s390: reinjection of irqs can fail in the tpi handler
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (52 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 053/180] KVM: s390: fix handling of write errors in the tpi handler Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 055/180] usb: musb: core: fix TX/RX endpoint order Luis Henriques
                   ` (125 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Hildenbrand, Christian Borntraeger, Luis Henriques

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

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

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

commit 15462e37ca848abac7477dece65f8af25febd744 upstream.

The reinjection of an I/O interrupt can fail if the list is at the limit
and between the dequeue and the reinjection, another I/O interrupt is
injected (e.g. if user space floods kvm with I/O interrupts).

This patch avoids this memory leak and returns -EFAULT in this special
case. This error is not recoverable, so let's fail hard. This can later
be avoided by not dequeuing the interrupt but working directly on the
locked list.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/s390/kvm/interrupt.c | 4 ++--
 arch/s390/kvm/kvm-s390.h  | 4 ++--
 arch/s390/kvm/priv.c      | 5 ++++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index f19702fc89ec..be5fb350d255 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1007,10 +1007,10 @@ int kvm_s390_inject_vm(struct kvm *kvm,
 	return rc;
 }
 
-void kvm_s390_reinject_io_int(struct kvm *kvm,
+int kvm_s390_reinject_io_int(struct kvm *kvm,
 			      struct kvm_s390_interrupt_info *inti)
 {
-	__inject_vm(kvm, inti);
+	return __inject_vm(kvm, inti);
 }
 
 int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index a8655ed31616..3d08a076729f 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -143,8 +143,8 @@ int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
 int __must_check kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code);
 struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
 						    u64 cr6, u64 schid);
-void kvm_s390_reinject_io_int(struct kvm *kvm,
-			      struct kvm_s390_interrupt_info *inti);
+int kvm_s390_reinject_io_int(struct kvm *kvm,
+			     struct kvm_s390_interrupt_info *inti);
 int kvm_s390_mask_adapter(struct kvm *kvm, unsigned int id, bool masked);
 
 /* implemented in priv.c */
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index a07965490779..8a5156d85c70 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -278,7 +278,10 @@ reinject_interrupt:
 	 * instruction is suppressed from the guest's view: reinject the
 	 * interrupt.
 	 */
-	kvm_s390_reinject_io_int(vcpu->kvm, inti);
+	if (kvm_s390_reinject_io_int(vcpu->kvm, inti)) {
+		kfree(inti);
+		rc = -EFAULT;
+	}
 	/* don't set the cc, a pgm irq was injected or we drop to user space */
 	return rc ? -EFAULT : 0;
 }

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

* [PATCH 3.16.y-ckt 055/180] usb: musb: core: fix TX/RX endpoint order
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (53 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 054/180] KVM: s390: reinjection of irqs can fail " Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 056/180] usb: gadget: printer: enqueue printer's response for setup request Luis Henriques
                   ` (124 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit e3c93e1a3f35be4cf1493d3ccfb0c6d9209e4922 upstream.

As per Mentor Graphics' documentation, we should
always handle TX endpoints before RX endpoints.

This patch fixes that error while also updating
some hard-to-read comments which were scattered
around musb_interrupt().

This patch should be backported as far back as
possible since this error has been in the driver
since it's conception.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/musb/musb_core.c | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index a9ac102ee7a0..2281879278ed 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1520,16 +1520,30 @@ irqreturn_t musb_interrupt(struct musb *musb)
 		(devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral",
 		musb->int_usb, musb->int_tx, musb->int_rx);
 
-	/* the core can interrupt us for multiple reasons; docs have
-	 * a generic interrupt flowchart to follow
+	/**
+	 * According to Mentor Graphics' documentation, flowchart on page 98,
+	 * IRQ should be handled as follows:
+	 *
+	 * . Resume IRQ
+	 * . Session Request IRQ
+	 * . VBUS Error IRQ
+	 * . Suspend IRQ
+	 * . Connect IRQ
+	 * . Disconnect IRQ
+	 * . Reset/Babble IRQ
+	 * . SOF IRQ (we're not using this one)
+	 * . Endpoint 0 IRQ
+	 * . TX Endpoints
+	 * . RX Endpoints
+	 *
+	 * We will be following that flowchart in order to avoid any problems
+	 * that might arise with internal Finite State Machine.
 	 */
+
 	if (musb->int_usb)
 		retval |= musb_stage0_irq(musb, musb->int_usb,
 				devctl);
 
-	/* "stage 1" is handling endpoint irqs */
-
-	/* handle endpoint 0 first */
 	if (musb->int_tx & 1) {
 		if (devctl & MUSB_DEVCTL_HM)
 			retval |= musb_h_ep0_irq(musb);
@@ -1537,37 +1551,31 @@ irqreturn_t musb_interrupt(struct musb *musb)
 			retval |= musb_g_ep0_irq(musb);
 	}
 
-	/* RX on endpoints 1-15 */
-	reg = musb->int_rx >> 1;
+	reg = musb->int_tx >> 1;
 	ep_num = 1;
 	while (reg) {
 		if (reg & 1) {
-			/* musb_ep_select(musb->mregs, ep_num); */
-			/* REVISIT just retval = ep->rx_irq(...) */
 			retval = IRQ_HANDLED;
 			if (devctl & MUSB_DEVCTL_HM)
-				musb_host_rx(musb, ep_num);
+				musb_host_tx(musb, ep_num);
 			else
-				musb_g_rx(musb, ep_num);
+				musb_g_tx(musb, ep_num);
 		}
-
 		reg >>= 1;
 		ep_num++;
 	}
 
-	/* TX on endpoints 1-15 */
-	reg = musb->int_tx >> 1;
+	reg = musb->int_rx >> 1;
 	ep_num = 1;
 	while (reg) {
 		if (reg & 1) {
-			/* musb_ep_select(musb->mregs, ep_num); */
-			/* REVISIT just retval |= ep->tx_irq(...) */
 			retval = IRQ_HANDLED;
 			if (devctl & MUSB_DEVCTL_HM)
-				musb_host_tx(musb, ep_num);
+				musb_host_rx(musb, ep_num);
 			else
-				musb_g_tx(musb, ep_num);
+				musb_g_rx(musb, ep_num);
 		}
+
 		reg >>= 1;
 		ep_num++;
 	}

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

* [PATCH 3.16.y-ckt 056/180] usb: gadget: printer: enqueue printer's response for setup request
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (54 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 055/180] usb: musb: core: fix TX/RX endpoint order Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 057/180] compal-laptop: correct invalid hwmon name Luis Henriques
                   ` (123 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrzej Pietrasiewicz, Felipe Balbi, Luis Henriques

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

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

From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>

commit eb132ccbdec5df46e29c9814adf76075ce83576b upstream.

Function-specific setup requests should be handled in such a way, that
apart from filling in the data buffer, the requests are also actually
enqueued: if function-specific setup is called from composte_setup(),
the "usb_ep_queue()" block of code in composite_setup() is skipped.

The printer function lacks this part and it results in e.g. get device id
requests failing: the host expects some response, the device prepares it
but does not equeue it for sending to the host, so the host finally asserts
timeout.

This patch adds enqueueing the prepared responses.

Fixes: 2e87edf49227: "usb: gadget: make g_printer use composite"
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - file rename: drivers/usb/gadget/legacy/printer.c ->
    drivers/usb/gadget/printer.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/gadget/printer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 6474081dcbaf..c9c6dae75c13 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -980,6 +980,15 @@ unknown:
 		break;
 	}
 	/* host either stalls (value < 0) or reports success */
+	if (value >= 0) {
+		req->length = value;
+		req->zero = value < wLength;
+		value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
+		if (value < 0) {
+			ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
+			req->status = 0;
+		}
+	}
 	return value;
 }
 

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

* [PATCH 3.16.y-ckt 057/180] compal-laptop: correct invalid hwmon name
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (55 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 056/180] usb: gadget: printer: enqueue printer's response for setup request Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 058/180] compal-laptop: Fix leaking hwmon device Luis Henriques
                   ` (122 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roald Frederickx, Matthew Garrett, Luis Henriques

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

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

From: Roald Frederickx <roald.frederickx@gmail.com>

commit 9a5ee65572e88ddfc179fa81e1daed55d5772711 upstream.

Change the name of the hwmon interface from "compal-laptop" to "compal".
A dash is an invalid character for a hwmon name and caused the call to
hwmon_device_register_with_groups() to fail.

Signed-off-by: Roald Frederickx <roald.frederickx@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/platform/x86/compal-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 7297df2ebf50..26bfd7bb5c13 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -1028,7 +1028,7 @@ static int compal_probe(struct platform_device *pdev)
 		return err;
 
 	hwmon_dev = hwmon_device_register_with_groups(&pdev->dev,
-						      DRIVER_NAME, data,
+						      "compal", data,
 						      compal_hwmon_groups);
 	if (IS_ERR(hwmon_dev)) {
 		err = PTR_ERR(hwmon_dev);

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

* [PATCH 3.16.y-ckt 058/180] compal-laptop: Fix leaking hwmon device
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (56 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 057/180] compal-laptop: correct invalid hwmon name Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 059/180] compal-laptop: Check return value of power_supply_register Luis Henriques
                   ` (121 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Sebastian Reichel, Luis Henriques

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

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

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

commit ad774702f1705c04e5fa492b793d8d477a504fa6 upstream.

The commit c2be45f09bb0 ("compal-laptop: Use
devm_hwmon_device_register_with_groups") wanted to change the
registering of hwmon device to resource-managed version. It mostly did
it except the main thing - it forgot to use devm-like function so the
hwmon device leaked after device removal or probe failure.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: c2be45f09bb0 ("compal-laptop: Use devm_hwmon_device_register_with_groups")
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/platform/x86/compal-laptop.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 26bfd7bb5c13..da5e7b8e4519 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -1027,9 +1027,9 @@ static int compal_probe(struct platform_device *pdev)
 	if (err)
 		return err;
 
-	hwmon_dev = hwmon_device_register_with_groups(&pdev->dev,
-						      "compal", data,
-						      compal_hwmon_groups);
+	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
+							   "compal", data,
+							   compal_hwmon_groups);
 	if (IS_ERR(hwmon_dev)) {
 		err = PTR_ERR(hwmon_dev);
 		goto remove;

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

* [PATCH 3.16.y-ckt 059/180] compal-laptop: Check return value of power_supply_register
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (57 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 058/180] compal-laptop: Fix leaking hwmon device Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 060/180] sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance Luis Henriques
                   ` (120 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Sebastian Reichel, Luis Henriques

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

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

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

commit 1915a718b1872edffcb13e5436a9f7302d3d36f0 upstream.

The return value of power_supply_register() call was not checked and
even on error probe() function returned 0. If registering failed then
during unbind the driver tried to unregister power supply which was not
actually registered.

This could lead to memory corruption because power_supply_unregister()
unconditionally cleans up given power supply.

Fix this by checking return status of power_supply_register() call. In
case of failure, clean up sysfs entries and fail the probe.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 9be0fcb5ed46 ("compal-laptop: add JHL90, battery & hwmon interface")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/platform/x86/compal-laptop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index da5e7b8e4519..034aa844a1b5 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -1037,7 +1037,9 @@ static int compal_probe(struct platform_device *pdev)
 
 	/* Power supply */
 	initialize_power_supply_data(data);
-	power_supply_register(&compal_device->dev, &data->psy);
+	err = power_supply_register(&compal_device->dev, &data->psy);
+	if (err < 0)
+		goto remove;
 
 	platform_set_drvdata(pdev, data);
 

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

* [PATCH 3.16.y-ckt 060/180] sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (58 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 059/180] compal-laptop: Check return value of power_supply_register Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 061/180] drm/radeon: fix doublescan modes (v2) Luis Henriques
                   ` (119 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Len Brown, Borislav Petkov, H. Peter Anvin, Ian Malone,
	Josh Boyer, Linus Torvalds, Mike Galbraith, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Luis Henriques

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

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

From: Len Brown <len.brown@intel.com>

commit b253149b843f89cd300cbdbea27ce1f847506f99 upstream.

In Linux-3.9 we removed the mwait_idle() loop:

  69fb3676df33 ("x86 idle: remove mwait_idle() and "idle=mwait" cmdline param")

The reasoning was that modern machines should be sufficiently
happy during the boot process using the default_idle() HALT
loop, until cpuidle loads and either acpi_idle or intel_idle
invoke the newer MWAIT-with-hints idle loop.

But two machines reported problems:

 1. Certain Core2-era machines support MWAIT-C1 and HALT only.
    MWAIT-C1 is preferred for optimal power and performance.
    But if they support just C1, cpuidle never loads and
    so they use the boot-time default idle loop forever.

 2. Some laptops will boot-hang if HALT is used,
    but will boot successfully if MWAIT is used.
    This appears to be a hidden assumption in BIOS SMI,
    that is presumably valid on the proprietary OS
    where the BIOS was validated.

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

So here we effectively revert the patch above, restoring
the mwait_idle() loop.  However, we don't bother restoring
the idle=mwait cmdline parameter, since it appears to add
no value.

Maintainer notes:

  For 3.9, simply revert 69fb3676df
  for 3.10, patch -F3 applies, fuzz needed due to __cpuinit use in
  context For 3.11, 3.12, 3.13, this patch applies cleanly

Tested-by: Mike Galbraith <bitbucket@online.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Acked-by: Mike Galbraith <bitbucket@online.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ian Malone <ibmalone@gmail.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/345254a551eb5a6a866e048d7ab570fd2193aca4.1389763084.git.len.brown@intel.com
[ Ported to recent kernels. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Mike Galbraith <efault@gmx.de>
[ luis: backported to 3.16: used Mike's backport to 3.10 and 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/asm/mwait.h |  8 +++++++
 arch/x86/kernel/process.c    | 50 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
index 1da25a5f96f9..3ba047cbcf5b 100644
--- a/arch/x86/include/asm/mwait.h
+++ b/arch/x86/include/asm/mwait.h
@@ -30,6 +30,14 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
 		     :: "a" (eax), "c" (ecx));
 }
 
+static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
+{
+	trace_hardirqs_on();
+	/* "mwait %eax, %ecx;" */
+	asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
+		     :: "a" (eax), "c" (ecx));
+}
+
 /*
  * This uses new MONITOR/MWAIT instructions on P4 processors with PNI,
  * which can obviate IPI to trigger checking of need_resched.
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 4505e2a950d8..c98cff71760d 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -24,6 +24,7 @@
 #include <asm/syscalls.h>
 #include <asm/idle.h>
 #include <asm/uaccess.h>
+#include <asm/mwait.h>
 #include <asm/i387.h>
 #include <asm/fpu-internal.h>
 #include <asm/debugreg.h>
@@ -395,6 +396,52 @@ static void amd_e400_idle(void)
 		default_idle();
 }
 
+/*
+ * Intel Core2 and older machines prefer MWAIT over HALT for C1.
+ * We can't rely on cpuidle installing MWAIT, because it will not load
+ * on systems that support only C1 -- so the boot default must be MWAIT.
+ *
+ * Some AMD machines are the opposite, they depend on using HALT.
+ *
+ * So for default C1, which is used during boot until cpuidle loads,
+ * use MWAIT-C1 on Intel HW that has it, else use HALT.
+ */
+static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
+{
+	if (c->x86_vendor != X86_VENDOR_INTEL)
+		return 0;
+
+	if (!cpu_has(c, X86_FEATURE_MWAIT))
+		return 0;
+
+	return 1;
+}
+
+/*
+ * MONITOR/MWAIT with no hints, used for default default C1 state.
+ * This invokes MWAIT with interrutps enabled and no flags,
+ * which is backwards compatible with the original MWAIT implementation.
+ */
+
+static void mwait_idle(void)
+{
+	if (!current_set_polling_and_test()) {
+		if (static_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) {
+			mb();
+			clflush((void *)&current_thread_info()->flags);
+			mb();
+		}
+
+		__monitor((void *)&current_thread_info()->flags, 0, 0);
+		if (!need_resched())
+			__sti_mwait(0, 0);
+		else
+			local_irq_enable();
+	} else
+		local_irq_enable();
+	current_clr_polling();
+}
+
 void select_idle_routine(const struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_SMP
@@ -408,6 +455,9 @@ void select_idle_routine(const struct cpuinfo_x86 *c)
 		/* E400: APIC timer interrupt does not wake up CPU from C1e */
 		pr_info("using AMD E400 aware idle routine\n");
 		x86_idle = amd_e400_idle;
+	} else if (prefer_mwait_c1_over_halt(c)) {
+		pr_info("using mwait in idle threads\n");
+		x86_idle = mwait_idle;
 	} else
 		x86_idle = default_idle;
 }

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

* [PATCH 3.16.y-ckt 061/180] drm/radeon: fix doublescan modes (v2)
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (59 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 060/180] sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 062/180] usb: phy: Find the right match in devm_usb_phy_match Luis Henriques
                   ` (118 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

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

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

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

commit fd99a0943ffaa0320ea4f69d09ed188f950c0432 upstream.

Use the correct flags for atom.

v2: handle DRM_MODE_FLAG_DBLCLK

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/atombios_crtc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 9f0e62529c46..ce8cab52285b 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -330,8 +330,10 @@ atombios_set_crtc_dtd_timing(struct drm_crtc *crtc,
 		misc |= ATOM_COMPOSITESYNC;
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
 		misc |= ATOM_INTERLACE;
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
 		misc |= ATOM_DOUBLE_CLOCK_MODE;
+	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+		misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2;
 
 	args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
 	args.ucCRTC = radeon_crtc->crtc_id;
@@ -374,8 +376,10 @@ static void atombios_crtc_set_timing(struct drm_crtc *crtc,
 		misc |= ATOM_COMPOSITESYNC;
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
 		misc |= ATOM_INTERLACE;
-	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
 		misc |= ATOM_DOUBLE_CLOCK_MODE;
+	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+		misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2;
 
 	args.susModeMiscInfo.usAccess = cpu_to_le16(misc);
 	args.ucCRTC = radeon_crtc->crtc_id;

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

* [PATCH 3.16.y-ckt 062/180] usb: phy: Find the right match in devm_usb_phy_match
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (60 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 061/180] drm/radeon: fix doublescan modes (v2) Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 063/180] ASoC: pcm512x: Add 'Analogue' prefix to analogue volume controls Luis Henriques
                   ` (117 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Axel Lin, Felipe Balbi, Luis Henriques

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

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

From: Axel Lin <axel.lin@ingics.com>

commit 869aee0f31429fa9d94d5aef539602b73ae0cf4b upstream.

The res parameter passed to devm_usb_phy_match() is the location where the
pointer to the usb_phy is stored, hence it needs to be dereferenced before
comparing to the match data in order to find the correct match.

Fixes: 410219dcd2ba ("usb: otg: utils: devres: Add API's to associate a device with the phy")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/phy/phy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index fd0d7f122ace..1abe16acc828 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -78,7 +78,9 @@ static void devm_usb_phy_release(struct device *dev, void *res)
 
 static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
 {
-	return res == match_data;
+	struct usb_phy **phy = res;
+
+	return *phy == match_data;
 }
 
 /**

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

* [PATCH 3.16.y-ckt 063/180] ASoC: pcm512x: Add 'Analogue' prefix to analogue volume controls
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (61 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 062/180] usb: phy: Find the right match in devm_usb_phy_match Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 064/180] mmc: sunxi: Use devm_reset_control_get_optional() for reset control Luis Henriques
                   ` (116 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Howard Mitchell, Mark Brown, Luis Henriques

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

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

From: Howard Mitchell <hm@hmbedded.co.uk>

commit 4d9b13c7cc803fbde59d7e998f7de2b9a2101c7e upstream.

This is to ensure that 'alsactl restore' does not apply default
initialisation as the chip reset defaults are preferred.

Signed-off-by: Howard Mitchell <hm@hmbedded.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/pcm512x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
index f36414be3d22..3f8bcf73e567 100644
--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -261,9 +261,9 @@ static const struct soc_enum pcm512x_veds =
 static const struct snd_kcontrol_new pcm512x_controls[] = {
 SOC_DOUBLE_R_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2,
 		 PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
-SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
+SOC_DOUBLE_TLV("Analogue Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
 	       PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv),
-SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
+SOC_DOUBLE_TLV("Analogue Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
 	       PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv),
 SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
 	   PCM512x_RQMR_SHIFT, 1, 1),

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

* [PATCH 3.16.y-ckt 064/180] mmc: sunxi: Use devm_reset_control_get_optional() for reset control
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (62 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 063/180] ASoC: pcm512x: Add 'Analogue' prefix to analogue volume controls Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 065/180] x86: kvm: Revert "remove sched notifier for cross-cpu migrations" Luis Henriques
                   ` (115 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen-Yu Tsai, Ulf Hansson, Luis Henriques

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

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

From: Chen-Yu Tsai <wens@csie.org>

commit 9e71c589e44ddf2b86f361c81e360c6b0d0354b1 upstream.

The reset control for the sunxi mmc controller is optional. Some
newer platforms (sun6i, sun8i, sun9i) have it, while older ones
(sun4i, sun5i, sun7i) don't.

Use the properly stubbed _optional version so the driver does not
fail to compile when RESET_CONTROLLER=n.

This patch also adds a check for deferred probing on the reset
control.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: David Lanzendörfer <david.lanzendoerfer@o2s.ch>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mmc/host/sunxi-mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 024f67c98cdc..97823c68600a 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -909,7 +909,9 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
 		return PTR_ERR(host->clk_mmc);
 	}
 
-	host->reset = devm_reset_control_get(&pdev->dev, "ahb");
+	host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
+	if (PTR_ERR(host->reset) == -EPROBE_DEFER)
+		return PTR_ERR(host->reset);
 
 	ret = clk_prepare_enable(host->clk_ahb);
 	if (ret) {

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

* [PATCH 3.16.y-ckt 065/180] x86: kvm: Revert "remove sched notifier for cross-cpu migrations"
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (63 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 064/180] mmc: sunxi: Use devm_reset_control_get_optional() for reset control Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 066/180] tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING Luis Henriques
                   ` (114 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Marcelo Tosatti, Luis Henriques

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

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

From: Marcelo Tosatti <mtosatti@redhat.com>

commit 0a4e6be9ca17c54817cf814b4b5aa60478c6df27 upstream.

The following point:

    2. per-CPU pvclock time info is updated if the
       underlying CPU changes.

Is not true anymore since "KVM: x86: update pvclock area conditionally,
on cpu migration".

Add task migration notification back.

Problem noticed by Andy Lutomirski.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/asm/pvclock.h |  1 +
 arch/x86/kernel/pvclock.c      | 44 ++++++++++++++++++++++++++++++++++++++++++
 arch/x86/vdso/vclock_gettime.c | 16 +++++++--------
 include/linux/sched.h          |  8 ++++++++
 kernel/sched/core.c            | 15 ++++++++++++++
 5 files changed, 76 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index d6b078e9fa28..25b1cc07d496 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -95,6 +95,7 @@ unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
 
 struct pvclock_vsyscall_time_info {
 	struct pvclock_vcpu_time_info pvti;
+	u32 migrate_count;
 } __attribute__((__aligned__(SMP_CACHE_BYTES)));
 
 #define PVTI_SIZE sizeof(struct pvclock_vsyscall_time_info)
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index 2f355d229a58..e5ecd20e72dd 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -141,7 +141,46 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
 	set_normalized_timespec(ts, now.tv_sec, now.tv_nsec);
 }
 
+static struct pvclock_vsyscall_time_info *pvclock_vdso_info;
+
+static struct pvclock_vsyscall_time_info *
+pvclock_get_vsyscall_user_time_info(int cpu)
+{
+	if (!pvclock_vdso_info) {
+		BUG();
+		return NULL;
+	}
+
+	return &pvclock_vdso_info[cpu];
+}
+
+struct pvclock_vcpu_time_info *pvclock_get_vsyscall_time_info(int cpu)
+{
+	return &pvclock_get_vsyscall_user_time_info(cpu)->pvti;
+}
+
 #ifdef CONFIG_X86_64
+static int pvclock_task_migrate(struct notifier_block *nb, unsigned long l,
+			        void *v)
+{
+	struct task_migration_notifier *mn = v;
+	struct pvclock_vsyscall_time_info *pvti;
+
+	pvti = pvclock_get_vsyscall_user_time_info(mn->from_cpu);
+
+	/* this is NULL when pvclock vsyscall is not initialized */
+	if (unlikely(pvti == NULL))
+		return NOTIFY_DONE;
+
+	pvti->migrate_count++;
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block pvclock_migrate = {
+	.notifier_call = pvclock_task_migrate,
+};
+
 /*
  * Initialize the generic pvclock vsyscall state.  This will allocate
  * a/some page(s) for the per-vcpu pvclock information, set up a
@@ -155,12 +194,17 @@ int __init pvclock_init_vsyscall(struct pvclock_vsyscall_time_info *i,
 
 	WARN_ON (size != PVCLOCK_VSYSCALL_NR_PAGES*PAGE_SIZE);
 
+	pvclock_vdso_info = i;
+
 	for (idx = 0; idx <= (PVCLOCK_FIXMAP_END-PVCLOCK_FIXMAP_BEGIN); idx++) {
 		__set_fixmap(PVCLOCK_FIXMAP_BEGIN + idx,
 			     __pa(i) + (idx*PAGE_SIZE),
 			     PAGE_KERNEL_VVAR);
 	}
 
+
+	register_task_migration_notifier(&pvclock_migrate);
+
 	return 0;
 }
 #endif
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 9793322751e0..30933760ee5f 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -82,18 +82,15 @@ static notrace cycle_t vread_pvclock(int *mode)
 	cycle_t ret;
 	u64 last;
 	u32 version;
+	u32 migrate_count;
 	u8 flags;
 	unsigned cpu, cpu1;
 
 
 	/*
-	 * Note: hypervisor must guarantee that:
-	 * 1. cpu ID number maps 1:1 to per-CPU pvclock time info.
-	 * 2. that per-CPU pvclock time info is updated if the
-	 *    underlying CPU changes.
-	 * 3. that version is increased whenever underlying CPU
-	 *    changes.
-	 *
+	 * When looping to get a consistent (time-info, tsc) pair, we
+	 * also need to deal with the possibility we can switch vcpus,
+	 * so make sure we always re-fetch time-info for the current vcpu.
 	 */
 	do {
 		cpu = __getcpu() & VGETCPU_CPU_MASK;
@@ -104,6 +101,8 @@ static notrace cycle_t vread_pvclock(int *mode)
 
 		pvti = get_pvti(cpu);
 
+		migrate_count = pvti->migrate_count;
+
 		version = __pvclock_read_cycles(&pvti->pvti, &ret, &flags);
 
 		/*
@@ -115,7 +114,8 @@ static notrace cycle_t vread_pvclock(int *mode)
 		cpu1 = __getcpu() & VGETCPU_CPU_MASK;
 	} while (unlikely(cpu != cpu1 ||
 			  (pvti->pvti.version & 1) ||
-			  pvti->pvti.version != version));
+			  pvti->pvti.version != version ||
+			  pvti->migrate_count != migrate_count));
 
 	if (unlikely(!(flags & PVCLOCK_TSC_STABLE_BIT)))
 		*mode = VCLOCK_NONE;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c5cc872b351d..4bab946551e9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -174,6 +174,14 @@ extern unsigned long this_cpu_load(void);
 extern void calc_global_load(unsigned long ticks);
 extern void update_cpu_load_nohz(void);
 
+/* Notifier for when a task gets migrated to a new CPU */
+struct task_migration_notifier {
+	struct task_struct *task;
+	int from_cpu;
+	int to_cpu;
+};
+extern void register_task_migration_notifier(struct notifier_block *n);
+
 extern unsigned long get_parent_ip(unsigned long addr);
 
 extern void dump_cpu_task(int cpu);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2eb2e7992970..847922e4ba67 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1036,6 +1036,13 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
 		rq->skip_clock_update = 1;
 }
 
+static ATOMIC_NOTIFIER_HEAD(task_migration_notifier);
+
+void register_task_migration_notifier(struct notifier_block *n)
+{
+	atomic_notifier_chain_register(&task_migration_notifier, n);
+}
+
 #ifdef CONFIG_SMP
 void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 {
@@ -1066,10 +1073,18 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 	trace_sched_migrate_task(p, new_cpu);
 
 	if (task_cpu(p) != new_cpu) {
+		struct task_migration_notifier tmn;
+
 		if (p->sched_class->migrate_task_rq)
 			p->sched_class->migrate_task_rq(p, new_cpu);
 		p->se.nr_migrations++;
 		perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, NULL, 0);
+
+		tmn.task = p;
+		tmn.from_cpu = task_cpu(p);
+		tmn.to_cpu = new_cpu;
+
+		atomic_notifier_call_chain(&task_migration_notifier, 0, &tmn);
 	}
 
 	__set_task_cpu(p, new_cpu);

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

* [PATCH 3.16.y-ckt 066/180] tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (64 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 065/180] x86: kvm: Revert "remove sched notifier for cross-cpu migrations" Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 067/180] MIPS: Loongson-3: Add IRQF_NO_SUSPEND to Cascade irqaction Luis Henriques
                   ` (113 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Steven Rostedt, Andrew Morton, Jiri Olsa, Namhyung Kim,
	Arnaldo Carvalho de Melo, Luis Henriques

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

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

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

commit c5e691928bf166ac03430e957038b60adba3cf6c upstream.

When a event PADDING is hit (a deleted event that is still in the ring
buffer), translate_data() sets the length of the padding and also updates
the data pointer which is passed back to the caller.

This is unneeded because the caller also updates the data pointer with
the passed back length. translate_data() should not update the pointer,
only set the length.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150324135923.461431960@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 tools/lib/traceevent/kbuffer-parse.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
index dcc665228c71..deb3569ab004 100644
--- a/tools/lib/traceevent/kbuffer-parse.c
+++ b/tools/lib/traceevent/kbuffer-parse.c
@@ -372,7 +372,6 @@ translate_data(struct kbuffer *kbuf, void *data, void **rptr,
 	switch (type_len) {
 	case KBUFFER_TYPE_PADDING:
 		*length = read_4(kbuf, data);
-		data += *length;
 		break;
 
 	case KBUFFER_TYPE_TIME_EXTEND:

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

* [PATCH 3.16.y-ckt 067/180] MIPS: Loongson-3: Add IRQF_NO_SUSPEND to Cascade irqaction
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (65 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 066/180] tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 068/180] ring-buffer: Replace this_cpu_*() with __this_cpu_*() Luis Henriques
                   ` (112 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Huacai Chen, Steven J. Hill, linux-mips, Fuxin Zhang,
	Zhangjin Wu, Ralf Baechle, Luis Henriques

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

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

From: Huacai Chen <chenhc@lemote.com>

commit 0add9c2f1cff9f3f1f2eb7e9babefa872a9d14b9 upstream.

HPET irq is routed to i8259 and then to MIPS CPU irq (cascade). After
commit a3e6c1eff5 (MIPS: IRQ: Fix disable_irq on CPU IRQs), if without
IRQF_NO_SUSPEND in cascade_irqaction, HPET interrupts will lost during
suspend. The result is machine cannot be waken up.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/9528/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/loongson/loongson-3/irq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/loongson/loongson-3/irq.c b/arch/mips/loongson/loongson-3/irq.c
index f240828181ff..f2077f201a2a 100644
--- a/arch/mips/loongson/loongson-3/irq.c
+++ b/arch/mips/loongson/loongson-3/irq.c
@@ -42,6 +42,7 @@ void mach_irq_dispatch(unsigned int pending)
 
 static struct irqaction cascade_irqaction = {
 	.handler = no_action,
+	.flags = IRQF_NO_SUSPEND,
 	.name = "cascade",
 };
 

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

* [PATCH 3.16.y-ckt 068/180] ring-buffer: Replace this_cpu_*() with __this_cpu_*()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (66 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 067/180] MIPS: Loongson-3: Add IRQF_NO_SUSPEND to Cascade irqaction Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 069/180] HID: add HP OEM mouse to quirk ALWAYS_POLL Luis Henriques
                   ` (111 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Luis Henriques

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

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

From: Steven Rostedt <rostedt@goodmis.org>

commit 80a9b64e2c156b6523e7a01f2ba6e5d86e722814 upstream.

It has come to my attention that this_cpu_read/write are horrible on
architectures other than x86. Worse yet, they actually disable
preemption or interrupts! This caused some unexpected tracing results
on ARM.

   101.356868: preempt_count_add <-ring_buffer_lock_reserve
   101.356870: preempt_count_sub <-ring_buffer_lock_reserve

The ring_buffer_lock_reserve has recursion protection that requires
accessing a per cpu variable. But since preempt_disable() is traced, it
too got traced while accessing the variable that is suppose to prevent
recursion like this.

The generic version of this_cpu_read() and write() are:

 #define this_cpu_generic_read(pcp)					\
 ({	typeof(pcp) ret__;						\
	preempt_disable();						\
	ret__ = *this_cpu_ptr(&(pcp));					\
	preempt_enable();						\
	ret__;								\
 })

 #define this_cpu_generic_to_op(pcp, val, op)				\
 do {									\
	unsigned long flags;						\
	raw_local_irq_save(flags);					\
	*__this_cpu_ptr(&(pcp)) op val;					\
	raw_local_irq_restore(flags);					\
 } while (0)

Which is unacceptable for locations that know they are within preempt
disabled or interrupt disabled locations.

Paul McKenney stated that __this_cpu_() versions produce much better code on
other architectures than this_cpu_() does, if we know that the call is done in
a preempt disabled location.

I also changed the recursive_unlock() to use two local variables instead
of accessing the per_cpu variable twice.

Link: http://lkml.kernel.org/r/20150317114411.GE3589@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/20150317104038.312e73d1@gandalf.local.home

Acked-by: Christoph Lameter <cl@linux.com>
Reported-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/ring_buffer.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index a16472e40117..c2aad7276111 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2700,7 +2700,7 @@ static DEFINE_PER_CPU(unsigned int, current_context);
 
 static __always_inline int trace_recursive_lock(void)
 {
-	unsigned int val = this_cpu_read(current_context);
+	unsigned int val = __this_cpu_read(current_context);
 	int bit;
 
 	if (in_interrupt()) {
@@ -2717,18 +2717,17 @@ static __always_inline int trace_recursive_lock(void)
 		return 1;
 
 	val |= (1 << bit);
-	this_cpu_write(current_context, val);
+	__this_cpu_write(current_context, val);
 
 	return 0;
 }
 
 static __always_inline void trace_recursive_unlock(void)
 {
-	unsigned int val = this_cpu_read(current_context);
+	unsigned int val = __this_cpu_read(current_context);
 
-	val--;
-	val &= this_cpu_read(current_context);
-	this_cpu_write(current_context, val);
+	val &= val & (val - 1);
+	__this_cpu_write(current_context, val);
 }
 
 #else

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

* [PATCH 3.16.y-ckt 069/180] HID: add HP OEM mouse to quirk ALWAYS_POLL
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (67 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 068/180] ring-buffer: Replace this_cpu_*() with __this_cpu_*() Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 070/180] HID: add quirk for PIXART OEM mouse used by HP Luis Henriques
                   ` (110 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Jiri Kosina, Luis Henriques

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

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

From: Oliver Neukum <oneukum@suse.de>

commit 7a8e53c414c8183e8735e3b08d9a776200e6e665 upstream.

This mouse needs QUIRK_ALWAYS_POLL.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-ids.h           | 3 +++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 057ca39c029a..2992a8f5bc1c 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -454,6 +454,9 @@
 #define USB_DEVICE_ID_UGCI_FLYING	0x0020
 #define USB_DEVICE_ID_UGCI_FIGHTING	0x0030
 
+#define USB_VENDOR_ID_HP		0x03f0
+#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE	0x0a4a
+
 #define USB_VENDOR_ID_HUION		0x256c
 #define USB_DEVICE_ID_HUION_580		0x006e
 
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 8c2f6cb90444..d4317199c36a 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -78,6 +78,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },

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

* [PATCH 3.16.y-ckt 070/180] HID: add quirk for PIXART OEM mouse used by HP
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (68 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 069/180] HID: add HP OEM mouse to quirk ALWAYS_POLL Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 071/180] ASoC: wm8741: Fix rates constraints values Luis Henriques
                   ` (109 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Jiri Kosina, Luis Henriques

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

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

From: Oliver Neukum <oneukum@suse.de>

commit b70b82580248b5393241c986082842ec05a2b7d7 upstream.

This mouse is also known under other IDs. It needs the quirk or will disconnect
in runlevel 1 or 3.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 2992a8f5bc1c..e9aad0c8f2f7 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -456,6 +456,7 @@
 
 #define USB_VENDOR_ID_HP		0x03f0
 #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE	0x0a4a
+#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE		0x134a
 
 #define USB_VENDOR_ID_HUION		0x256c
 #define USB_DEVICE_ID_HUION_580		0x006e
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index d4317199c36a..ba05afc22eb5 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -79,6 +79,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
+	{ USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },

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

* [PATCH 3.16.y-ckt 071/180] ASoC: wm8741: Fix rates constraints values
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (69 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 070/180] HID: add quirk for PIXART OEM mouse used by HP Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 072/180] cdc-wdm: fix endianness bug in debug statements Luis Henriques
                   ` (108 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergej Sawazki, Mark Brown, Luis Henriques

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

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

From: Sergej Sawazki <ce3a@gmx.de>

commit 8787041d9bb832b9449b1eb878cedcebce42c61a upstream.

The WM8741 DAC supports the following typical audio sampling rates:
  44.1kHz, 88.2kHz, 176.4kHz (eg: with a master clock of 22.5792MHz)
  32kHz, 48kHz, 96kHz, 192kHz (eg: with a master clock of 24.576MHz)

For the rates lists, we should use 82000 instead of 88235, 176400
instead of 1764000 and 192000 instead of 19200 (seems to be a typo).

Signed-off-by: Sergej Sawazki <ce3a@gmx.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/wm8741.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index b33542a04607..e90520b9973e 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -123,7 +123,7 @@ static struct {
 };
 
 static const unsigned int rates_11289[] = {
-	44100, 88235,
+	44100, 88200,
 };
 
 static const struct snd_pcm_hw_constraint_list constraints_11289 = {
@@ -150,7 +150,7 @@ static const struct snd_pcm_hw_constraint_list constraints_16384 = {
 };
 
 static const unsigned int rates_16934[] = {
-	44100, 88235,
+	44100, 88200,
 };
 
 static const struct snd_pcm_hw_constraint_list constraints_16934 = {
@@ -168,7 +168,7 @@ static const struct snd_pcm_hw_constraint_list constraints_18432 = {
 };
 
 static const unsigned int rates_22579[] = {
-	44100, 88235, 1764000
+	44100, 88200, 176400
 };
 
 static const struct snd_pcm_hw_constraint_list constraints_22579 = {
@@ -186,7 +186,7 @@ static const struct snd_pcm_hw_constraint_list constraints_24576 = {
 };
 
 static const unsigned int rates_36864[] = {
-	48000, 96000, 19200
+	48000, 96000, 192000
 };
 
 static const struct snd_pcm_hw_constraint_list constraints_36864 = {

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

* [PATCH 3.16.y-ckt 072/180] cdc-wdm: fix endianness bug in debug statements
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (70 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 071/180] ASoC: wm8741: Fix rates constraints values Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 073/180] staging: panel: fix lcd type Luis Henriques
                   ` (107 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Greg Kroah-Hartman, Luis Henriques

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

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

From: Oliver Neukum <oneukum@suse.de>

commit 323ece54e0761198946ecd0c2091f1d2bfdfcb64 upstream.

Values directly from descriptors given in debug statements
must be converted to native endianness.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/class/cdc-wdm.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index a051a7a2b1bd..a81f9dd7ee97 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -245,7 +245,7 @@ static void wdm_int_callback(struct urb *urb)
 	case USB_CDC_NOTIFY_RESPONSE_AVAILABLE:
 		dev_dbg(&desc->intf->dev,
 			"NOTIFY_RESPONSE_AVAILABLE received: index %d len %d",
-			dr->wIndex, dr->wLength);
+			le16_to_cpu(dr->wIndex), le16_to_cpu(dr->wLength));
 		break;
 
 	case USB_CDC_NOTIFY_NETWORK_CONNECTION:
@@ -262,7 +262,9 @@ static void wdm_int_callback(struct urb *urb)
 		clear_bit(WDM_POLL_RUNNING, &desc->flags);
 		dev_err(&desc->intf->dev,
 			"unknown notification %d received: index %d len %d\n",
-			dr->bNotificationType, dr->wIndex, dr->wLength);
+			dr->bNotificationType,
+			le16_to_cpu(dr->wIndex),
+			le16_to_cpu(dr->wLength));
 		goto exit;
 	}
 
@@ -408,7 +410,7 @@ static ssize_t wdm_write
 			     USB_RECIP_INTERFACE);
 	req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND;
 	req->wValue = 0;
-	req->wIndex = desc->inum;
+	req->wIndex = desc->inum; /* already converted */
 	req->wLength = cpu_to_le16(count);
 	set_bit(WDM_IN_USE, &desc->flags);
 	desc->outbuf = buf;
@@ -422,7 +424,7 @@ static ssize_t wdm_write
 		rv = usb_translate_errors(rv);
 	} else {
 		dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
-			req->wIndex);
+			le16_to_cpu(req->wIndex));
 	}
 out:
 	usb_autopm_put_interface(desc->intf);
@@ -820,7 +822,7 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
 	desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
 	desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE;
 	desc->irq->wValue = 0;
-	desc->irq->wIndex = desc->inum;
+	desc->irq->wIndex = desc->inum; /* already converted */
 	desc->irq->wLength = cpu_to_le16(desc->wMaxCommand);
 
 	usb_fill_control_urb(

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

* [PATCH 3.16.y-ckt 073/180] staging: panel: fix lcd type
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (71 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 072/180] cdc-wdm: fix endianness bug in debug statements Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 074/180] UBI: account for bitflips in both the VID header and data Luis Henriques
                   ` (106 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sudip Mukherjee, Greg Kroah-Hartman, Luis Henriques

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

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

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

commit 2c20d92dad5db6440cfa88d811b69fd605240ce4 upstream.

the lcd type as defined in the Kconfig is not matching in the code.
as a result the rs, rw and en pins were getting interchanged.
Kconfig defines the value of PANEL_LCD to be 1 if we select custom
configuration but in the code LCD_TYPE_CUSTOM is defined as 5.

my hardware is LCD_TYPE_CUSTOM, but the pins were assigned to it
as pins of LCD_TYPE_OLD, and it was not working.
Now values are corrected with referenece to the values defined in
Kconfig and it is working.
checked on JHD204A lcd with LCD_TYPE_CUSTOM configuration.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/panel/panel.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 4e9229363c36..7e2063fa924d 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -275,11 +275,11 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
  * LCD types
  */
 #define LCD_TYPE_NONE		0
-#define LCD_TYPE_OLD		1
-#define LCD_TYPE_KS0074		2
-#define LCD_TYPE_HANTRONIX	3
-#define LCD_TYPE_NEXCOM		4
-#define LCD_TYPE_CUSTOM		5
+#define LCD_TYPE_CUSTOM		1
+#define LCD_TYPE_OLD		2
+#define LCD_TYPE_KS0074		3
+#define LCD_TYPE_HANTRONIX	4
+#define LCD_TYPE_NEXCOM		5
 
 /*
  * keypad types
@@ -457,7 +457,7 @@ MODULE_PARM_DESC(keypad_enabled, "Deprecated option, use keypad_type instead");
 static int lcd_type = -1;
 module_param(lcd_type, int, 0000);
 MODULE_PARM_DESC(lcd_type,
-		 "LCD type: 0=none, 1=old //, 2=serial ks0074, 3=hantronix //, 4=nexcom //, 5=compiled-in");
+		 "LCD type: 0=none, 1=compiled-in, 2=old, 3=serial ks0074, 4=hantronix, 5=nexcom");
 
 static int lcd_proto = -1;
 module_param(lcd_proto, int, 0000);

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

* [PATCH 3.16.y-ckt 074/180] UBI: account for bitflips in both the VID header and data
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (72 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 073/180] staging: panel: fix lcd type Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 075/180] UBI: fix out of bounds write Luis Henriques
                   ` (105 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian Norris, Richard Weinberger, Luis Henriques

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

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

From: Brian Norris <computersforpeace@gmail.com>

commit 8eef7d70f7c6772c3490f410ee2bceab3b543fa1 upstream.

We are completely discarding the earlier value of 'bitflips', which
could reflect a bitflip found in ubi_io_read_vid_hdr(). Let's use the
bitwise OR of header and data 'bitflip' statuses instead.

Coverity CID #1226856

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/ubi/attach.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 6f27d9a1be3b..21841fe25ad3 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -408,7 +408,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
 		second_is_newer = !second_is_newer;
 	} else {
 		dbg_bld("PEB %d CRC is OK", pnum);
-		bitflips = !!err;
+		bitflips |= !!err;
 	}
 	mutex_unlock(&ubi->buf_mutex);
 

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

* [PATCH 3.16.y-ckt 075/180] UBI: fix out of bounds write
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (73 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 074/180] UBI: account for bitflips in both the VID header and data Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 076/180] UBI: initialize LEB number variable Luis Henriques
                   ` (104 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian Norris, Richard Weinberger, Luis Henriques

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

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

From: Brian Norris <computersforpeace@gmail.com>

commit d74adbdb9abf0d2506a6c4afa534d894f28b763f upstream.

If aeb->len >= vol->reserved_pebs, we should not be writing aeb into the
PEB->LEB mapping.

Caught by Coverity, CID #711212.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/ubi/eba.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 0e11671dadc4..930cf2c77abb 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -1362,7 +1362,8 @@ int ubi_eba_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
 				 * during re-size.
 				 */
 				ubi_move_aeb_to_list(av, aeb, &ai->erase);
-			vol->eba_tbl[aeb->lnum] = aeb->pnum;
+			else
+				vol->eba_tbl[aeb->lnum] = aeb->pnum;
 		}
 	}
 

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

* [PATCH 3.16.y-ckt 076/180] UBI: initialize LEB number variable
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (74 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 075/180] UBI: fix out of bounds write Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 077/180] UBI: fix check for "too many bytes" Luis Henriques
                   ` (103 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian Norris, Richard Weinberger, Luis Henriques

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

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

From: Brian Norris <computersforpeace@gmail.com>

commit f16db8071ce18819fbd705ddcc91c6f392fb61f8 upstream.

In some of the 'out_not_moved' error paths, lnum may be used
uninitialized. Don't ignore the warning; let's fix it.

This uninitialized variable doesn't have much visible effect in the end,
since we just schedule the PEB for erasure, and its LEB number doesn't
really matter (it just gets printed in debug messages). But let's get it
straight anyway.

Coverity CID #113449

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/ubi/wl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 89d51f94db11..31afc91a326f 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1000,7 +1000,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
 				int cancel)
 {
 	int err, scrubbing = 0, torture = 0, protect = 0, erroneous = 0;
-	int vol_id = -1, uninitialized_var(lnum);
+	int vol_id = -1, lnum = -1;
 #ifdef CONFIG_MTD_UBI_FASTMAP
 	int anchor = wrk->anchor;
 #endif

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

* [PATCH 3.16.y-ckt 077/180] UBI: fix check for "too many bytes"
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (75 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 076/180] UBI: initialize LEB number variable Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 078/180] ARM: S3C64XX: Use fixed IRQ bases to avoid conflicts on Cragganmore Luis Henriques
                   ` (102 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian Norris, Richard Weinberger, Luis Henriques

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

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

From: Brian Norris <computersforpeace@gmail.com>

commit 299d0c5b27346a77a0777c993372bf8777d4f2e5 upstream.

The comparison from the previous line seems to have been erroneously
(partially) copied-and-pasted onto the next. The second line should be
checking req.bytes, not req.lnum.

Coverity CID #139400

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
[rw: Fixed comparison]
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/ubi/cdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 7646220ca6e2..0a2a16111429 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -451,7 +451,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
 		/* Validate the request */
 		err = -EINVAL;
 		if (req.lnum < 0 || req.lnum >= vol->reserved_pebs ||
-		    req.bytes < 0 || req.lnum >= vol->usable_leb_size)
+		    req.bytes < 0 || req.bytes > vol->usable_leb_size)
 			break;
 
 		err = get_exclusive(desc);

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

* [PATCH 3.16.y-ckt 078/180] ARM: S3C64XX: Use fixed IRQ bases to avoid conflicts on Cragganmore
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (76 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 077/180] UBI: fix check for "too many bytes" Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 079/180] ASoC: davinci-evm: drop un-necessary remove function Luis Henriques
                   ` (101 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Charles Keepax, Kukjin Kim, Luis Henriques

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

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

From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

commit 4e330ae4ab2915444f1e6dca1358a910aa259362 upstream.

There are two PMICs on Cragganmore, currently one dynamically assign
its IRQ base and the other uses a fixed base. It is possible for the
statically assigned PMIC to fail if its IRQ is taken by the dynamically
assigned one. Fix this by statically assigning both the IRQ bases.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mach-s3c64xx/crag6410.h      | 1 +
 arch/arm/mach-s3c64xx/mach-crag6410.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/mach-s3c64xx/crag6410.h b/arch/arm/mach-s3c64xx/crag6410.h
index 7bc66682687e..dcbe17f5e5f8 100644
--- a/arch/arm/mach-s3c64xx/crag6410.h
+++ b/arch/arm/mach-s3c64xx/crag6410.h
@@ -14,6 +14,7 @@
 #include <mach/gpio-samsung.h>
 
 #define GLENFARCLAS_PMIC_IRQ_BASE	IRQ_BOARD_START
+#define BANFF_PMIC_IRQ_BASE		(IRQ_BOARD_START + 64)
 
 #define PCA935X_GPIO_BASE		GPIO_BOARD_START
 #define CODEC_GPIO_BASE			(GPIO_BOARD_START + 8)
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 4b0199fff9f5..e57dd645309b 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -555,6 +555,7 @@ static struct wm831x_touch_pdata touch_pdata = {
 
 static struct wm831x_pdata crag_pmic_pdata = {
 	.wm831x_num = 1,
+	.irq_base = BANFF_PMIC_IRQ_BASE,
 	.gpio_base = BANFF_PMIC_GPIO_BASE,
 	.soft_shutdown = true,
 

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

* [PATCH 3.16.y-ckt 079/180] ASoC: davinci-evm: drop un-necessary remove function
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (77 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 078/180] ARM: S3C64XX: Use fixed IRQ bases to avoid conflicts on Cragganmore Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 080/180] iscsi-target: Convert iscsi_thread_set usage to kthread.h Luis Henriques
                   ` (100 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Manish Badarkhe, Jyri Sarha, Mark Brown, Luis Henriques

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

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

From: Manish Badarkhe <manishvb@ti.com>

commit a57069e33fbc6625f39e1b09c88ea44629a35206 upstream.

As davinci card gets registered using 'devm_' api
there is no need to unregister the card in 'remove'
function.
Hence drop the 'remove' function.

Fixes: ee2f615d6e59c (ASoC: davinci-evm: Add device tree binding)
Signed-off-by: Manish Badarkhe <manishvb@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/davinci/davinci-evm.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index a50010e2891f..82837e5e96ab 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -431,18 +431,8 @@ static int davinci_evm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int davinci_evm_remove(struct platform_device *pdev)
-{
-	struct snd_soc_card *card = platform_get_drvdata(pdev);
-
-	snd_soc_unregister_card(card);
-
-	return 0;
-}
-
 static struct platform_driver davinci_evm_driver = {
 	.probe		= davinci_evm_probe,
-	.remove		= davinci_evm_remove,
 	.driver		= {
 		.name	= "davinci_evm",
 		.owner	= THIS_MODULE,

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

* [PATCH 3.16.y-ckt 080/180] iscsi-target: Convert iscsi_thread_set usage to kthread.h
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (78 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 079/180] ASoC: davinci-evm: drop un-necessary remove function Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 081/180] Drivers: hv: vmbus: Don't wait after requesting offers Luis Henriques
                   ` (99 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Slava Shwartsman, Nicholas Bellinger, Luis Henriques

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

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

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

commit 88dcd2dab5c23b1c9cfc396246d8f476c872f0ca upstream.

This patch converts iscsi-target code to use modern kthread.h API
callers for creating RX/TX threads for each new iscsi_conn descriptor,
and releasing associated RX/TX threads during connection shutdown.

This is done using iscsit_start_kthreads() -> kthread_run() to start
new kthreads from within iscsi_post_login_handler(), and invoking
kthread_stop() from existing iscsit_close_connection() code.

Also, convert iscsit_logout_post_handler_closesession() code to use
cmpxchg when determing when iscsit_cause_connection_reinstatement()
needs to sleep waiting for completion.

Reported-by: Sagi Grimberg <sagig@mellanox.com>
Tested-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Slava Shwartsman <valyushash@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[ luis: backported to 3.16:
  - file rename: include/target/iscsi/iscsi_target_core.h ->
    drivers/target/iscsi/iscsi_target_core.h
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/iscsi/iscsi_target.c       | 104 +++++++++++++-----------------
 drivers/target/iscsi/iscsi_target_core.h  |   7 ++
 drivers/target/iscsi/iscsi_target_erl0.c  |  13 ++--
 drivers/target/iscsi/iscsi_target_login.c |  59 +++++++++++++++--
 4 files changed, 114 insertions(+), 69 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index ef91651a3714..8932cb2e9165 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -537,7 +537,7 @@ static struct iscsit_transport iscsi_target_transport = {
 
 static int __init iscsi_target_init_module(void)
 {
-	int ret = 0;
+	int ret = 0, size;
 
 	pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
 
@@ -546,6 +546,7 @@ static int __init iscsi_target_init_module(void)
 		pr_err("Unable to allocate memory for iscsit_global\n");
 		return -1;
 	}
+	spin_lock_init(&iscsit_global->ts_bitmap_lock);
 	mutex_init(&auth_id_lock);
 	spin_lock_init(&sess_idr_lock);
 	idr_init(&tiqn_idr);
@@ -555,15 +556,11 @@ static int __init iscsi_target_init_module(void)
 	if (ret < 0)
 		goto out;
 
-	ret = iscsi_thread_set_init();
-	if (ret < 0)
+	size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long);
+	iscsit_global->ts_bitmap = vzalloc(size);
+	if (!iscsit_global->ts_bitmap) {
+		pr_err("Unable to allocate iscsit_global->ts_bitmap\n");
 		goto configfs_out;
-
-	if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) !=
-			TARGET_THREAD_SET_COUNT) {
-		pr_err("iscsi_allocate_thread_sets() returned"
-			" unexpected value!\n");
-		goto ts_out1;
 	}
 
 	lio_qr_cache = kmem_cache_create("lio_qr_cache",
@@ -572,7 +569,7 @@ static int __init iscsi_target_init_module(void)
 	if (!lio_qr_cache) {
 		pr_err("nable to kmem_cache_create() for"
 				" lio_qr_cache\n");
-		goto ts_out2;
+		goto bitmap_out;
 	}
 
 	lio_dr_cache = kmem_cache_create("lio_dr_cache",
@@ -616,10 +613,8 @@ dr_out:
 	kmem_cache_destroy(lio_dr_cache);
 qr_out:
 	kmem_cache_destroy(lio_qr_cache);
-ts_out2:
-	iscsi_deallocate_thread_sets();
-ts_out1:
-	iscsi_thread_set_free();
+bitmap_out:
+	vfree(iscsit_global->ts_bitmap);
 configfs_out:
 	iscsi_target_deregister_configfs();
 out:
@@ -629,8 +624,6 @@ out:
 
 static void __exit iscsi_target_cleanup_module(void)
 {
-	iscsi_deallocate_thread_sets();
-	iscsi_thread_set_free();
 	iscsit_release_discovery_tpg();
 	iscsit_unregister_transport(&iscsi_target_transport);
 	kmem_cache_destroy(lio_qr_cache);
@@ -640,6 +633,7 @@ static void __exit iscsi_target_cleanup_module(void)
 
 	iscsi_target_deregister_configfs();
 
+	vfree(iscsit_global->ts_bitmap);
 	kfree(iscsit_global);
 }
 
@@ -3680,17 +3674,16 @@ static int iscsit_send_reject(
 
 void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
 {
-	struct iscsi_thread_set *ts = conn->thread_set;
 	int ord, cpu;
 	/*
-	 * thread_id is assigned from iscsit_global->ts_bitmap from
-	 * within iscsi_thread_set.c:iscsi_allocate_thread_sets()
+	 * bitmap_id is assigned from iscsit_global->ts_bitmap from
+	 * within iscsit_start_kthreads()
 	 *
-	 * Here we use thread_id to determine which CPU that this
-	 * iSCSI connection's iscsi_thread_set will be scheduled to
+	 * Here we use bitmap_id to determine which CPU that this
+	 * iSCSI connection's RX/TX threads will be scheduled to
 	 * execute upon.
 	 */
-	ord = ts->thread_id % cpumask_weight(cpu_online_mask);
+	ord = conn->bitmap_id % cpumask_weight(cpu_online_mask);
 	for_each_online_cpu(cpu) {
 		if (ord-- == 0) {
 			cpumask_set_cpu(cpu, conn->conn_cpumask);
@@ -3882,7 +3875,7 @@ check_rsp_state:
 	switch (state) {
 	case ISTATE_SEND_LOGOUTRSP:
 		if (!iscsit_logout_post_handler(cmd, conn))
-			goto restart;
+			return -ECONNRESET;
 		/* fall through */
 	case ISTATE_SEND_STATUS:
 	case ISTATE_SEND_ASYNCMSG:
@@ -3910,8 +3903,6 @@ check_rsp_state:
 
 err:
 	return -1;
-restart:
-	return -EAGAIN;
 }
 
 static int iscsit_handle_response_queue(struct iscsi_conn *conn)
@@ -3938,21 +3929,13 @@ static int iscsit_handle_response_queue(struct iscsi_conn *conn)
 int iscsi_target_tx_thread(void *arg)
 {
 	int ret = 0;
-	struct iscsi_conn *conn;
-	struct iscsi_thread_set *ts = arg;
+	struct iscsi_conn *conn = arg;
 	/*
 	 * Allow ourselves to be interrupted by SIGINT so that a
 	 * connection recovery / failure event can be triggered externally.
 	 */
 	allow_signal(SIGINT);
 
-restart:
-	conn = iscsi_tx_thread_pre_handler(ts);
-	if (!conn)
-		goto out;
-
-	ret = 0;
-
 	while (!kthread_should_stop()) {
 		/*
 		 * Ensure that both TX and RX per connection kthreads
@@ -3961,11 +3944,9 @@ restart:
 		iscsit_thread_check_cpumask(conn, current, 1);
 
 		wait_event_interruptible(conn->queues_wq,
-					 !iscsit_conn_all_queues_empty(conn) ||
-					 ts->status == ISCSI_THREAD_SET_RESET);
+					 !iscsit_conn_all_queues_empty(conn));
 
-		if ((ts->status == ISCSI_THREAD_SET_RESET) ||
-		     signal_pending(current))
+		if (signal_pending(current))
 			goto transport_err;
 
 get_immediate:
@@ -3976,15 +3957,14 @@ get_immediate:
 		ret = iscsit_handle_response_queue(conn);
 		if (ret == 1)
 			goto get_immediate;
-		else if (ret == -EAGAIN)
-			goto restart;
+		else if (ret == -ECONNRESET)
+			goto out;
 		else if (ret < 0)
 			goto transport_err;
 	}
 
 transport_err:
 	iscsit_take_action_for_connection_exit(conn);
-	goto restart;
 out:
 	return 0;
 }
@@ -4073,8 +4053,7 @@ int iscsi_target_rx_thread(void *arg)
 	int ret;
 	u8 buffer[ISCSI_HDR_LEN], opcode;
 	u32 checksum = 0, digest = 0;
-	struct iscsi_conn *conn = NULL;
-	struct iscsi_thread_set *ts = arg;
+	struct iscsi_conn *conn = arg;
 	struct kvec iov;
 	/*
 	 * Allow ourselves to be interrupted by SIGINT so that a
@@ -4082,11 +4061,6 @@ int iscsi_target_rx_thread(void *arg)
 	 */
 	allow_signal(SIGINT);
 
-restart:
-	conn = iscsi_rx_thread_pre_handler(ts);
-	if (!conn)
-		goto out;
-
 	if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) {
 		struct completion comp;
 		int rc;
@@ -4096,7 +4070,7 @@ restart:
 		if (rc < 0)
 			goto transport_err;
 
-		goto out;
+		goto transport_err;
 	}
 
 	while (!kthread_should_stop()) {
@@ -4172,8 +4146,6 @@ transport_err:
 	if (!signal_pending(current))
 		atomic_set(&conn->transport_failed, 1);
 	iscsit_take_action_for_connection_exit(conn);
-	goto restart;
-out:
 	return 0;
 }
 
@@ -4235,7 +4207,24 @@ int iscsit_close_connection(
 	if (conn->conn_transport->transport_type == ISCSI_TCP)
 		complete(&conn->conn_logout_comp);
 
-	iscsi_release_thread_set(conn);
+	if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) {
+		if (conn->tx_thread &&
+		    cmpxchg(&conn->tx_thread_active, true, false)) {
+			send_sig(SIGINT, conn->tx_thread, 1);
+			kthread_stop(conn->tx_thread);
+		}
+	} else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) {
+		if (conn->rx_thread &&
+		    cmpxchg(&conn->rx_thread_active, true, false)) {
+			send_sig(SIGINT, conn->rx_thread, 1);
+			kthread_stop(conn->rx_thread);
+		}
+	}
+
+	spin_lock(&iscsit_global->ts_bitmap_lock);
+	bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
+			      get_order(1));
+	spin_unlock(&iscsit_global->ts_bitmap_lock);
 
 	iscsit_stop_timers_for_cmds(conn);
 	iscsit_stop_nopin_response_timer(conn);
@@ -4514,15 +4503,13 @@ static void iscsit_logout_post_handler_closesession(
 	struct iscsi_conn *conn)
 {
 	struct iscsi_session *sess = conn->sess;
-
-	iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
-	iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
+	int sleep = cmpxchg(&conn->tx_thread_active, true, false);
 
 	atomic_set(&conn->conn_logout_remove, 0);
 	complete(&conn->conn_logout_comp);
 
 	iscsit_dec_conn_usage_count(conn);
-	iscsit_stop_session(sess, 1, 1);
+	iscsit_stop_session(sess, sleep, sleep);
 	iscsit_dec_session_usage_count(sess);
 	target_put_session(sess->se_sess);
 }
@@ -4530,13 +4517,12 @@ static void iscsit_logout_post_handler_closesession(
 static void iscsit_logout_post_handler_samecid(
 	struct iscsi_conn *conn)
 {
-	iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
-	iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
+	int sleep = cmpxchg(&conn->tx_thread_active, true, false);
 
 	atomic_set(&conn->conn_logout_remove, 0);
 	complete(&conn->conn_logout_comp);
 
-	iscsit_cause_connection_reinstatement(conn, 1);
+	iscsit_cause_connection_reinstatement(conn, sleep);
 	iscsit_dec_conn_usage_count(conn);
 }
 
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
index 302eb3b78715..2423f27e4670 100644
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -602,6 +602,11 @@ struct iscsi_conn {
 	struct iscsi_session	*sess;
 	/* Pointer to thread_set in use for this conn's threads */
 	struct iscsi_thread_set	*thread_set;
+	int			bitmap_id;
+	int			rx_thread_active;
+	struct task_struct	*rx_thread;
+	int			tx_thread_active;
+	struct task_struct	*tx_thread;
 	/* list_head for session connection list */
 	struct list_head	conn_list;
 } ____cacheline_aligned;
@@ -872,10 +877,12 @@ struct iscsit_global {
 	/* Unique identifier used for the authentication daemon */
 	u32			auth_id;
 	u32			inactive_ts;
+#define ISCSIT_BITMAP_BITS	262144
 	/* Thread Set bitmap count */
 	int			ts_bitmap_count;
 	/* Thread Set bitmap pointer */
 	unsigned long		*ts_bitmap;
+	spinlock_t		ts_bitmap_lock;
 	/* Used for iSCSI discovery session authentication */
 	struct iscsi_node_acl	discovery_acl;
 	struct iscsi_portal_group	*discovery_tpg;
diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
index 0d1e6ee3e992..7396d90d96b2 100644
--- a/drivers/target/iscsi/iscsi_target_erl0.c
+++ b/drivers/target/iscsi/iscsi_target_erl0.c
@@ -864,7 +864,10 @@ void iscsit_connection_reinstatement_rcfr(struct iscsi_conn *conn)
 	}
 	spin_unlock_bh(&conn->state_lock);
 
-	iscsi_thread_set_force_reinstatement(conn);
+	if (conn->tx_thread && conn->tx_thread_active)
+		send_sig(SIGINT, conn->tx_thread, 1);
+	if (conn->rx_thread && conn->rx_thread_active)
+		send_sig(SIGINT, conn->rx_thread, 1);
 
 sleep:
 	wait_for_completion(&conn->conn_wait_rcfr_comp);
@@ -889,10 +892,10 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep)
 		return;
 	}
 
-	if (iscsi_thread_set_force_reinstatement(conn) < 0) {
-		spin_unlock_bh(&conn->state_lock);
-		return;
-	}
+	if (conn->tx_thread && conn->tx_thread_active)
+		send_sig(SIGINT, conn->tx_thread, 1);
+	if (conn->rx_thread && conn->rx_thread_active)
+		send_sig(SIGINT, conn->rx_thread, 1);
 
 	atomic_set(&conn->connection_reinstatement, 1);
 	if (!sleep) {
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index dabc7e770b00..cb45313182b7 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -699,6 +699,51 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn)
 		iscsit_start_nopin_timer(conn);
 }
 
+int iscsit_start_kthreads(struct iscsi_conn *conn)
+{
+	int ret = 0;
+
+	spin_lock(&iscsit_global->ts_bitmap_lock);
+	conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap,
+					ISCSIT_BITMAP_BITS, get_order(1));
+	spin_unlock(&iscsit_global->ts_bitmap_lock);
+
+	if (conn->bitmap_id < 0) {
+		pr_err("bitmap_find_free_region() failed for"
+		       " iscsit_start_kthreads()\n");
+		return -ENOMEM;
+	}
+
+	conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn,
+				      "%s", ISCSI_TX_THREAD_NAME);
+	if (IS_ERR(conn->tx_thread)) {
+		pr_err("Unable to start iscsi_target_tx_thread\n");
+		ret = PTR_ERR(conn->tx_thread);
+		goto out_bitmap;
+	}
+	conn->tx_thread_active = true;
+
+	conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
+				      "%s", ISCSI_RX_THREAD_NAME);
+	if (IS_ERR(conn->rx_thread)) {
+		pr_err("Unable to start iscsi_target_rx_thread\n");
+		ret = PTR_ERR(conn->rx_thread);
+		goto out_tx;
+	}
+	conn->rx_thread_active = true;
+
+	return 0;
+out_tx:
+	kthread_stop(conn->tx_thread);
+	conn->tx_thread_active = false;
+out_bitmap:
+	spin_lock(&iscsit_global->ts_bitmap_lock);
+	bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
+			      get_order(1));
+	spin_unlock(&iscsit_global->ts_bitmap_lock);
+	return ret;
+}
+
 int iscsi_post_login_handler(
 	struct iscsi_np *np,
 	struct iscsi_conn *conn,
@@ -709,7 +754,7 @@ int iscsi_post_login_handler(
 	struct se_session *se_sess = sess->se_sess;
 	struct iscsi_portal_group *tpg = sess->tpg;
 	struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
-	struct iscsi_thread_set *ts;
+	int rc;
 
 	iscsit_inc_conn_usage_count(conn);
 
@@ -724,7 +769,6 @@ int iscsi_post_login_handler(
 	/*
 	 * SCSI Initiator -> SCSI Target Port Mapping
 	 */
-	ts = iscsi_get_thread_set();
 	if (!zero_tsih) {
 		iscsi_set_session_parameters(sess->sess_ops,
 				conn->param_list, 0);
@@ -751,9 +795,11 @@ int iscsi_post_login_handler(
 			sess->sess_ops->InitiatorName);
 		spin_unlock_bh(&sess->conn_lock);
 
-		iscsi_post_login_start_timers(conn);
+		rc = iscsit_start_kthreads(conn);
+		if (rc)
+			return rc;
 
-		iscsi_activate_thread_set(conn, ts);
+		iscsi_post_login_start_timers(conn);
 		/*
 		 * Determine CPU mask to ensure connection's RX and TX kthreads
 		 * are scheduled on the same CPU.
@@ -810,8 +856,11 @@ int iscsi_post_login_handler(
 		" iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt);
 	spin_unlock_bh(&se_tpg->session_lock);
 
+	rc = iscsit_start_kthreads(conn);
+	if (rc)
+		return rc;
+
 	iscsi_post_login_start_timers(conn);
-	iscsi_activate_thread_set(conn, ts);
 	/*
 	 * Determine CPU mask to ensure connection's RX and TX kthreads
 	 * are scheduled on the same CPU.

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

* [PATCH 3.16.y-ckt 081/180] Drivers: hv: vmbus: Don't wait after requesting offers
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (79 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 080/180] iscsi-target: Convert iscsi_thread_set usage to kthread.h Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 082/180] Btrfs: fix log tree corruption when fs mounted with -o discard Luis Henriques
                   ` (98 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, Greg Kroah-Hartman, Luis Henriques

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

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

From: "K. Y. Srinivasan" <kys@microsoft.com>

commit 73cffdb65e679b98893f484063462c045adcf212 upstream.

Don't wait after sending request for offers to the host. This wait is
unnecessary and simply adds 5 seconds to the boot time.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hv/channel_mgmt.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 75330b3e388e..10953ece3307 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -758,7 +758,7 @@ int vmbus_request_offers(void)
 {
 	struct vmbus_channel_message_header *msg;
 	struct vmbus_channel_msginfo *msginfo;
-	int ret, t;
+	int ret;
 
 	msginfo = kmalloc(sizeof(*msginfo) +
 			  sizeof(struct vmbus_channel_message_header),
@@ -766,8 +766,6 @@ int vmbus_request_offers(void)
 	if (!msginfo)
 		return -ENOMEM;
 
-	init_completion(&msginfo->waitevent);
-
 	msg = (struct vmbus_channel_message_header *)msginfo->msg;
 
 	msg->msgtype = CHANNELMSG_REQUESTOFFERS;
@@ -781,14 +779,6 @@ int vmbus_request_offers(void)
 		goto cleanup;
 	}
 
-	t = wait_for_completion_timeout(&msginfo->waitevent, 5*HZ);
-	if (t == 0) {
-		ret = -ETIMEDOUT;
-		goto cleanup;
-	}
-
-
-
 cleanup:
 	kfree(msginfo);
 

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

* [PATCH 3.16.y-ckt 082/180] Btrfs: fix log tree corruption when fs mounted with -o discard
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (80 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 081/180] Drivers: hv: vmbus: Don't wait after requesting offers Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 083/180] btrfs: don't accept bare namespace as a valid xattr Luis Henriques
                   ` (97 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Filipe Manana, Chris Mason, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit dcc82f4783ad91d4ab654f89f37ae9291cdc846a upstream.

While committing a transaction we free the log roots before we write the
new super block. Freeing the log roots implies marking the disk location
of every node/leaf (metadata extent) as pinned before the new super block
is written. This is to prevent the disk location of log metadata extents
from being reused before the new super block is written, otherwise we
would have a corrupted log tree if before the new super block is written
a crash/reboot happens and the location of any log tree metadata extent
ended up being reused and rewritten.

Even though we pinned the log tree's metadata extents, we were issuing a
discard against them if the fs was mounted with the -o discard option,
resulting in corruption of the log tree if a crash/reboot happened before
writing the new super block - the next time the fs was mounted, during
the log replay process we would find nodes/leafs of the log btree with
a content full of zeroes, causing the process to fail and require the
use of the tool btrfs-zero-log to wipeout the log tree (and all data
previously fsynced becoming lost forever).

Fix this by not doing a discard when pinning an extent. The discard will
be done later when it's safe (after the new super block is committed) at
extent-tree.c:btrfs_finish_extent_commit().

Fixes: e688b7252f78 (Btrfs: fix extent pinning bugs in the tree log)
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/extent-tree.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 58f014a2bba1..b6f19735d6a8 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6971,12 +6971,11 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root,
 		return -ENOSPC;
 	}
 
-	if (btrfs_test_opt(root, DISCARD))
-		ret = btrfs_discard_extent(root, start, len, NULL);
-
 	if (pin)
 		pin_down_extent(root, cache, start, len, 1);
 	else {
+		if (btrfs_test_opt(root, DISCARD))
+			ret = btrfs_discard_extent(root, start, len, NULL);
 		btrfs_add_free_space(cache, start, len);
 		btrfs_update_reserved_bytes(cache, len, RESERVE_FREE, delalloc);
 	}

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

* [PATCH 3.16.y-ckt 083/180] btrfs: don't accept bare namespace as a valid xattr
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (81 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 082/180] Btrfs: fix log tree corruption when fs mounted with -o discard Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 084/180] MIPS: KVM: Handle MSA Disabled exceptions from guest Luis Henriques
                   ` (96 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Sterba, Chris Mason, Luis Henriques

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

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

From: David Sterba <dsterba@suse.cz>

commit 3c3b04d10ff1811a27f86684ccd2f5ba6983211d upstream.

Due to insufficient check in btrfs_is_valid_xattr, this unexpectedly
works:

 $ touch file
 $ setfattr -n user. -v 1 file
 $ getfattr -d file
user.="1"

ie. the missing attribute name after the namespace.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94291
Reported-by: William Douglas <william.douglas@intel.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/xattr.c | 53 +++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 39 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 7b29ee23b4ad..618e86ceede7 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -360,22 +360,42 @@ const struct xattr_handler *btrfs_xattr_handlers[] = {
 /*
  * Check if the attribute is in a supported namespace.
  *
- * This applied after the check for the synthetic attributes in the system
+ * This is applied after the check for the synthetic attributes in the system
  * namespace.
  */
-static bool btrfs_is_valid_xattr(const char *name)
+static int btrfs_is_valid_xattr(const char *name)
 {
-	return !strncmp(name, XATTR_SECURITY_PREFIX,
-			XATTR_SECURITY_PREFIX_LEN) ||
-	       !strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) ||
-	       !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) ||
-	       !strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) ||
-		!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN);
+	int len = strlen(name);
+	int prefixlen = 0;
+
+	if (!strncmp(name, XATTR_SECURITY_PREFIX,
+			XATTR_SECURITY_PREFIX_LEN))
+		prefixlen = XATTR_SECURITY_PREFIX_LEN;
+	else if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
+		prefixlen = XATTR_SYSTEM_PREFIX_LEN;
+	else if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
+		prefixlen = XATTR_TRUSTED_PREFIX_LEN;
+	else if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
+		prefixlen = XATTR_USER_PREFIX_LEN;
+	else if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
+		prefixlen = XATTR_BTRFS_PREFIX_LEN;
+	else
+		return -EOPNOTSUPP;
+
+	/*
+	 * The name cannot consist of just prefix
+	 */
+	if (len <= prefixlen)
+		return -EINVAL;
+
+	return 0;
 }
 
 ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
 		       void *buffer, size_t size)
 {
+	int ret;
+
 	/*
 	 * If this is a request for a synthetic attribute in the system.*
 	 * namespace use the generic infrastructure to resolve a handler
@@ -384,8 +404,9 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
 	if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
 		return generic_getxattr(dentry, name, buffer, size);
 
-	if (!btrfs_is_valid_xattr(name))
-		return -EOPNOTSUPP;
+	ret = btrfs_is_valid_xattr(name);
+	if (ret)
+		return ret;
 	return __btrfs_getxattr(dentry->d_inode, name, buffer, size);
 }
 
@@ -393,6 +414,7 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
 		   size_t size, int flags)
 {
 	struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
+	int ret;
 
 	/*
 	 * The permission on security.* and system.* is not checked
@@ -409,8 +431,9 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
 	if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
 		return generic_setxattr(dentry, name, value, size, flags);
 
-	if (!btrfs_is_valid_xattr(name))
-		return -EOPNOTSUPP;
+	ret = btrfs_is_valid_xattr(name);
+	if (ret)
+		return ret;
 
 	if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
 		return btrfs_set_prop(dentry->d_inode, name,
@@ -426,6 +449,7 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
 int btrfs_removexattr(struct dentry *dentry, const char *name)
 {
 	struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root;
+	int ret;
 
 	/*
 	 * The permission on security.* and system.* is not checked
@@ -442,8 +466,9 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
 	if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
 		return generic_removexattr(dentry, name);
 
-	if (!btrfs_is_valid_xattr(name))
-		return -EOPNOTSUPP;
+	ret = btrfs_is_valid_xattr(name);
+	if (ret)
+		return ret;
 
 	if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN))
 		return btrfs_set_prop(dentry->d_inode, name,

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

* [PATCH 3.16.y-ckt 084/180] MIPS: KVM: Handle MSA Disabled exceptions from guest
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (82 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 083/180] btrfs: don't accept bare namespace as a valid xattr Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 085/180] ARM: 8320/1: fix integer overflow in ELF_ET_DYN_BASE Luis Henriques
                   ` (95 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Paolo Bonzini, Paul Burton, Ralf Baechle,
	Gleb Natapov, linux-mips, kvm, Luis Henriques

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

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

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

commit 98119ad53376885819d93dfb8737b6a9a61ca0ba upstream.

Guest user mode can generate a guest MSA Disabled exception on an MSA
capable core by simply trying to execute an MSA instruction. Since this
exception is unknown to KVM it will be passed on to the guest kernel.
However guest Linux kernels prior to v3.15 do not set up an exception
handler for the MSA Disabled exception as they don't support any MSA
capable cores. This results in a guest OS panic.

Since an older processor ID may be being emulated, and MSA support is
not advertised to the guest, the correct behaviour is to generate a
Reserved Instruction exception in the guest kernel so it can send the
guest process an illegal instruction signal (SIGILL), as would happen
with a non-MSA-capable core.

Fix this as minimally as reasonably possible by preventing
kvm_mips_check_privilege() from relaying MSA Disabled exceptions from
guest user mode to the guest kernel, and handling the MSA Disabled
exception by emulating a Reserved Instruction exception in the guest,
via a new handle_msa_disabled() KVM callback.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
[ luis: backported to 3.16: files renamed:
  - arch/mips/kvm/emulate.c -> arch/mips/kvm/kvm_mips_emul.c
  - arch/mips/kvm/mips.c -> arch/mips/kvm/kvm_mips.c]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/include/asm/kvm_host.h |  2 ++
 arch/mips/kvm/kvm_mips.c         |  4 ++++
 arch/mips/kvm/kvm_mips_emul.c    |  1 +
 arch/mips/kvm/kvm_trap_emul.c    | 28 ++++++++++++++++++++++++++++
 4 files changed, 35 insertions(+)

diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index b0aa95565752..5a8defbad431 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -326,6 +326,7 @@ enum mips_mmu_types {
 #define T_TRAP			13	/* Trap instruction */
 #define T_VCEI			14	/* Virtual coherency exception */
 #define T_FPE			15	/* Floating point exception */
+#define T_MSADIS		21	/* MSA disabled exception */
 #define T_WATCH			23	/* Watch address reference */
 #define T_VCED			31	/* Virtual coherency data */
 
@@ -578,6 +579,7 @@ struct kvm_mips_callbacks {
 	int (*handle_syscall)(struct kvm_vcpu *vcpu);
 	int (*handle_res_inst)(struct kvm_vcpu *vcpu);
 	int (*handle_break)(struct kvm_vcpu *vcpu);
+	int (*handle_msa_disabled)(struct kvm_vcpu *vcpu);
 	int (*vm_init)(struct kvm *kvm);
 	int (*vcpu_init)(struct kvm_vcpu *vcpu);
 	int (*vcpu_setup)(struct kvm_vcpu *vcpu);
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index d84f96e51349..59298b97ac39 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -1156,6 +1156,10 @@ int kvm_mips_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
 		ret = kvm_mips_callbacks->handle_break(vcpu);
 		break;
 
+	case T_MSADIS:
+		ret = kvm_mips_callbacks->handle_msa_disabled(vcpu);
+		break;
+
 	default:
 		kvm_err
 		    ("Exception Code: %d, not yet handled, @ PC: %p, inst: 0x%08x  BadVaddr: %#lx Status: %#lx\n",
diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c
index 8d4840090082..2071472bc3c4 100644
--- a/arch/mips/kvm/kvm_mips_emul.c
+++ b/arch/mips/kvm/kvm_mips_emul.c
@@ -2204,6 +2204,7 @@ kvm_mips_check_privilege(unsigned long cause, uint32_t *opc,
 		case T_SYSCALL:
 		case T_BREAK:
 		case T_RES_INST:
+		case T_MSADIS:
 			break;
 
 		case T_COP_UNUSABLE:
diff --git a/arch/mips/kvm/kvm_trap_emul.c b/arch/mips/kvm/kvm_trap_emul.c
index 693f952b2fbb..0c521c356553 100644
--- a/arch/mips/kvm/kvm_trap_emul.c
+++ b/arch/mips/kvm/kvm_trap_emul.c
@@ -333,6 +333,33 @@ static int kvm_trap_emul_handle_break(struct kvm_vcpu *vcpu)
 	return ret;
 }
 
+static int kvm_trap_emul_handle_msa_disabled(struct kvm_vcpu *vcpu)
+{
+	struct kvm_run *run = vcpu->run;
+	uint32_t __user *opc = (uint32_t __user *) vcpu->arch.pc;
+	unsigned long cause = vcpu->arch.host_cp0_cause;
+	enum emulation_result er = EMULATE_DONE;
+	int ret = RESUME_GUEST;
+
+	/* No MSA supported in guest, guest reserved instruction exception */
+	er = kvm_mips_emulate_ri_exc(cause, opc, run, vcpu);
+
+	switch (er) {
+	case EMULATE_DONE:
+		ret = RESUME_GUEST;
+		break;
+
+	case EMULATE_FAIL:
+		run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
+		ret = RESUME_HOST;
+		break;
+
+	default:
+		BUG();
+	}
+	return ret;
+}
+
 static int kvm_trap_emul_vm_init(struct kvm *kvm)
 {
 	return 0;
@@ -472,6 +499,7 @@ static struct kvm_mips_callbacks kvm_trap_emul_callbacks = {
 	.handle_syscall = kvm_trap_emul_handle_syscall,
 	.handle_res_inst = kvm_trap_emul_handle_res_inst,
 	.handle_break = kvm_trap_emul_handle_break,
+	.handle_msa_disabled = kvm_trap_emul_handle_msa_disabled,
 
 	.vm_init = kvm_trap_emul_vm_init,
 	.vcpu_init = kvm_trap_emul_vcpu_init,

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

* [PATCH 3.16.y-ckt 085/180] ARM: 8320/1: fix integer overflow in ELF_ET_DYN_BASE
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (83 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 084/180] MIPS: KVM: Handle MSA Disabled exceptions from guest Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 086/180] MIPS: Hibernate: flush TLB entries earlier Luis Henriques
                   ` (94 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrey Ryabinin, Russell King, Luis Henriques

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

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

From: Andrey Ryabinin <a.ryabinin@samsung.com>

commit 8defb3367fcd19d1af64c07792aade0747b54e0f upstream.

Usually ELF_ET_DYN_BASE is 2/3 of TASK_SIZE. With 3G/1G user/kernel
split this is not so, because 2*TASK_SIZE overflows 32 bits,
so the actual value of ELF_ET_DYN_BASE is:
	(2 * TASK_SIZE / 3) = 0x2a000000

When ASLR is disabled PIE binaries will load at ELF_ET_DYN_BASE address.
On 32bit platforms AddressSanitzer uses addresses [0x20000000 - 0x40000000]
for shadow memory [1]. So ASan doesn't work for PIE binaries when ASLR disabled
as it fails to map shadow memory.
Also after Kees's 'split ET_DYN ASLR from mmap ASLR' patchset PIE binaries
has a high chance of loading somewhere in between [0x2a000000 - 0x40000000]
even if ASLR enabled. This makes ASan with PIE absolutely incompatible.

Fix overflow by dividing TASK_SIZE prior to multiplying.
After this patch ELF_ET_DYN_BASE equals to (for CONFIG_VMSPLIT_3G=y):
	(TASK_SIZE / 3 * 2) = 0x7f555554

[1] https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerAlgorithm#Mapping

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Reported-by: Maria Guseva <m.guseva@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/include/asm/elf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index f4b46d39b9cf..051b7269e639 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -114,7 +114,7 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
    the loader.  We need to make sure that it is out of the way of the program
    that it will "exec", and that there is sufficient room for the brk.  */
 
-#define ELF_ET_DYN_BASE	(2 * TASK_SIZE / 3)
+#define ELF_ET_DYN_BASE	(TASK_SIZE / 3 * 2)
 
 /* When the program starts, a1 contains a pointer to a function to be 
    registered with atexit, as per the SVR4 ABI.  A value of 0 means we 

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

* [PATCH 3.16.y-ckt 086/180] MIPS: Hibernate: flush TLB entries earlier
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (84 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 085/180] ARM: 8320/1: fix integer overflow in ELF_ET_DYN_BASE Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 087/180] ASoC: cs4271: Increase delay time after reset Luis Henriques
                   ` (93 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Huacai Chen, Steven J. Hill, linux-mips, Fuxin Zhang,
	Zhangjin Wu, Ralf Baechle, Luis Henriques

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

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

From: Huacai Chen <chenhc@lemote.com>

commit 2a21dc7c196209d94cb570a0d340faa6c760f7f8 upstream.

We found that TLB mismatch not only happens after kernel resume, but
also happens during snapshot restore. So move it to the beginning of
swsusp_arch_suspend().

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/9621/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/power/hibernate.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
index 32a7c828f073..e7567c8a9e79 100644
--- a/arch/mips/power/hibernate.S
+++ b/arch/mips/power/hibernate.S
@@ -30,6 +30,8 @@ LEAF(swsusp_arch_suspend)
 END(swsusp_arch_suspend)
 
 LEAF(swsusp_arch_resume)
+	/* Avoid TLB mismatch during and after kernel resume */
+	jal local_flush_tlb_all
 	PTR_L t0, restore_pblist
 0:
 	PTR_L t1, PBE_ADDRESS(t0)   /* source */
@@ -43,7 +45,6 @@ LEAF(swsusp_arch_resume)
 	bne t1, t3, 1b
 	PTR_L t0, PBE_NEXT(t0)
 	bnez t0, 0b
-	jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */
 	PTR_LA t0, saved_regs
 	PTR_L ra, PT_R31(t0)
 	PTR_L sp, PT_R29(t0)

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

* [PATCH 3.16.y-ckt 087/180] ASoC: cs4271: Increase delay time after reset
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (85 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 086/180] MIPS: Hibernate: flush TLB entries earlier Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 088/180] [media] stk1160: Make sure current buffer is released Luis Henriques
                   ` (92 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pascal Huerst, Mark Brown, Luis Henriques

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

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

From: Pascal Huerst <pascal.huerst@gmail.com>

commit 74ff960222d90999508b4ba0d3449f796695b6d5 upstream.

The delay time after a reset in the codec probe callback was too short,
and did not work on certain hw because the codec needs more time to
power on. This increases the delay time from 1us to 1ms.

Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
Acked-by: Brian Austin <brian.austin@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 6ec074fec068..38c2adc99770 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -561,10 +561,10 @@ static int cs4271_probe(struct snd_soc_codec *codec)
 	if (gpio_is_valid(cs4271->gpio_nreset)) {
 		/* Reset codec */
 		gpio_direction_output(cs4271->gpio_nreset, 0);
-		udelay(1);
+		mdelay(1);
 		gpio_set_value(cs4271->gpio_nreset, 1);
 		/* Give the codec time to wake up */
-		udelay(1);
+		mdelay(1);
 	}
 
 	ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,

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

* [PATCH 3.16.y-ckt 088/180] [media] stk1160: Make sure current buffer is released
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (86 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 087/180] ASoC: cs4271: Increase delay time after reset Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 089/180] mnt: Improve the umount_tree flags Luis Henriques
                   ` (91 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ezequiel Garcia, Hans Verkuil, Mauro Carvalho Chehab, Luis Henriques

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

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

From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

commit aeff09276748b66072f2db2e668cec955cf41959 upstream.

The available (i.e. not used) buffers are returned by stk1160_clear_queue(),
on the stop_streaming() path. However, this is insufficient and the current
buffer must be released as well. Fix it.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/media/usb/stk1160/stk1160-v4l.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c
index 5461341a31cb..45cf8c265612 100644
--- a/drivers/media/usb/stk1160/stk1160-v4l.c
+++ b/drivers/media/usb/stk1160/stk1160-v4l.c
@@ -244,6 +244,11 @@ static int stk1160_stop_streaming(struct stk1160 *dev)
 	if (mutex_lock_interruptible(&dev->v4l_lock))
 		return -ERESTARTSYS;
 
+	/*
+	 * Once URBs are cancelled, the URB complete handler
+	 * won't be running. This is required to safely release the
+	 * current buffer (dev->isoc_ctl.buf).
+	 */
 	stk1160_cancel_isoc(dev);
 
 	/*
@@ -624,8 +629,16 @@ void stk1160_clear_queue(struct stk1160 *dev)
 		stk1160_info("buffer [%p/%d] aborted\n",
 				buf, buf->vb.v4l2_buf.index);
 	}
-	/* It's important to clear current buffer */
-	dev->isoc_ctl.buf = NULL;
+
+	/* It's important to release the current buffer */
+	if (dev->isoc_ctl.buf) {
+		buf = dev->isoc_ctl.buf;
+		dev->isoc_ctl.buf = NULL;
+
+		vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+		stk1160_info("buffer [%p/%d] aborted\n",
+				buf, buf->vb.v4l2_buf.index);
+	}
 	spin_unlock_irqrestore(&dev->buf_lock, flags);
 }
 

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

* [PATCH 3.16.y-ckt 089/180] mnt: Improve the umount_tree flags
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (87 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 088/180] [media] stk1160: Make sure current buffer is released Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 090/180] ext4: make fsync to sync parent dir in no-journal for real this time Luis Henriques
                   ` (90 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eric W. Biederman, Luis Henriques

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

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit e819f152104c9f7c9fe50e1aecce6f5d4bf06d65 upstream.

- Remove the unneeded declaration from pnode.h
- Mark umount_tree static as it has no callers outside of namespace.c
- Define an enumeration of umount_tree's flags.
- Pass umount_tree's flags in by name

This removes the magic numbers 0, 1 and 2 making the code a little
clearer and makes it possible for there to be lazy unmounts that don't
propagate.  Which is what __detach_mounts actually wants for example.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
[ luis: backported to 3.16:
  - dropped change to __detach_mounts() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/namespace.c | 29 +++++++++++++++--------------
 fs/pnode.h     |  1 -
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index b1a14ad2ca01..d74c67678bb1 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1258,14 +1258,15 @@ static inline void namespace_lock(void)
 	down_write(&namespace_sem);
 }
 
+enum umount_tree_flags {
+	UMOUNT_SYNC = 1,
+	UMOUNT_PROPAGATE = 2,
+};
 /*
  * mount_lock must be held
  * namespace_sem must be held for write
- * how = 0 => just this tree, don't propagate
- * how = 1 => propagate; we know that nobody else has reference to any victims
- * how = 2 => lazy umount
  */
-void umount_tree(struct mount *mnt, int how)
+static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
 {
 	HLIST_HEAD(tmp_list);
 	struct mount *p;
@@ -1279,7 +1280,7 @@ void umount_tree(struct mount *mnt, int how)
 	hlist_for_each_entry(p, &tmp_list, mnt_hash)
 		list_del_init(&p->mnt_child);
 
-	if (how)
+	if (how & UMOUNT_PROPAGATE)
 		propagate_umount(&tmp_list);
 
 	hlist_for_each_entry(p, &tmp_list, mnt_hash) {
@@ -1287,7 +1288,7 @@ void umount_tree(struct mount *mnt, int how)
 		list_del_init(&p->mnt_list);
 		__touch_mnt_namespace(p->mnt_ns);
 		p->mnt_ns = NULL;
-		if (how < 2)
+		if (how & UMOUNT_SYNC)
 			p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;
 		if (mnt_has_parent(p)) {
 			put_mountpoint(p->mnt_mp);
@@ -1391,14 +1392,14 @@ static int do_umount(struct mount *mnt, int flags)
 
 	if (flags & MNT_DETACH) {
 		if (!list_empty(&mnt->mnt_list))
-			umount_tree(mnt, 2);
+			umount_tree(mnt, UMOUNT_PROPAGATE);
 		retval = 0;
 	} else {
 		shrink_submounts(mnt);
 		retval = -EBUSY;
 		if (!propagate_mount_busy(mnt, 2)) {
 			if (!list_empty(&mnt->mnt_list))
-				umount_tree(mnt, 1);
+				umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
 			retval = 0;
 		}
 	}
@@ -1566,7 +1567,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
 out:
 	if (res) {
 		lock_mount_hash();
-		umount_tree(res, 0);
+		umount_tree(res, UMOUNT_SYNC);
 		unlock_mount_hash();
 	}
 	return q;
@@ -1590,7 +1591,7 @@ void drop_collected_mounts(struct vfsmount *mnt)
 {
 	namespace_lock();
 	lock_mount_hash();
-	umount_tree(real_mount(mnt), 0);
+	umount_tree(real_mount(mnt), UMOUNT_SYNC);
 	unlock_mount_hash();
 	namespace_unlock();
 }
@@ -1746,7 +1747,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
  out_cleanup_ids:
 	while (!hlist_empty(&tree_list)) {
 		child = hlist_entry(tree_list.first, struct mount, mnt_hash);
-		umount_tree(child, 0);
+		umount_tree(child, UMOUNT_SYNC);
 	}
 	unlock_mount_hash();
 	cleanup_group_ids(source_mnt, NULL);
@@ -1921,7 +1922,7 @@ static int do_loopback(struct path *path, const char *old_name,
 	err = graft_tree(mnt, parent, mp);
 	if (err) {
 		lock_mount_hash();
-		umount_tree(mnt, 0);
+		umount_tree(mnt, UMOUNT_SYNC);
 		unlock_mount_hash();
 	}
 out2:
@@ -2292,7 +2293,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
 	while (!list_empty(&graveyard)) {
 		mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
 		touch_mnt_namespace(mnt->mnt_ns);
-		umount_tree(mnt, 1);
+		umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC);
 	}
 	unlock_mount_hash();
 	namespace_unlock();
@@ -2363,7 +2364,7 @@ static void shrink_submounts(struct mount *mnt)
 			m = list_first_entry(&graveyard, struct mount,
 						mnt_expire);
 			touch_mnt_namespace(m->mnt_ns);
-			umount_tree(m, 1);
+			umount_tree(m, UMOUNT_PROPAGATE|UMOUNT_SYNC);
 		}
 	}
 }
diff --git a/fs/pnode.h b/fs/pnode.h
index 4a246358b031..16afc3d6d2f2 100644
--- a/fs/pnode.h
+++ b/fs/pnode.h
@@ -47,7 +47,6 @@ int get_dominating_id(struct mount *mnt, const struct path *root);
 unsigned int mnt_get_count(struct mount *mnt);
 void mnt_set_mountpoint(struct mount *, struct mountpoint *,
 			struct mount *);
-void umount_tree(struct mount *, int);
 struct mount *copy_tree(struct mount *, struct dentry *, int);
 bool is_path_reachable(struct mount *, struct dentry *,
 			 const struct path *root);

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

* [PATCH 3.16.y-ckt 090/180] ext4: make fsync to sync parent dir in no-journal for real this time
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (88 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 089/180] mnt: Improve the umount_tree flags Luis Henriques
@ 2015-05-07  9:44 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 091/180] Input: elantech - fix absolute mode setting on some ASUS laptops Luis Henriques
                   ` (89 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:44 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lukas Czerner, Theodore Ts'o, Frank Mayhar, Luis Henriques

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

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

From: Lukas Czerner <lczerner@redhat.com>

commit e12fb97222fc41e8442896934f76d39ef99b590a upstream.

Previously commit 14ece1028b3ed53ffec1b1213ffc6acaf79ad77c added a
support for for syncing parent directory of newly created inodes to
make sure that the inode is not lost after a power failure in
no-journal mode.

However this does not work in majority of cases, namely:
 - if the directory has inline data
 - if the directory is already indexed
 - if the directory already has at least one block and:
	- the new entry fits into it
	- or we've successfully converted it to indexed

So in those cases we might lose the inode entirely even after fsync in
the no-journal mode. This also includes ext2 default mode obviously.

I've noticed this while running xfstest generic/321 and even though the
test should fail (we need to run fsck after a crash in no-journal mode)
I could not find a newly created entries even when if it was fsynced
before.

Fix this by adjusting the ext4_add_entry() successful exit paths to set
the inode EXT4_STATE_NEWENTRY so that fsync has the chance to fsync the
parent directory as well.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Frank Mayhar <fmayhar@google.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/namei.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 5c0b71c734ea..5dbec667d75b 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1889,7 +1889,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
 			  struct inode *inode)
 {
 	struct inode *dir = dentry->d_parent->d_inode;
-	struct buffer_head *bh;
+	struct buffer_head *bh = NULL;
 	struct ext4_dir_entry_2 *de;
 	struct ext4_dir_entry_tail *t;
 	struct super_block *sb;
@@ -1913,14 +1913,14 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
 			return retval;
 		if (retval == 1) {
 			retval = 0;
-			return retval;
+			goto out;
 		}
 	}
 
 	if (is_dx(dir)) {
 		retval = ext4_dx_add_entry(handle, dentry, inode);
 		if (!retval || (retval != ERR_BAD_DX_DIR))
-			return retval;
+			goto out;
 		ext4_clear_inode_flag(dir, EXT4_INODE_INDEX);
 		dx_fallback++;
 		ext4_mark_inode_dirty(handle, dir);
@@ -1932,14 +1932,15 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
 			return PTR_ERR(bh);
 
 		retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
-		if (retval != -ENOSPC) {
-			brelse(bh);
-			return retval;
-		}
+		if (retval != -ENOSPC)
+			goto out;
 
 		if (blocks == 1 && !dx_fallback &&
-		    EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX))
-			return make_indexed_dir(handle, dentry, inode, bh);
+		    EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) {
+			retval = make_indexed_dir(handle, dentry, inode, bh);
+			bh = NULL; /* make_indexed_dir releases bh */
+			goto out;
+		}
 		brelse(bh);
 	}
 	bh = ext4_append(handle, dir, &block);
@@ -1955,6 +1956,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
 	}
 
 	retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
+out:
 	brelse(bh);
 	if (retval == 0)
 		ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY);

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

* [PATCH 3.16.y-ckt 091/180] Input: elantech - fix absolute mode setting on some ASUS laptops
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (89 preceding siblings ...)
  2015-05-07  9:44 ` [PATCH 3.16.y-ckt 090/180] ext4: make fsync to sync parent dir in no-journal for real this time Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 092/180] usb: define a generic USB_RESUME_TIMEOUT macro Luis Henriques
                   ` (88 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ulrik De Bie, Dmitry Torokhov, Luis Henriques

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

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

From: Ulrik De Bie <ulrik.debie-os@e2big.org>

commit bd884149aca61de269fd9bad83fe2a4232ffab21 upstream.

On ASUS TP500LN and X750JN, the touchpad absolute mode is reset each
time set_rate is done.

In order to fix this, we will verify the firmware version, and if it
matches the one in those laptops, the set_rate function is overloaded
with a function elantech_set_rate_restore_reg_07 that performs the
set_rate with the original function, followed by a restore of reg_07
(the register that sets the absolute mode on elantech v4 hardware).

Also the ASUS TP500LN and X750JN firmware version, capabilities, and
button constellation is added to elantech.c

Reported-and-tested-by: George Moutsopoulos <gmoutso@yahoo.co.uk>
Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/elantech.c | 22 ++++++++++++++++++++++
 drivers/input/mouse/elantech.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index e66780e35962..29365c60e514 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -814,6 +814,21 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
 }
 
 /*
+ * This writes the reg_07 value again to the hardware at the end of every
+ * set_rate call because the register loses its value. reg_07 allows setting
+ * absolute mode on v4 hardware
+ */
+static void elantech_set_rate_restore_reg_07(struct psmouse *psmouse,
+		unsigned int rate)
+{
+	struct elantech_data *etd = psmouse->private;
+
+	etd->original_set_rate(psmouse, rate);
+	if (elantech_write_reg(psmouse, 0x07, etd->reg_07))
+		psmouse_err(psmouse, "restoring reg_07 failed\n");
+}
+
+/*
  * Put the touchpad into absolute mode
  */
 static int elantech_set_absolute_mode(struct psmouse *psmouse)
@@ -1015,6 +1030,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
  * Asus K53SV              0x450f01        78, 15, 0c      2 hw buttons
  * Asus G46VW              0x460f02        00, 18, 0c      2 hw buttons
  * Asus G750JX             0x360f00        00, 16, 0c      2 hw buttons
+ * Asus TP500LN            0x381f17        10, 14, 0e      clickpad
+ * Asus X750JN             0x381f17        10, 14, 0e      clickpad
  * Asus UX31               0x361f00        20, 15, 0e      clickpad
  * Asus UX32VD             0x361f02        00, 15, 0e      clickpad
  * Avatar AVIU-145A2       0x361f00        ?               clickpad
@@ -1493,6 +1510,11 @@ int elantech_init(struct psmouse *psmouse)
 		goto init_fail;
 	}
 
+	if (etd->fw_version == 0x381f17) {
+		etd->original_set_rate = psmouse->set_rate;
+		psmouse->set_rate = elantech_set_rate_restore_reg_07;
+	}
+
 	if (elantech_set_input_params(psmouse)) {
 		psmouse_err(psmouse, "failed to query touchpad range.\n");
 		goto init_fail;
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index 9e0e2a1f340d..59263a3a8667 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -139,6 +139,7 @@ struct elantech_data {
 	struct finger_pos mt[ETP_MAX_FINGERS];
 	unsigned char parity[256];
 	int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param);
+	void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate);
 };
 
 #ifdef CONFIG_MOUSE_PS2_ELANTECH

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

* [PATCH 3.16.y-ckt 092/180] usb: define a generic USB_RESUME_TIMEOUT macro
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (90 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 091/180] Input: elantech - fix absolute mode setting on some ASUS laptops Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 093/180] usb: host: xhci: use new USB_RESUME_TIMEOUT Luis Henriques
                   ` (87 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 62f0342de1f012f3e90607d39e20fce811391169 upstream.

Every USB Host controller should use this new
macro to define for how long resume signalling
should be driven on the bus.

Currently, almost every single USB controller
is using a 20ms timeout for resume signalling.

That's problematic for two reasons:

a) sometimes that 20ms timer expires a little
before 20ms, which makes us fail certification

b) some (many) devices actually need more than
20ms resume signalling.

Sure, in case of (b) we can state that the device
is against the USB spec, but the fact is that
we have no control over which device the certification
lab will use. We also have no control over which host
they will use. Most likely they'll be using a Windows
PC which, again, we have no control over how that
USB stack is written and how long resume signalling
they are using.

At the end of the day, we must make sure Linux passes
electrical compliance when working as Host or as Device
and currently we don't pass compliance as host because
we're driving resume signallig for exactly 20ms and
that confuses certification test setup resulting in
Certification failure.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/usb.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/linux/usb.h b/include/linux/usb.h
index d2465bc0e73c..2e47496ace0d 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -210,6 +210,32 @@ void usb_put_intf(struct usb_interface *intf);
 #define USB_MAXINTERFACES	32
 #define USB_MAXIADS		(USB_MAXINTERFACES/2)
 
+/*
+ * USB Resume Timer: Every Host controller driver should drive the resume
+ * signalling on the bus for the amount of time defined by this macro.
+ *
+ * That way we will have a 'stable' behavior among all HCDs supported by Linux.
+ *
+ * Note that the USB Specification states we should drive resume for *at least*
+ * 20 ms, but it doesn't give an upper bound. This creates two possible
+ * situations which we want to avoid:
+ *
+ * (a) sometimes an msleep(20) might expire slightly before 20 ms, which causes
+ * us to fail USB Electrical Tests, thus failing Certification
+ *
+ * (b) Some (many) devices actually need more than 20 ms of resume signalling,
+ * and while we can argue that's against the USB Specification, we don't have
+ * control over which devices a certification laboratory will be using for
+ * certification. If CertLab uses a device which was tested against Windows and
+ * that happens to have relaxed resume signalling rules, we might fall into
+ * situations where we fail interoperability and electrical tests.
+ *
+ * In order to avoid both conditions, we're using a 40 ms resume timeout, which
+ * should cope with both LPJ calibration errors and devices not following every
+ * detail of the USB Specification.
+ */
+#define USB_RESUME_TIMEOUT	40 /* ms */
+
 /**
  * struct usb_interface_cache - long-term representation of a device interface
  * @num_altsetting: number of altsettings defined.

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

* [PATCH 3.16.y-ckt 093/180] usb: host: xhci: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (91 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 092/180] usb: define a generic USB_RESUME_TIMEOUT macro Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 094/180] usb: host: ehci: " Luis Henriques
                   ` (86 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit b9e451885deb6262dbaf5cd14aa77d192d9ac759 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 5e4e1d1d7de7..f176280e2fcf 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1611,7 +1611,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
 		} else {
 			xhci_dbg(xhci, "resume HS port %d\n", port_id);
 			bus_state->resume_done[faked_port_index] = jiffies +
-				msecs_to_jiffies(20);
+				msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			set_bit(faked_port_index, &bus_state->resuming_ports);
 			mod_timer(&hcd->rh_timer,
 				  bus_state->resume_done[faked_port_index]);

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

* [PATCH 3.16.y-ckt 094/180] usb: host: ehci: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (92 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 093/180] usb: host: xhci: use new USB_RESUME_TIMEOUT Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 095/180] usb: host: uhci: " Luis Henriques
                   ` (85 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit ea16328f80ca8d74434352157f37ef60e2f55ce2 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - replaced 'hub_wq' by 'khubd' in comment ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/ehci-hcd.c | 10 +++++-----
 drivers/usb/host/ehci-hub.c |  9 ++++++---
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 488a30836c36..03d334172ed9 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -787,12 +787,12 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 					ehci->reset_done[i] == 0))
 				continue;
 
-			/* start 20 msec resume signaling from this port,
-			 * and make khubd collect PORT_STAT_C_SUSPEND to
-			 * stop that signaling.  Use 5 ms extra for safety,
-			 * like usb_port_resume() does.
+			/* start USB_RESUME_TIMEOUT msec resume signaling from
+			 * this port, and make khubd collect
+			 * PORT_STAT_C_SUSPEND to stop that signaling.
 			 */
-			ehci->reset_done[i] = jiffies + msecs_to_jiffies(25);
+			ehci->reset_done[i] = jiffies +
+				msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			set_bit(i, &ehci->resuming_ports);
 			ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
 			usb_hcd_start_port_resume(&hcd->self, i);
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 6130b7574908..837a1edd33e2 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -473,10 +473,13 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
 		ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
 	}
 
-	/* msleep for 20ms only if code is trying to resume port */
+	/*
+	 * msleep for USB_RESUME_TIMEOUT ms only if code is trying to resume
+	 * port
+	 */
 	if (resume_needed) {
 		spin_unlock_irq(&ehci->lock);
-		msleep(20);
+		msleep(USB_RESUME_TIMEOUT);
 		spin_lock_irq(&ehci->lock);
 		if (ehci->shutdown)
 			goto shutdown;
@@ -944,7 +947,7 @@ int ehci_hub_control(
 			temp &= ~PORT_WAKE_BITS;
 			ehci_writel(ehci, temp | PORT_RESUME, status_reg);
 			ehci->reset_done[wIndex] = jiffies
-					+ msecs_to_jiffies(20);
+					+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			set_bit(wIndex, &ehci->resuming_ports);
 			usb_hcd_start_port_resume(&hcd->self, wIndex);
 			break;

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

* [PATCH 3.16.y-ckt 095/180] usb: host: uhci: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (93 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 094/180] usb: host: ehci: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 096/180] usb: musb: " Luis Henriques
                   ` (84 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit b8fb6f79f76f478acbbffccc966daa878f172a0a upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/uhci-hub.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index 93e17b12fb33..98c66d88ebde 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -165,7 +165,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci)
 				/* Port received a wakeup request */
 				set_bit(port, &uhci->resuming_ports);
 				uhci->ports_timeout = jiffies +
-						msecs_to_jiffies(25);
+					msecs_to_jiffies(USB_RESUME_TIMEOUT);
 				usb_hcd_start_port_resume(
 						&uhci_to_hcd(uhci)->self, port);
 
@@ -337,7 +337,8 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			uhci_finish_suspend(uhci, port, port_addr);
 
 			/* USB v2.0 7.1.7.5 */
-			uhci->ports_timeout = jiffies + msecs_to_jiffies(50);
+			uhci->ports_timeout = jiffies +
+				msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			break;
 		case USB_PORT_FEAT_POWER:
 			/* UHCI has no power switching */

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

* [PATCH 3.16.y-ckt 096/180] usb: musb: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (94 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 095/180] usb: host: uhci: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 097/180] usb: host: isp116x: " Luis Henriques
                   ` (83 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Bin Liu, Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 309be239369609929d5d3833ee043f7c5afc95d1 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Based on original work by Bin Liu <Bin Liu <b-liu@ti.com>>

Cc: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - only two msecs_to_jiffies() invocations
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/musb/musb_core.c    | 5 +++--
 drivers/usb/musb/musb_virthub.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2281879278ed..e2c34c83f409 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -99,6 +99,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
+#include <linux/usb.h>
 
 #include "musb_core.h"
 
@@ -477,10 +478,10 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 						(USB_PORT_STAT_C_SUSPEND << 16)
 						| MUSB_PORT_STAT_RESUME;
 				musb->rh_timer = jiffies
-						 + msecs_to_jiffies(20);
+					+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
 				schedule_delayed_work(
 					&musb->finish_resume_work,
-					msecs_to_jiffies(20));
+					msecs_to_jiffies(USB_RESUME_TIMEOUT));
 
 				musb->xceiv->state = OTG_STATE_A_HOST;
 				musb->is_active = 1;
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index e2d2d8c9891b..0241a3a0d63e 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -136,7 +136,7 @@ void musb_port_suspend(struct musb *musb, bool do_suspend)
 		/* later, GetPortStatus will stop RESUME signaling */
 		musb->port1_status |= MUSB_PORT_STAT_RESUME;
 		schedule_delayed_work(&musb->finish_resume_work,
-				      msecs_to_jiffies(20));
+				      msecs_to_jiffies(USB_RESUME_TIMEOUT));
 	}
 }
 

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

* [PATCH 3.16.y-ckt 097/180] usb: host: isp116x: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (95 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 096/180] usb: musb: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 098/180] usb: host: fotg210: " Luis Henriques
                   ` (82 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 8c0ae6574ccfd3d619876a65829aad74c9d22ba5 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/isp116x-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 240e792c81a7..b62298fe0be8 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1487,7 +1487,7 @@ static int isp116x_bus_resume(struct usb_hcd *hcd)
 	spin_unlock_irq(&isp116x->lock);
 
 	hcd->state = HC_STATE_RESUMING;
-	msleep(20);
+	msleep(USB_RESUME_TIMEOUT);
 
 	/* Go operational */
 	spin_lock_irq(&isp116x->lock);

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

* [PATCH 3.16.y-ckt 098/180] usb: host: fotg210: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (96 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 097/180] usb: host: isp116x: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 099/180] usb: host: fusbh200: " Luis Henriques
                   ` (81 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 7e136bb71a08e8b8be3bc492f041d9b0bea3856d upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/fotg210-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 98a89d16cc3e..8aa4ba0a0c69 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -1595,7 +1595,7 @@ static int fotg210_hub_control(
 			/* resume signaling for 20 msec */
 			fotg210_writel(fotg210, temp | PORT_RESUME, status_reg);
 			fotg210->reset_done[wIndex] = jiffies
-					+ msecs_to_jiffies(20);
+					+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			break;
 		case USB_PORT_FEAT_C_SUSPEND:
 			clear_bit(wIndex, &fotg210->port_c_suspend);

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

* [PATCH 3.16.y-ckt 099/180] usb: host: fusbh200: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (97 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 098/180] usb: host: fotg210: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 100/180] usb: host: oxu210hp: " Luis Henriques
                   ` (80 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 595227db1f2d98bfc33f02a55842f268e12b247d upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/fusbh200-hcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/fusbh200-hcd.c b/drivers/usb/host/fusbh200-hcd.c
index ba9499060f63..3e3926aa584e 100644
--- a/drivers/usb/host/fusbh200-hcd.c
+++ b/drivers/usb/host/fusbh200-hcd.c
@@ -1550,10 +1550,9 @@ static int fusbh200_hub_control (
 			if ((temp & PORT_PE) == 0)
 				goto error;
 
-			/* resume signaling for 20 msec */
 			fusbh200_writel(fusbh200, temp | PORT_RESUME, status_reg);
 			fusbh200->reset_done[wIndex] = jiffies
-					+ msecs_to_jiffies(20);
+					+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			break;
 		case USB_PORT_FEAT_C_SUSPEND:
 			clear_bit(wIndex, &fusbh200->port_c_suspend);

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

* [PATCH 3.16.y-ckt 100/180] usb: host: oxu210hp: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (98 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 099/180] usb: host: fusbh200: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 101/180] usb: host: r8a66597: " Luis Henriques
                   ` (79 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 84c0d178eb9f3a3ae4d63dc97a440266cf17f7f5 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - replaced 'hub_wq' by 'khubd' in comment ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/oxu210hp-hcd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index e07248b6ab67..8a0158667166 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -2500,11 +2500,12 @@ static irqreturn_t oxu210_hcd_irq(struct usb_hcd *hcd)
 					|| oxu->reset_done[i] != 0)
 				continue;
 
-			/* start 20 msec resume signaling from this port,
-			 * and make khubd collect PORT_STAT_C_SUSPEND to
+			/* start USB_RESUME_TIMEOUT resume signaling from this
+			 * port, and make khubd collect PORT_STAT_C_SUSPEND to
 			 * stop that signaling.
 			 */
-			oxu->reset_done[i] = jiffies + msecs_to_jiffies(20);
+			oxu->reset_done[i] = jiffies +
+				msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			oxu_dbg(oxu, "port %d remote wakeup\n", i + 1);
 			mod_timer(&hcd->rh_timer, oxu->reset_done[i]);
 		}

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

* [PATCH 3.16.y-ckt 101/180] usb: host: r8a66597: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (99 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 100/180] usb: host: oxu210hp: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 102/180] usb: host: sl811: " Luis Henriques
                   ` (78 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 7a606ac29752a3e571b83f9b3fceb1eaa1d37781 upstream.

While this driver was already using a 50ms resume
timeout, let's make sure everybody uses the same
macro so it's easy to fix later should anything
go wrong.

It also gives a more "stable" expectation to Linux
users.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/r8a66597-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 110b4b9ebeaa..f130bb2f7bbe 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2300,7 +2300,7 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd)
 		rh->port &= ~USB_PORT_STAT_SUSPEND;
 		rh->port |= USB_PORT_STAT_C_SUSPEND << 16;
 		r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg);
-		msleep(50);
+		msleep(USB_RESUME_TIMEOUT);
 		r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg);
 	}
 

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

* [PATCH 3.16.y-ckt 102/180] usb: host: sl811: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (100 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 101/180] usb: host: r8a66597: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 103/180] usb: dwc2: hcd: " Luis Henriques
                   ` (77 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 08debfb13b199716da6153940c31968c556b195d upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/sl811-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index a517151867af..0f53cc8c8ecf 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1259,7 +1259,7 @@ sl811h_hub_control(
 			sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
 
 			mod_timer(&sl811->timer, jiffies
-					+ msecs_to_jiffies(20));
+					+ msecs_to_jiffies(USB_RESUME_TIMEOUT));
 			break;
 		case USB_PORT_FEAT_POWER:
 			port_power(sl811, 0);

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

* [PATCH 3.16.y-ckt 103/180] usb: dwc2: hcd: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (101 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 102/180] usb: host: sl811: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 104/180] usb: isp1760: " Luis Henriques
                   ` (76 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 74bd7b69801819707713b88e9d0bc074efa2f5e7 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/dwc2/hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 4d918ed8d343..0f9980088c08 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -1501,7 +1501,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
 			dev_dbg(hsotg->dev,
 				"ClearPortFeature USB_PORT_FEAT_SUSPEND\n");
 			writel(0, hsotg->regs + PCGCTL);
-			usleep_range(20000, 40000);
+			msleep(USB_RESUME_TIMEOUT);
 
 			hprt0 = dwc2_read_hprt0(hsotg);
 			hprt0 |= HPRT0_RES;

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

* [PATCH 3.16.y-ckt 104/180] usb: isp1760: hcd: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (102 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 103/180] usb: dwc2: hcd: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 105/180] usb: core: hub: " Luis Henriques
                   ` (75 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit 59c9904cce77b55892e15f40791f1e66e4d3a1e6 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - file rename: drivers/usb/isp1760/isp1760-hcd.c ->
    drivers/usb/host/isp1760-hcd.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/isp1760-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 5ea7c6bdfd28..6295b353bb65 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -1895,7 +1895,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
 				reg_write32(hcd->regs, HC_PORTSC1,
 							temp | PORT_RESUME);
 				priv->reset_done = jiffies +
-					msecs_to_jiffies(20);
+					msecs_to_jiffies(USB_RESUME_TIMEOUT);
 			}
 			break;
 		case USB_PORT_FEAT_C_SUSPEND:

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

* [PATCH 3.16.y-ckt 105/180] usb: core: hub: use new USB_RESUME_TIMEOUT
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (103 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 104/180] usb: isp1760: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 106/180] iser-target: Fix session hang in case of an rdma read DIF error Luis Henriques
                   ` (74 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

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

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

From: Felipe Balbi <balbi@ti.com>

commit bbc78c07a51f6fd29c227b1220a9016e585358ba upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/core/hub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 0e0e0354c523..4209fc7d91c6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3375,10 +3375,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
 	if (status) {
 		dev_dbg(&port_dev->dev, "can't resume, status %d\n", status);
 	} else {
-		/* drive resume for at least 20 msec */
+		/* drive resume for USB_RESUME_TIMEOUT msec */
 		dev_dbg(&udev->dev, "usb %sresume\n",
 				(PMSG_IS_AUTO(msg) ? "auto-" : ""));
-		msleep(25);
+		msleep(USB_RESUME_TIMEOUT);
 
 		/* Virtual root hubs can trigger on GET_PORT_STATUS to
 		 * stop resume signaling.  Then finish the resume

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

* [PATCH 3.16.y-ckt 106/180] iser-target: Fix session hang in case of an rdma read DIF error
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (104 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 105/180] usb: core: hub: " Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 107/180] iser-target: Fix possible deadlock in RDMA_CM connection error Luis Henriques
                   ` (73 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sagi Grimberg, Nicholas Bellinger, Luis Henriques

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

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

From: Sagi Grimberg <sagig@mellanox.com>

commit 364189f0ada5478e4faf8a552d6071a650d757cd upstream.

This hang was a result of a missing command put when
a DIF error occurred during a rdma read (and we sent
an CHECK_CONDITION error without passing it to the
backend).

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 3a36b8bbca33..42dc264b7271 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -1898,11 +1898,13 @@ isert_completion_rdma_read(struct iser_tx_desc *tx_desc,
 	cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT;
 	spin_unlock_bh(&cmd->istate_lock);
 
-	if (ret)
+	if (ret) {
+		target_put_sess_cmd(se_cmd->se_sess, se_cmd);
 		transport_send_check_condition_and_sense(se_cmd,
 							 se_cmd->pi_err, 0);
-	else
+	} else {
 		target_execute_cmd(se_cmd);
+	}
 }
 
 static void

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

* [PATCH 3.16.y-ckt 107/180] iser-target: Fix possible deadlock in RDMA_CM connection error
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (105 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 106/180] iser-target: Fix session hang in case of an rdma read DIF error Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 108/180] x86: vdso: fix pvclock races with task migration Luis Henriques
                   ` (72 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sagi Grimberg, Nicholas Bellinger, Luis Henriques

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

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

From: Sagi Grimberg <sagig@mellanox.com>

commit 4a579da2586bd3b79b025947ea24ede2bbfede62 upstream.

Before we reach to connection established we may get an
error event. In this case the core won't teardown this
connection (never established it), so we take care of freeing
it ourselves.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 42dc264b7271..31939ba1d238 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -218,7 +218,7 @@ fail:
 static void
 isert_free_rx_descriptors(struct isert_conn *isert_conn)
 {
-	struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
+	struct ib_device *ib_dev = isert_conn->conn_device->ib_device;
 	struct iser_rx_desc *rx_desc;
 	int i;
 
@@ -737,8 +737,8 @@ out:
 static void
 isert_connect_release(struct isert_conn *isert_conn)
 {
-	struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
 	struct isert_device *device = isert_conn->conn_device;
+	struct ib_device *ib_dev = device->ib_device;
 	int cq_index;
 
 	pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
@@ -747,7 +747,8 @@ isert_connect_release(struct isert_conn *isert_conn)
 		isert_conn_free_fastreg_pool(isert_conn);
 
 	isert_free_rx_descriptors(isert_conn);
-	rdma_destroy_id(isert_conn->conn_cm_id);
+	if (isert_conn->conn_cm_id)
+		rdma_destroy_id(isert_conn->conn_cm_id);
 
 	if (isert_conn->conn_qp) {
 		cq_index = ((struct isert_cq_desc *)
@@ -905,12 +906,15 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
 	return 0;
 }
 
-static void
+static int
 isert_connect_error(struct rdma_cm_id *cma_id)
 {
 	struct isert_conn *isert_conn = cma_id->qp->qp_context;
 
+	isert_conn->conn_cm_id = NULL;
 	isert_put_conn(isert_conn);
+
+	return -1;
 }
 
 static int
@@ -940,7 +944,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 	case RDMA_CM_EVENT_REJECTED:       /* FALLTHRU */
 	case RDMA_CM_EVENT_UNREACHABLE:    /* FALLTHRU */
 	case RDMA_CM_EVENT_CONNECT_ERROR:
-		isert_connect_error(cma_id);
+		ret = isert_connect_error(cma_id);
 		break;
 	default:
 		pr_err("Unhandled RDMA CMA event: %d\n", event->event);

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

* [PATCH 3.16.y-ckt 108/180] x86: vdso: fix pvclock races with task migration
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (106 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 107/180] iser-target: Fix possible deadlock in RDMA_CM connection error Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 109/180] gpio: mvebu: Fix mask/unmask managment per irq chip type Luis Henriques
                   ` (71 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Radim Krčmář, Paolo Bonzini, Luis Henriques

3.16.7-ckt11 -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 80f7fdb1c7f0f9266421f823964fd1962681f6ce upstream.

If we were migrated right after __getcpu, but before reading the
migration_count, we wouldn't notice that we read TSC of a different
VCPU, nor that KVM's bug made pvti invalid, as only migration_count
on source VCPU is increased.

Change vdso instead of updating migration_count on destination.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Fixes: 0a4e6be9ca17 ("x86: kvm: Revert "remove sched notifier for cross-cpu migrations"")
Message-Id: <1428000263-11892-1-git-send-email-rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/vdso/vclock_gettime.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 30933760ee5f..40d2473836c9 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -99,21 +99,25 @@ static notrace cycle_t vread_pvclock(int *mode)
 		 * __getcpu() calls (Gleb).
 		 */
 
-		pvti = get_pvti(cpu);
+		/* Make sure migrate_count will change if we leave the VCPU. */
+		do {
+			pvti = get_pvti(cpu);
+			migrate_count = pvti->migrate_count;
 
-		migrate_count = pvti->migrate_count;
+			cpu1 = cpu;
+			cpu = __getcpu() & VGETCPU_CPU_MASK;
+		} while (unlikely(cpu != cpu1));
 
 		version = __pvclock_read_cycles(&pvti->pvti, &ret, &flags);
 
 		/*
 		 * Test we're still on the cpu as well as the version.
-		 * We could have been migrated just after the first
-		 * vgetcpu but before fetching the version, so we
-		 * wouldn't notice a version change.
+		 * - We must read TSC of pvti's VCPU.
+		 * - KVM doesn't follow the versioning protocol, so data could
+		 *   change before version if we left the VCPU.
 		 */
-		cpu1 = __getcpu() & VGETCPU_CPU_MASK;
-	} while (unlikely(cpu != cpu1 ||
-			  (pvti->pvti.version & 1) ||
+		smp_rmb();
+	} while (unlikely((pvti->pvti.version & 1) ||
 			  pvti->pvti.version != version ||
 			  pvti->migrate_count != migrate_count));
 

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

* [PATCH 3.16.y-ckt 109/180] gpio: mvebu: Fix mask/unmask managment per irq chip type
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (107 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 108/180] x86: vdso: fix pvclock races with task migration Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 110/180] [media] rc: img-ir: fix error in parameters passed to irq_free() Luis Henriques
                   ` (70 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Gregory CLEMENT, Linus Walleij, Luis Henriques

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

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

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

commit 61819549f572edd7fce53f228c0d8420cdc85f71 upstream.

Level IRQ handlers and edge IRQ handler are managed by tow different
sets of registers. But currently the driver uses the same mask for the
both registers. It lead to issues with the following scenario:

First, an IRQ is requested on a GPIO to be triggered on front. After,
this an other IRQ is requested for a GPIO of the same bank but
triggered on level. Then the first one will be also setup to be
triggered on level. It leads to an interrupt storm.

The different kind of handler are already associated with two
different irq chip type. With this patch the driver uses a private
mask for each one which solves this issue.

It has been tested on an Armada XP based board and on an Armada 375
board. For the both boards, with this patch is applied, there is no
such interrupt storm when running the previous scenario.

This bug was already fixed but in a different way in the legacy
version of this driver by Evgeniy Dushistov:
9ece8839b1277fb9128ff6833411614ab6c88d68 "ARM: orion: Fix for certain
sequence of request_irq can cause irq storm". The fact the new version
of the gpio drive could be affected had been discussed there:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/344670/focus=364012

Reported-by: Evgeniy A. Dushistov <dushistov@mail.ru>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpio/gpio-mvebu.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 418e38650363..a93ddbc1948e 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -305,11 +305,13 @@ static void mvebu_gpio_edge_irq_mask(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct mvebu_gpio_chip *mvchip = gc->private;
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 	u32 mask = 1 << (d->irq - gc->irq_base);
 
 	irq_gc_lock(gc);
-	gc->mask_cache &= ~mask;
-	writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
+	ct->mask_cache_priv &= ~mask;
+
+	writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
 	irq_gc_unlock(gc);
 }
 
@@ -317,11 +319,13 @@ static void mvebu_gpio_edge_irq_unmask(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct mvebu_gpio_chip *mvchip = gc->private;
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
+
 	u32 mask = 1 << (d->irq - gc->irq_base);
 
 	irq_gc_lock(gc);
-	gc->mask_cache |= mask;
-	writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
+	ct->mask_cache_priv |= mask;
+	writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
 	irq_gc_unlock(gc);
 }
 
@@ -329,11 +333,13 @@ static void mvebu_gpio_level_irq_mask(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct mvebu_gpio_chip *mvchip = gc->private;
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
+
 	u32 mask = 1 << (d->irq - gc->irq_base);
 
 	irq_gc_lock(gc);
-	gc->mask_cache &= ~mask;
-	writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
+	ct->mask_cache_priv &= ~mask;
+	writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
 	irq_gc_unlock(gc);
 }
 
@@ -341,11 +347,13 @@ static void mvebu_gpio_level_irq_unmask(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct mvebu_gpio_chip *mvchip = gc->private;
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
+
 	u32 mask = 1 << (d->irq - gc->irq_base);
 
 	irq_gc_lock(gc);
-	gc->mask_cache |= mask;
-	writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
+	ct->mask_cache_priv |= mask;
+	writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
 	irq_gc_unlock(gc);
 }
 

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

* [PATCH 3.16.y-ckt 110/180] [media] rc: img-ir: fix error in parameters passed to irq_free()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (108 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 109/180] gpio: mvebu: Fix mask/unmask managment per irq chip type Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 111/180] scsi: storvsc: Fix a bug in copy_from_bounce_buffer() Luis Henriques
                   ` (69 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sifan Naeem, Mauro Carvalho Chehab, Luis Henriques

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

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

From: Sifan Naeem <sifan.naeem@imgtec.com>

commit 80ccf4ad06dc9d2f06a8347b2d309cdc959f72b3 upstream.

img_ir_remove() passes a pointer to the ISR function as the 2nd
parameter to irq_free() instead of a pointer to the device data
structure.
This issue causes unloading img-ir module to fail with the below
warning after building and loading img-ir as a module.

WARNING: CPU: 2 PID: 155 at ../kernel/irq/manage.c:1278
__free_irq+0xb4/0x214() Trying to free already-free IRQ 58
Modules linked in: img_ir(-)
CPU: 2 PID: 155 Comm: rmmod Not tainted 3.14.0 #55 ...
Call Trace:
...
[<8048d420>] __free_irq+0xb4/0x214
[<8048d6b4>] free_irq+0xac/0xf4
[<c009b130>] img_ir_remove+0x54/0xd4 [img_ir] [<8073ded0>]
platform_drv_remove+0x30/0x54 ...

Fixes: 160a8f8aec4d ("[media] rc: img-ir: add base driver")

Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/media/rc/img-ir/img-ir-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
index 6b7834834fb8..fbcbf803ba38 100644
--- a/drivers/media/rc/img-ir/img-ir-core.c
+++ b/drivers/media/rc/img-ir/img-ir-core.c
@@ -141,7 +141,7 @@ static int img_ir_remove(struct platform_device *pdev)
 {
 	struct img_ir_priv *priv = platform_get_drvdata(pdev);
 
-	free_irq(priv->irq, img_ir_isr);
+	free_irq(priv->irq, priv);
 	img_ir_remove_hw(priv);
 	img_ir_remove_raw(priv);
 

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

* [PATCH 3.16.y-ckt 111/180] scsi: storvsc: Fix a bug in copy_from_bounce_buffer()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (109 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 110/180] [media] rc: img-ir: fix error in parameters passed to irq_free() Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 112/180] md/raid0: fix bug with chunksize not a power of 2 Luis Henriques
                   ` (68 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, James Bottomley, Luis Henriques

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

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

From: "K. Y. Srinivasan" <kys@microsoft.com>

commit 8de580742fee8bc34d116f57a20b22b9a5f08403 upstream.

We may exit this function without properly freeing up the maapings
we may have acquired. Fix the bug.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/storvsc_drv.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 86b05151fdab..97892f258043 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -739,21 +739,22 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,
 			if (bounce_sgl[j].length == PAGE_SIZE) {
 				/* full..move to next entry */
 				sg_kunmap_atomic(bounce_addr);
+				bounce_addr = 0;
 				j++;
+			}
 
-				/* if we need to use another bounce buffer */
-				if (srclen || i != orig_sgl_count - 1)
-					bounce_addr = sg_kmap_atomic(bounce_sgl,j);
+			/* if we need to use another bounce buffer */
+			if (srclen && bounce_addr == 0)
+				bounce_addr = sg_kmap_atomic(bounce_sgl, j);
 
-			} else if (srclen == 0 && i == orig_sgl_count - 1) {
-				/* unmap the last bounce that is < PAGE_SIZE */
-				sg_kunmap_atomic(bounce_addr);
-			}
 		}
 
 		sg_kunmap_atomic(src_addr - orig_sgl[i].offset);
 	}
 
+	if (bounce_addr)
+		sg_kunmap_atomic(bounce_addr);
+
 	local_irq_restore(flags);
 
 	return total_copied;

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

* [PATCH 3.16.y-ckt 112/180] md/raid0: fix bug with chunksize not a power of 2.
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (110 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 111/180] scsi: storvsc: Fix a bug in copy_from_bounce_buffer() Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 113/180] ALSA: emu10k1: don't deadlock in proc-functions Luis Henriques
                   ` (67 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Luis Henriques

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

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

From: NeilBrown <neilb@suse.de>

commit 47d68979cc968535cb87f3e5f2e6a3533ea48fbd upstream.

Since commit 20d0189b1012a37d2533a87fb451f7852f2418d1
in v3.14-rc1 RAID0 has performed incorrect calculations
when the chunksize is not a power of 2.

This happens because "sector_div()" modifies its first argument, but
this wasn't taken into account in the patch.

So restore that first arg before re-using the variable.

Reported-by: Joe Landman <joe.landman@gmail.com>
Reported-by: Dave Chinner <david@fromorbit.com>
Fixes: 20d0189b1012a37d2533a87fb451f7852f2418d1
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/raid0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 407a99e46f69..683e685ed697 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -320,7 +320,7 @@ static struct strip_zone *find_zone(struct r0conf *conf,
 
 /*
  * remaps the bio to the target device. we separate two flows.
- * power 2 flow and a general flow for the sake of perfromance
+ * power 2 flow and a general flow for the sake of performance
 */
 static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone,
 				sector_t sector, sector_t *sector_offset)
@@ -538,6 +538,7 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio)
 			split = bio;
 		}
 
+		sector = bio->bi_iter.bi_sector;
 		zone = find_zone(mddev->private, &sector);
 		tmp_dev = map_sector(mddev, zone, sector, &sector);
 		split->bi_bdev = tmp_dev->bdev;

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

* [PATCH 3.16.y-ckt 113/180] ALSA: emu10k1: don't deadlock in proc-functions
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (111 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 112/180] md/raid0: fix bug with chunksize not a power of 2 Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 114/180] MIPS: asm: asm-eva: Introduce kernel load/store variants Luis Henriques
                   ` (66 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Gernoth, Takashi Iwai, Luis Henriques

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

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

From: Michael Gernoth <michael@gernoth.net>

commit 91bf0c2dcb935a87e5c0795f5047456b965fd143 upstream.

The functions snd_emu10k1_proc_spdif_read and snd_emu1010_fpga_read
acquire the emu_lock before accessing the FPGA. The function used
to access the FPGA (snd_emu1010_fpga_read) also tries to take
the emu_lock which causes a deadlock.
Remove the outer locking in the proc-functions (guarding only the
already safe fpga read) to prevent this deadlock.

[removed superfluous flags variables too -- tiwai]

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/emu10k1/emuproc.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 2ca9f2e93139..53745f4c2bf5 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -241,31 +241,22 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry,
 	struct snd_emu10k1 *emu = entry->private_data;
 	u32 value;
 	u32 value2;
-	unsigned long flags;
 	u32 rate;
 
 	if (emu->card_capabilities->emu_model) {
-		spin_lock_irqsave(&emu->emu_lock, flags);
 		snd_emu1010_fpga_read(emu, 0x38, &value);
-		spin_unlock_irqrestore(&emu->emu_lock, flags);
 		if ((value & 0x1) == 0) {
-			spin_lock_irqsave(&emu->emu_lock, flags);
 			snd_emu1010_fpga_read(emu, 0x2a, &value);
 			snd_emu1010_fpga_read(emu, 0x2b, &value2);
-			spin_unlock_irqrestore(&emu->emu_lock, flags);
 			rate = 0x1770000 / (((value << 5) | value2)+1);	
 			snd_iprintf(buffer, "ADAT Locked : %u\n", rate);
 		} else {
 			snd_iprintf(buffer, "ADAT Unlocked\n");
 		}
-		spin_lock_irqsave(&emu->emu_lock, flags);
 		snd_emu1010_fpga_read(emu, 0x20, &value);
-		spin_unlock_irqrestore(&emu->emu_lock, flags);
 		if ((value & 0x4) == 0) {
-			spin_lock_irqsave(&emu->emu_lock, flags);
 			snd_emu1010_fpga_read(emu, 0x28, &value);
 			snd_emu1010_fpga_read(emu, 0x29, &value2);
-			spin_unlock_irqrestore(&emu->emu_lock, flags);
 			rate = 0x1770000 / (((value << 5) | value2)+1);	
 			snd_iprintf(buffer, "SPDIF Locked : %d\n", rate);
 		} else {
@@ -410,14 +401,11 @@ static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry,
 {
 	struct snd_emu10k1 *emu = entry->private_data;
 	u32 value;
-	unsigned long flags;
 	int i;
 	snd_iprintf(buffer, "EMU1010 Registers:\n\n");
 
 	for(i = 0; i < 0x40; i+=1) {
-		spin_lock_irqsave(&emu->emu_lock, flags);
 		snd_emu1010_fpga_read(emu, i, &value);
-		spin_unlock_irqrestore(&emu->emu_lock, flags);
 		snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f);
 	}
 }

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

* [PATCH 3.16.y-ckt 114/180] MIPS: asm: asm-eva: Introduce kernel load/store variants
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (112 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 113/180] ALSA: emu10k1: don't deadlock in proc-functions Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 115/180] MIPS: Malta: Detect and fix bad memsize values Luis Henriques
                   ` (65 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Markos Chandras, linux-mips, Ralf Baechle, Luis Henriques

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

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

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

commit 60cd7e08e453bc6828ac4b539f949e4acd80f143 upstream.

Introduce new macros for kernel load/store variants which will be
used to perform regular kernel space load/store operations in EVA
mode.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9500/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/include/asm/asm-eva.h | 137 +++++++++++++++++++++++++++-------------
 1 file changed, 93 insertions(+), 44 deletions(-)

diff --git a/arch/mips/include/asm/asm-eva.h b/arch/mips/include/asm/asm-eva.h
index e41c56e375b1..1e38f0e1ea3e 100644
--- a/arch/mips/include/asm/asm-eva.h
+++ b/arch/mips/include/asm/asm-eva.h
@@ -11,6 +11,36 @@
 #define __ASM_ASM_EVA_H
 
 #ifndef __ASSEMBLY__
+
+/* Kernel variants */
+
+#define kernel_cache(op, base)		"cache " op ", " base "\n"
+#define kernel_ll(reg, addr)		"ll " reg ", " addr "\n"
+#define kernel_sc(reg, addr)		"sc " reg ", " addr "\n"
+#define kernel_lw(reg, addr)		"lw " reg ", " addr "\n"
+#define kernel_lwl(reg, addr)		"lwl " reg ", " addr "\n"
+#define kernel_lwr(reg, addr)		"lwr " reg ", " addr "\n"
+#define kernel_lh(reg, addr)		"lh " reg ", " addr "\n"
+#define kernel_lb(reg, addr)		"lb " reg ", " addr "\n"
+#define kernel_lbu(reg, addr)		"lbu " reg ", " addr "\n"
+#define kernel_sw(reg, addr)		"sw " reg ", " addr "\n"
+#define kernel_swl(reg, addr)		"swl " reg ", " addr "\n"
+#define kernel_swr(reg, addr)		"swr " reg ", " addr "\n"
+#define kernel_sh(reg, addr)		"sh " reg ", " addr "\n"
+#define kernel_sb(reg, addr)		"sb " reg ", " addr "\n"
+
+#ifdef CONFIG_32BIT
+/*
+ * No 'sd' or 'ld' instructions in 32-bit but the code will
+ * do the correct thing
+ */
+#define kernel_sd(reg, addr)		user_sw(reg, addr)
+#define kernel_ld(reg, addr)		user_lw(reg, addr)
+#else
+#define kernel_sd(reg, addr)		"sd " reg", " addr "\n"
+#define kernel_ld(reg, addr)		"ld " reg", " addr "\n"
+#endif /* CONFIG_32BIT */
+
 #ifdef CONFIG_EVA
 
 #define __BUILD_EVA_INSN(insn, reg, addr)				\
@@ -41,37 +71,60 @@
 
 #else
 
-#define user_cache(op, base)		"cache " op ", " base "\n"
-#define user_ll(reg, addr)		"ll " reg ", " addr "\n"
-#define user_sc(reg, addr)		"sc " reg ", " addr "\n"
-#define user_lw(reg, addr)		"lw " reg ", " addr "\n"
-#define user_lwl(reg, addr)		"lwl " reg ", " addr "\n"
-#define user_lwr(reg, addr)		"lwr " reg ", " addr "\n"
-#define user_lh(reg, addr)		"lh " reg ", " addr "\n"
-#define user_lb(reg, addr)		"lb " reg ", " addr "\n"
-#define user_lbu(reg, addr)		"lbu " reg ", " addr "\n"
-#define user_sw(reg, addr)		"sw " reg ", " addr "\n"
-#define user_swl(reg, addr)		"swl " reg ", " addr "\n"
-#define user_swr(reg, addr)		"swr " reg ", " addr "\n"
-#define user_sh(reg, addr)		"sh " reg ", " addr "\n"
-#define user_sb(reg, addr)		"sb " reg ", " addr "\n"
+#define user_cache(op, base)		kernel_cache(op, base)
+#define user_ll(reg, addr)		kernel_ll(reg, addr)
+#define user_sc(reg, addr)		kernel_sc(reg, addr)
+#define user_lw(reg, addr)		kernel_lw(reg, addr)
+#define user_lwl(reg, addr)		kernel_lwl(reg, addr)
+#define user_lwr(reg, addr)		kernel_lwr(reg, addr)
+#define user_lh(reg, addr)		kernel_lh(reg, addr)
+#define user_lb(reg, addr)		kernel_lb(reg, addr)
+#define user_lbu(reg, addr)		kernel_lbu(reg, addr)
+#define user_sw(reg, addr)		kernel_sw(reg, addr)
+#define user_swl(reg, addr)		kernel_swl(reg, addr)
+#define user_swr(reg, addr)		kernel_swr(reg, addr)
+#define user_sh(reg, addr)		kernel_sh(reg, addr)
+#define user_sb(reg, addr)		kernel_sb(reg, addr)
 
 #ifdef CONFIG_32BIT
-/*
- * No 'sd' or 'ld' instructions in 32-bit but the code will
- * do the correct thing
- */
-#define user_sd(reg, addr)		user_sw(reg, addr)
-#define user_ld(reg, addr)		user_lw(reg, addr)
+#define user_sd(reg, addr)		kernel_sw(reg, addr)
+#define user_ld(reg, addr)		kernel_lw(reg, addr)
 #else
-#define user_sd(reg, addr)		"sd " reg", " addr "\n"
-#define user_ld(reg, addr)		"ld " reg", " addr "\n"
+#define user_sd(reg, addr)		kernel_sd(reg, addr)
+#define user_ld(reg, addr)		kernel_ld(reg, addr)
 #endif /* CONFIG_32BIT */
 
 #endif /* CONFIG_EVA */
 
 #else /* __ASSEMBLY__ */
 
+#define kernel_cache(op, base)		cache op, base
+#define kernel_ll(reg, addr)		ll reg, addr
+#define kernel_sc(reg, addr)		sc reg, addr
+#define kernel_lw(reg, addr)		lw reg, addr
+#define kernel_lwl(reg, addr)		lwl reg, addr
+#define kernel_lwr(reg, addr)		lwr reg, addr
+#define kernel_lh(reg, addr)		lh reg, addr
+#define kernel_lb(reg, addr)		lb reg, addr
+#define kernel_lbu(reg, addr)		lbu reg, addr
+#define kernel_sw(reg, addr)		sw reg, addr
+#define kernel_swl(reg, addr)		swl reg, addr
+#define kernel_swr(reg, addr)		swr reg, addr
+#define kernel_sh(reg, addr)		sh reg, addr
+#define kernel_sb(reg, addr)		sb reg, addr
+
+#ifdef CONFIG_32BIT
+/*
+ * No 'sd' or 'ld' instructions in 32-bit but the code will
+ * do the correct thing
+ */
+#define kernel_sd(reg, addr)		user_sw(reg, addr)
+#define kernel_ld(reg, addr)		user_lw(reg, addr)
+#else
+#define kernel_sd(reg, addr)		sd reg, addr
+#define kernel_ld(reg, addr)		ld reg, addr
+#endif /* CONFIG_32BIT */
+
 #ifdef CONFIG_EVA
 
 #define __BUILD_EVA_INSN(insn, reg, addr)			\
@@ -101,31 +154,27 @@
 #define user_sd(reg, addr)		user_sw(reg, addr)
 #else
 
-#define user_cache(op, base)		cache op, base
-#define user_ll(reg, addr)		ll reg, addr
-#define user_sc(reg, addr)		sc reg, addr
-#define user_lw(reg, addr)		lw reg, addr
-#define user_lwl(reg, addr)		lwl reg, addr
-#define user_lwr(reg, addr)		lwr reg, addr
-#define user_lh(reg, addr)		lh reg, addr
-#define user_lb(reg, addr)		lb reg, addr
-#define user_lbu(reg, addr)		lbu reg, addr
-#define user_sw(reg, addr)		sw reg, addr
-#define user_swl(reg, addr)		swl reg, addr
-#define user_swr(reg, addr)		swr reg, addr
-#define user_sh(reg, addr)		sh reg, addr
-#define user_sb(reg, addr)		sb reg, addr
+#define user_cache(op, base)		kernel_cache(op, base)
+#define user_ll(reg, addr)		kernel_ll(reg, addr)
+#define user_sc(reg, addr)		kernel_sc(reg, addr)
+#define user_lw(reg, addr)		kernel_lw(reg, addr)
+#define user_lwl(reg, addr)		kernel_lwl(reg, addr)
+#define user_lwr(reg, addr)		kernel_lwr(reg, addr)
+#define user_lh(reg, addr)		kernel_lh(reg, addr)
+#define user_lb(reg, addr)		kernel_lb(reg, addr)
+#define user_lbu(reg, addr)		kernel_lbu(reg, addr)
+#define user_sw(reg, addr)		kernel_sw(reg, addr)
+#define user_swl(reg, addr)		kernel_swl(reg, addr)
+#define user_swr(reg, addr)		kernel_swr(reg, addr)
+#define user_sh(reg, addr)		kernel_sh(reg, addr)
+#define user_sb(reg, addr)		kernel_sb(reg, addr)
 
 #ifdef CONFIG_32BIT
-/*
- * No 'sd' or 'ld' instructions in 32-bit but the code will
- * do the correct thing
- */
-#define user_sd(reg, addr)		user_sw(reg, addr)
-#define user_ld(reg, addr)		user_lw(reg, addr)
+#define user_sd(reg, addr)		kernel_sw(reg, addr)
+#define user_ld(reg, addr)		kernel_lw(reg, addr)
 #else
-#define user_sd(reg, addr)		sd reg, addr
-#define user_ld(reg, addr)		ld reg, addr
+#define user_sd(reg, addr)		kernel_sd(reg, addr)
+#define user_ld(reg, addr)		kernel_sd(reg, addr)
 #endif /* CONFIG_32BIT */
 
 #endif /* CONFIG_EVA */

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

* [PATCH 3.16.y-ckt 115/180] MIPS: Malta: Detect and fix bad memsize values
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (113 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 114/180] MIPS: asm: asm-eva: Introduce kernel load/store variants Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 116/180] clk: tegra: Register the proper number of resets Luis Henriques
                   ` (64 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Markos Chandras, linux-mips, Ralf Baechle, Luis Henriques

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

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

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

commit f7f8aea4b97c4d48e42f02cb37026bee445f239f upstream.

memsize denotes the amount of RAM we can access from kseg{0,1} and
that should be up to 256M. In case the bootloader reports a value
higher than that (perhaps reporting all the available RAM) it's best
if we fix it ourselves and just warn the user about that. This is
usually a problem with the bootloader and/or its environment.

[ralf@linux-mips.org: Remove useless parens as suggested bei Sergei.
Reformat long pr_warn statement to fit into 80 column limit.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9362/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/mti-malta/malta-memory.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index fdffc806664f..9b3a07d962ce 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -52,6 +52,12 @@ fw_memblock_t * __init fw_getmdesc(int eva)
 		pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
 		physical_memsize = 0x02000000;
 	} else {
+		if (memsize > (256 << 20)) { /* memsize should be capped to 256M */
+			pr_warn("Unsupported memsize value (0x%lx) detected! "
+				"Using 0x10000000 (256M) instead\n",
+				memsize);
+			memsize = 256 << 20;
+		}
 		/* If ememsize is set, then set physical_memsize to that */
 		physical_memsize = ememsize ? : memsize;
 	}

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

* [PATCH 3.16.y-ckt 116/180] clk: tegra: Register the proper number of resets
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (114 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 115/180] MIPS: Malta: Detect and fix bad memsize values Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 117/180] ALSA: hda - Add dock support for ThinkPad X250 (17aa:2226) Luis Henriques
                   ` (63 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter De Schrijver, Prashant Gaikwad, Thierry Reding, Luis Henriques

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

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

From: Thierry Reding <treding@nvidia.com>

commit 5e43e259171e1eee8bc074d9c44be434e685087b upstream.

The number of resets controls is 32 times the number of peripheral
register banks rather than 32 times the number of clocks. This reduces
(drastically) the number of reset controls registered from 10080 (315
clocks * 32) to 224 (6 peripheral register banks * 32).

This also fixes a potential crash because trying to use any of the
excess reset controls (224-10079) would have caused accesses beyond
the array bounds of the peripheral register banks definition array.

Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
Fixes: 6d5b988e7dc5 ("clk: tegra: implement a reset driver")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clk/tegra/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
index c0a7d7723510..a90af1780cf2 100644
--- a/drivers/clk/tegra/clk.c
+++ b/drivers/clk/tegra/clk.c
@@ -266,7 +266,7 @@ void __init tegra_add_of_provider(struct device_node *np)
 	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 
 	rst_ctlr.of_node = np;
-	rst_ctlr.nr_resets = clk_num * 32;
+	rst_ctlr.nr_resets = periph_banks * 32;
 	reset_controller_register(&rst_ctlr);
 }
 

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

* [PATCH 3.16.y-ckt 117/180] ALSA: hda - Add dock support for ThinkPad X250 (17aa:2226)
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (115 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 116/180] clk: tegra: Register the proper number of resets Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 118/180] clk: at91: usb: fix at91sam9x5 recalc, round and set rate Luis Henriques
                   ` (62 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yves-Alexis Perez, Takashi Iwai, Luis Henriques

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

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

From: Yves-Alexis Perez <corsac@debian.org>

commit c0278669fb61596cc1a10ab8686d27c37269c37b upstream.

This model uses the same dock port as the previous generation.

Signed-off-by: Yves-Alexis Perez <corsac@debian.org>
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 0b179484014d..c4401c4ad0f9 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4897,6 +4897,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
 	SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),

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

* [PATCH 3.16.y-ckt 118/180] clk: at91: usb: fix at91sam9x5 recalc, round and set rate
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (116 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 117/180] ALSA: hda - Add dock support for ThinkPad X250 (17aa:2226) Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 119/180] xtensa: ISS: fix locking in TAP network adapter Luis Henriques
                   ` (61 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Boris Brezillon, Michael Turquette, Luis Henriques

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

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

From: Boris Brezillon <boris.brezillon@free-electrons.com>

commit 69daf75aafc8410ef046c70be65c71f2dd4e08f9 upstream.

First check for rate == 0 in set_rate and round_rate to avoid div by zero.
Then, in order to get the closest rate, round all divisions to the closest
result instead of rounding them down.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
[ luis: 3.16 prereq for:
  4591243102fa "clk: at91: usb: propagate rate modification to the parent clk" ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clk/at91/clk-usb.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index 7d1d26a4bd04..03fda404bb96 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -52,29 +52,26 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw,
 
 	tmp = pmc_read(pmc, AT91_PMC_USB);
 	usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT;
-	return parent_rate / (usbdiv + 1);
+
+	return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1));
 }
 
 static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
 					  unsigned long *parent_rate)
 {
 	unsigned long div;
-	unsigned long bestrate;
-	unsigned long tmp;
+
+	if (!rate)
+		return -EINVAL;
 
 	if (rate >= *parent_rate)
 		return *parent_rate;
 
-	div = *parent_rate / rate;
-	if (div >= SAM9X5_USB_MAX_DIV)
-		return *parent_rate / (SAM9X5_USB_MAX_DIV + 1);
+	div = DIV_ROUND_CLOSEST(*parent_rate, rate);
+	if (div > SAM9X5_USB_MAX_DIV + 1)
+		div = SAM9X5_USB_MAX_DIV + 1;
 
-	bestrate = *parent_rate / div;
-	tmp = *parent_rate / (div + 1);
-	if (bestrate - rate > rate - tmp)
-		bestrate = tmp;
-
-	return bestrate;
+	return DIV_ROUND_CLOSEST(*parent_rate, div);
 }
 
 static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index)
@@ -106,9 +103,13 @@ static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate,
 	u32 tmp;
 	struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
 	struct at91_pmc *pmc = usb->pmc;
-	unsigned long div = parent_rate / rate;
+	unsigned long div;
+
+	if (!rate)
+		return -EINVAL;
 
-	if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV)
+	div = DIV_ROUND_CLOSEST(parent_rate, rate);
+	if (div > SAM9X5_USB_MAX_DIV + 1 || !div)
 		return -EINVAL;
 
 	tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV;

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

* [PATCH 3.16.y-ckt 119/180] xtensa: ISS: fix locking in TAP network adapter
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (117 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 118/180] clk: at91: usb: fix at91sam9x5 recalc, round and set rate Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 120/180] nosave: consolidate __nosave_{begin,end} in <asm/sections.h> Luis Henriques
                   ` (60 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Luis Henriques

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

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

From: Max Filippov <jcmvbkbc@gmail.com>

commit 24e94454c8cb6a13634f5a2f5a01da53a546a58d upstream.

- don't lock lp->lock in the iss_net_timer for the call of iss_net_poll,
  it will lock it itself;
- invert order of lp->lock and opened_lock acquisition in the
  iss_net_open to make it consistent with iss_net_poll;
- replace spin_lock with spin_lock_bh when acquiring locks used in
  iss_net_timer from non-atomic context;
- replace spin_lock_irqsave with spin_lock_bh in the iss_net_start_xmit
  as the driver doesn't use lp->lock in the hard IRQ context;
- replace __SPIN_LOCK_UNLOCKED(lp.lock) with spin_lock_init, otherwise
  lockdep is unhappy about using non-static key.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/xtensa/platforms/iss/network.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index d05f8feeb8d7..17b1ef3232e4 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -349,8 +349,8 @@ static void iss_net_timer(unsigned long priv)
 {
 	struct iss_net_private *lp = (struct iss_net_private *)priv;
 
-	spin_lock(&lp->lock);
 	iss_net_poll();
+	spin_lock(&lp->lock);
 	mod_timer(&lp->timer, jiffies + lp->timer_val);
 	spin_unlock(&lp->lock);
 }
@@ -361,7 +361,7 @@ static int iss_net_open(struct net_device *dev)
 	struct iss_net_private *lp = netdev_priv(dev);
 	int err;
 
-	spin_lock(&lp->lock);
+	spin_lock_bh(&lp->lock);
 
 	err = lp->tp.open(lp);
 	if (err < 0)
@@ -376,9 +376,11 @@ static int iss_net_open(struct net_device *dev)
 	while ((err = iss_net_rx(dev)) > 0)
 		;
 
-	spin_lock(&opened_lock);
+	spin_unlock_bh(&lp->lock);
+	spin_lock_bh(&opened_lock);
 	list_add(&lp->opened_list, &opened);
-	spin_unlock(&opened_lock);
+	spin_unlock_bh(&opened_lock);
+	spin_lock_bh(&lp->lock);
 
 	init_timer(&lp->timer);
 	lp->timer_val = ISS_NET_TIMER_VALUE;
@@ -387,7 +389,7 @@ static int iss_net_open(struct net_device *dev)
 	mod_timer(&lp->timer, jiffies + lp->timer_val);
 
 out:
-	spin_unlock(&lp->lock);
+	spin_unlock_bh(&lp->lock);
 	return err;
 }
 
@@ -395,7 +397,7 @@ static int iss_net_close(struct net_device *dev)
 {
 	struct iss_net_private *lp = netdev_priv(dev);
 	netif_stop_queue(dev);
-	spin_lock(&lp->lock);
+	spin_lock_bh(&lp->lock);
 
 	spin_lock(&opened_lock);
 	list_del(&opened);
@@ -405,18 +407,17 @@ static int iss_net_close(struct net_device *dev)
 
 	lp->tp.close(lp);
 
-	spin_unlock(&lp->lock);
+	spin_unlock_bh(&lp->lock);
 	return 0;
 }
 
 static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct iss_net_private *lp = netdev_priv(dev);
-	unsigned long flags;
 	int len;
 
 	netif_stop_queue(dev);
-	spin_lock_irqsave(&lp->lock, flags);
+	spin_lock_bh(&lp->lock);
 
 	len = lp->tp.write(lp, &skb);
 
@@ -438,7 +439,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		pr_err("%s: %s failed(%d)\n", dev->name, __func__, len);
 	}
 
-	spin_unlock_irqrestore(&lp->lock, flags);
+	spin_unlock_bh(&lp->lock);
 
 	dev_kfree_skb(skb);
 	return NETDEV_TX_OK;
@@ -466,9 +467,9 @@ static int iss_net_set_mac(struct net_device *dev, void *addr)
 
 	if (!is_valid_ether_addr(hwaddr->sa_data))
 		return -EADDRNOTAVAIL;
-	spin_lock(&lp->lock);
+	spin_lock_bh(&lp->lock);
 	memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
-	spin_unlock(&lp->lock);
+	spin_unlock_bh(&lp->lock);
 	return 0;
 }
 
@@ -520,11 +521,11 @@ static int iss_net_configure(int index, char *init)
 	*lp = (struct iss_net_private) {
 		.device_list		= LIST_HEAD_INIT(lp->device_list),
 		.opened_list		= LIST_HEAD_INIT(lp->opened_list),
-		.lock			= __SPIN_LOCK_UNLOCKED(lp.lock),
 		.dev			= dev,
 		.index			= index,
-		};
+	};
 
+	spin_lock_init(&lp->lock);
 	/*
 	 * If this name ends up conflicting with an existing registered
 	 * netdevice, that is OK, register_netdev{,ice}() will notice this

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

* [PATCH 3.16.y-ckt 120/180] nosave: consolidate __nosave_{begin,end} in <asm/sections.h>
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (118 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 119/180] xtensa: ISS: fix locking in TAP network adapter Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 121/180] s390/hibernate: fix save and restore of kernel text section Luis Henriques
                   ` (59 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Geert Uytterhoeven, Russell King, Ralf Baechle,
	Benjamin Herrenschmidt, Martin Schwidefsky, David S. Miller,
	Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Geert Uytterhoeven <geert@linux-m68k.org>

commit 7f8998c7aef3ac9c5f3f2943e083dfa6302e90d0 upstream.

The different architectures used their own (and different) declarations:

    extern __visible const void __nosave_begin, __nosave_end;
    extern const void __nosave_begin, __nosave_end;
    extern long __nosave_begin, __nosave_end;

Consolidate them using the first variant in <asm/sections.h>.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.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>
---
 arch/arm/kernel/hibernate.c       | 3 +--
 arch/mips/include/asm/suspend.h   | 7 -------
 arch/mips/power/cpu.c             | 2 +-
 arch/powerpc/kernel/suspend.c     | 4 +---
 arch/s390/kernel/suspend.c        | 6 +-----
 arch/sh/include/asm/sections.h    | 1 -
 arch/sparc/power/hibernate.c      | 4 +---
 arch/unicore32/include/mach/pm.h  | 3 ---
 arch/unicore32/kernel/hibernate.c | 1 +
 arch/x86/power/hibernate_32.c     | 4 +---
 arch/x86/power/hibernate_64.c     | 4 +---
 include/asm-generic/sections.h    | 4 ++++
 12 files changed, 12 insertions(+), 31 deletions(-)
 delete mode 100644 arch/mips/include/asm/suspend.h

diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
index bb8b79648643..c4cc50e58c13 100644
--- a/arch/arm/kernel/hibernate.c
+++ b/arch/arm/kernel/hibernate.c
@@ -21,8 +21,7 @@
 #include <asm/idmap.h>
 #include <asm/suspend.h>
 #include <asm/memory.h>
-
-extern const void __nosave_begin, __nosave_end;
+#include <asm/sections.h>
 
 int pfn_is_nosave(unsigned long pfn)
 {
diff --git a/arch/mips/include/asm/suspend.h b/arch/mips/include/asm/suspend.h
deleted file mode 100644
index 3adac3b53d19..000000000000
--- a/arch/mips/include/asm/suspend.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __ASM_SUSPEND_H
-#define __ASM_SUSPEND_H
-
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
-#endif /* __ASM_SUSPEND_H */
diff --git a/arch/mips/power/cpu.c b/arch/mips/power/cpu.c
index 521e5963df05..2129e67723ff 100644
--- a/arch/mips/power/cpu.c
+++ b/arch/mips/power/cpu.c
@@ -7,7 +7,7 @@
  * Author: Hu Hongbing <huhb@lemote.com>
  *	   Wu Zhangjin <wuzhangjin@gmail.com>
  */
-#include <asm/suspend.h>
+#include <asm/sections.h>
 #include <asm/fpu.h>
 #include <asm/dsp.h>
 
diff --git a/arch/powerpc/kernel/suspend.c b/arch/powerpc/kernel/suspend.c
index 0167d53da30c..a531154cc0f3 100644
--- a/arch/powerpc/kernel/suspend.c
+++ b/arch/powerpc/kernel/suspend.c
@@ -9,9 +9,7 @@
 
 #include <linux/mm.h>
 #include <asm/page.h>
-
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
+#include <asm/sections.h>
 
 /*
  *	pfn_is_nosave - check if given pfn is in the 'nosave' section
diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index a7a7537ce1e7..1c4c5accd220 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -13,14 +13,10 @@
 #include <asm/ipl.h>
 #include <asm/cio.h>
 #include <asm/pci.h>
+#include <asm/sections.h>
 #include "entry.h"
 
 /*
- * References to section boundaries
- */
-extern const void __nosave_begin, __nosave_end;
-
-/*
  * The restore of the saved pages in an hibernation image will set
  * the change and referenced bits in the storage key for each page.
  * Overindication of the referenced bits after an hibernation cycle
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h
index 1b6199740e98..7a99e6af6372 100644
--- a/arch/sh/include/asm/sections.h
+++ b/arch/sh/include/asm/sections.h
@@ -3,7 +3,6 @@
 
 #include <asm-generic/sections.h>
 
-extern long __nosave_begin, __nosave_end;
 extern long __machvec_start, __machvec_end;
 extern char __uncached_start, __uncached_end;
 extern char __start_eh_frame[], __stop_eh_frame[];
diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c
index 42b0b8ce699a..17bd2e167e07 100644
--- a/arch/sparc/power/hibernate.c
+++ b/arch/sparc/power/hibernate.c
@@ -9,11 +9,9 @@
 #include <asm/hibernate.h>
 #include <asm/visasm.h>
 #include <asm/page.h>
+#include <asm/sections.h>
 #include <asm/tlb.h>
 
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
 struct saved_context saved_context;
 
 /*
diff --git a/arch/unicore32/include/mach/pm.h b/arch/unicore32/include/mach/pm.h
index 4dcd34ae194c..77b522694e74 100644
--- a/arch/unicore32/include/mach/pm.h
+++ b/arch/unicore32/include/mach/pm.h
@@ -36,8 +36,5 @@ extern int puv3_pm_enter(suspend_state_t state);
 /* Defined in hibernate_asm.S */
 extern int restore_image(pgd_t *resume_pg_dir, struct pbe *restore_pblist);
 
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
 extern struct pbe *restore_pblist;
 #endif
diff --git a/arch/unicore32/kernel/hibernate.c b/arch/unicore32/kernel/hibernate.c
index d75ef8b6cb56..9969ec374abb 100644
--- a/arch/unicore32/kernel/hibernate.c
+++ b/arch/unicore32/kernel/hibernate.c
@@ -18,6 +18,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
+#include <asm/sections.h>
 #include <asm/suspend.h>
 
 #include "mach/pm.h"
diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
index 7d28c885d238..291226b952a9 100644
--- a/arch/x86/power/hibernate_32.c
+++ b/arch/x86/power/hibernate_32.c
@@ -13,13 +13,11 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/mmzone.h>
+#include <asm/sections.h>
 
 /* Defined in hibernate_asm_32.S */
 extern int restore_image(void);
 
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
 /* Pointer to the temporary resume page tables */
 pgd_t *resume_pg_dir;
 
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index 35e2bb6c0f37..009947d419a6 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -17,11 +17,9 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/mtrr.h>
+#include <asm/sections.h>
 #include <asm/suspend.h>
 
-/* References to section boundaries */
-extern __visible const void __nosave_begin, __nosave_end;
-
 /* Defined in hibernate_asm_64.S */
 extern asmlinkage __visible int restore_image(void);
 
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index f1a24b5c3b90..b58fd667f87b 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -3,6 +3,8 @@
 
 /* References to section boundaries */
 
+#include <linux/compiler.h>
+
 /*
  * Usage guidelines:
  * _text, _data: architecture specific, don't use them in arch-independent code
@@ -37,6 +39,8 @@ extern char __start_rodata[], __end_rodata[];
 /* Start and end of .ctors section - used for constructor calls. */
 extern char __ctors_start[], __ctors_end[];
 
+extern __visible const void __nosave_begin, __nosave_end;
+
 /* function descriptor handling (if any).  Override
  * in asm/sections.h */
 #ifndef dereference_function_descriptor

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

* [PATCH 3.16.y-ckt 121/180] s390/hibernate: fix save and restore of kernel text section
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (119 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 120/180] nosave: consolidate __nosave_{begin,end} in <asm/sections.h> Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 122/180] ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450 Luis Henriques
                   ` (58 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Heiko Carstens, Martin Schwidefsky, Luis Henriques

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

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

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

commit d74419495633493c9cd3f2bbeb7f3529d0edded6 upstream.

Sebastian reported a crash caused by a jump label mismatch after resume.
This happens because we do not save the kernel text section during suspend
and therefore also do not restore it during resume, but use the kernel image
that restores the old system.

This means that after a suspend/resume cycle we lost all modifications done
to the kernel text section.
The reason for this is the pfn_is_nosave() function, which incorrectly
returns that read-only pages don't need to be saved. This is incorrect since
we mark the kernel text section read-only.
We still need to make sure to not save and restore pages contained within
NSS and DCSS segment.
To fix this add an extra case for the kernel text section and only save
those pages if they are not contained within an NSS segment.

Fixes the following crash (and the above bugs as well):

Jump label code mismatch at netif_receive_skb_internal+0x28/0xd0
Found:    c0 04 00 00 00 00
Expected: c0 f4 00 00 00 11
New:      c0 04 00 00 00 00
Kernel panic - not syncing: Corrupted kernel text
CPU: 0 PID: 9 Comm: migration/0 Not tainted 3.19.0-01975-gb1b096e70f23 #4
Call Trace:
  [<0000000000113972>] show_stack+0x72/0xf0
  [<000000000081f15e>] dump_stack+0x6e/0x90
  [<000000000081c4e8>] panic+0x108/0x2b0
  [<000000000081be64>] jump_label_bug.isra.2+0x104/0x108
  [<0000000000112176>] __jump_label_transform+0x9e/0xd0
  [<00000000001121e6>] __sm_arch_jump_label_transform+0x3e/0x50
  [<00000000001d1136>] multi_cpu_stop+0x12e/0x170
  [<00000000001d1472>] cpu_stopper_thread+0xb2/0x168
  [<000000000015d2ac>] smpboot_thread_fn+0x134/0x1b0
  [<0000000000158baa>] kthread+0x10a/0x110
  [<0000000000824a86>] kernel_thread_starter+0x6/0xc

Reported-and-tested-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/s390/kernel/suspend.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index 1c4c5accd220..d3236c9e226b 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -138,6 +138,8 @@ int pfn_is_nosave(unsigned long pfn)
 {
 	unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
 	unsigned long nosave_end_pfn = PFN_DOWN(__pa(&__nosave_end));
+	unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1;
+	unsigned long stext_pfn = PFN_DOWN(__pa(&_stext));
 
 	/* Always save lowcore pages (LC protection might be enabled). */
 	if (pfn <= LC_PAGES)
@@ -145,6 +147,8 @@ int pfn_is_nosave(unsigned long pfn)
 	if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn)
 		return 1;
 	/* Skip memory holes and read-only pages (NSS, DCSS, ...). */
+	if (pfn >= stext_pfn && pfn <= eshared_pfn)
+		return ipl_info.type == IPL_TYPE_NSS ? 1 : 0;
 	if (tprot(PFN_PHYS(pfn)))
 		return 1;
 	return 0;

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

* [PATCH 3.16.y-ckt 122/180] ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (120 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 121/180] s390/hibernate: fix save and restore of kernel text section Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 123/180] Btrfs: fix inode eviction infinite loop after extent_same ioctl Luis Henriques
                   ` (57 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jo-Philipp Wich, Takashi Iwai, Luis Henriques

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

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

From: Jo-Philipp Wich <jow@openwrt.org>

commit f2aa111041ce36b94e651d882458dea502e76721 upstream.

The Lenovo Thinkpad T450 requires the ALC292_FIXUP_TPT440_DOCK as well in
order to get working sound output on the docking stations headphone jack.

Patch tested on a Thinkpad T450 (20BVCTO1WW) using kernel 4.0-rc7 in
conjunction with a ThinkPad Ultradock.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
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 c4401c4ad0f9..7b16c8ca5faf 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4903,6 +4903,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, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
 	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),

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

* [PATCH 3.16.y-ckt 123/180] Btrfs: fix inode eviction infinite loop after extent_same ioctl
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (121 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 122/180] ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450 Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 124/180] Btrfs: fix inode eviction infinite loop after cloning into it Luis Henriques
                   ` (56 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Filipe Manana, Chris Mason, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit 113e8283869b9855c8b999796aadd506bbac155f upstream.

If we pass a length of 0 to the extent_same ioctl, we end up locking an
extent range with a start offset greater then its end offset (if the
destination file's offset is greater than zero). This results in a warning
from extent_io.c:insert_state through the following call chain:

  btrfs_extent_same()
    btrfs_double_lock()
      lock_extent_range()
        lock_extent(inode->io_tree, offset, offset + len - 1)
          lock_extent_bits()
            __set_extent_bit()
              insert_state()
                --> WARN_ON(end < start)

This leads to an infinite loop when evicting the inode. This is the same
problem that my previous patch titled
"Btrfs: fix inode eviction infinite loop after cloning into it" addressed
but for the extent_same ioctl instead of the clone ioctl.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 4e395f3f251d..c5b7213f267a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2941,6 +2941,9 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 len,
 	if (src == dst)
 		return -EINVAL;
 
+	if (len == 0)
+		return 0;
+
 	btrfs_double_lock(src, loff, dst, dst_loff, len);
 
 	ret = extent_same_check_offsets(src, loff, len);

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

* [PATCH 3.16.y-ckt 124/180] Btrfs: fix inode eviction infinite loop after cloning into it
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (122 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 123/180] Btrfs: fix inode eviction infinite loop after extent_same ioctl Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 125/180] powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH Luis Henriques
                   ` (55 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Filipe Manana, Chris Mason, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit ccccf3d67294714af2d72a6fd6fd7d73b01c9329 upstream.

If we attempt to clone a 0 length region into a file we can end up
inserting a range in the inode's extent_io tree with a start offset
that is greater then the end offset, which triggers immediately the
following warning:

[ 3914.619057] WARNING: CPU: 17 PID: 4199 at fs/btrfs/extent_io.c:435 insert_state+0x4b/0x10b [btrfs]()
[ 3914.620886] BTRFS: end < start 4095 4096
(...)
[ 3914.638093] Call Trace:
[ 3914.638636]  [<ffffffff81425fd9>] dump_stack+0x4c/0x65
[ 3914.639620]  [<ffffffff81045390>] warn_slowpath_common+0xa1/0xbb
[ 3914.640789]  [<ffffffffa03ca44f>] ? insert_state+0x4b/0x10b [btrfs]
[ 3914.642041]  [<ffffffff810453f0>] warn_slowpath_fmt+0x46/0x48
[ 3914.643236]  [<ffffffffa03ca44f>] insert_state+0x4b/0x10b [btrfs]
[ 3914.644441]  [<ffffffffa03ca729>] __set_extent_bit+0x107/0x3f4 [btrfs]
[ 3914.645711]  [<ffffffffa03cb256>] lock_extent_bits+0x65/0x1bf [btrfs]
[ 3914.646914]  [<ffffffff8142b2fb>] ? _raw_spin_unlock+0x28/0x33
[ 3914.648058]  [<ffffffffa03cbac4>] ? test_range_bit+0xcc/0xde [btrfs]
[ 3914.650105]  [<ffffffffa03cb3c3>] lock_extent+0x13/0x15 [btrfs]
[ 3914.651361]  [<ffffffffa03db39e>] lock_extent_range+0x3d/0xcd [btrfs]
[ 3914.652761]  [<ffffffffa03de1fe>] btrfs_ioctl_clone+0x278/0x388 [btrfs]
[ 3914.654128]  [<ffffffff811226dd>] ? might_fault+0x58/0xb5
[ 3914.655320]  [<ffffffffa03e0909>] btrfs_ioctl+0xb51/0x2195 [btrfs]
(...)
[ 3914.669271] ---[ end trace 14843d3e2e622fc1 ]---

This later makes the inode eviction handler enter an infinite loop that
keeps dumping the following warning over and over:

[ 3915.117629] WARNING: CPU: 22 PID: 4228 at fs/btrfs/extent_io.c:435 insert_state+0x4b/0x10b [btrfs]()
[ 3915.119913] BTRFS: end < start 4095 4096
(...)
[ 3915.137394] Call Trace:
[ 3915.137913]  [<ffffffff81425fd9>] dump_stack+0x4c/0x65
[ 3915.139154]  [<ffffffff81045390>] warn_slowpath_common+0xa1/0xbb
[ 3915.140316]  [<ffffffffa03ca44f>] ? insert_state+0x4b/0x10b [btrfs]
[ 3915.141505]  [<ffffffff810453f0>] warn_slowpath_fmt+0x46/0x48
[ 3915.142709]  [<ffffffffa03ca44f>] insert_state+0x4b/0x10b [btrfs]
[ 3915.143849]  [<ffffffffa03ca729>] __set_extent_bit+0x107/0x3f4 [btrfs]
[ 3915.145120]  [<ffffffffa038c1e3>] ? btrfs_kill_super+0x17/0x23 [btrfs]
[ 3915.146352]  [<ffffffff811548f6>] ? deactivate_locked_super+0x3b/0x50
[ 3915.147565]  [<ffffffffa03cb256>] lock_extent_bits+0x65/0x1bf [btrfs]
[ 3915.148785]  [<ffffffff8142b7e2>] ? _raw_write_unlock+0x28/0x33
[ 3915.149931]  [<ffffffffa03bc325>] btrfs_evict_inode+0x196/0x482 [btrfs]
[ 3915.151154]  [<ffffffff81168904>] evict+0xa0/0x148
[ 3915.152094]  [<ffffffff811689e5>] dispose_list+0x39/0x43
[ 3915.153081]  [<ffffffff81169564>] evict_inodes+0xdc/0xeb
[ 3915.154062]  [<ffffffff81154418>] generic_shutdown_super+0x49/0xef
[ 3915.155193]  [<ffffffff811546d1>] kill_anon_super+0x13/0x1e
[ 3915.156274]  [<ffffffffa038c1e3>] btrfs_kill_super+0x17/0x23 [btrfs]
(...)
[ 3915.167404] ---[ end trace 14843d3e2e622fc2 ]---

So just bail out of the clone ioctl if the length of the region to clone
is zero, without locking any extent range, in order to prevent this issue
(same behaviour as a pwrite with a 0 length for example).

This is trivial to reproduce. For example, the steps for the test I just
made for fstests:

  mkfs.btrfs -f SCRATCH_DEV
  mount SCRATCH_DEV $SCRATCH_MNT

  touch $SCRATCH_MNT/foo
  touch $SCRATCH_MNT/bar

  $CLONER_PROG -s 0 -d 4096 -l 0 $SCRATCH_MNT/foo $SCRATCH_MNT/bar
  umount $SCRATCH_MNT

A test case for fstests follows soon.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/ioctl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c5b7213f267a..5576abb92a23 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3672,6 +3672,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
 	if (off + len == src->i_size)
 		len = ALIGN(src->i_size, bs) - off;
 
+	if (len == 0) {
+		ret = 0;
+		goto out_unlock;
+	}
+
 	/* verify the end result is block aligned */
 	if (!IS_ALIGNED(off, bs) || !IS_ALIGNED(off + len, bs) ||
 	    !IS_ALIGNED(destoff, bs))

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

* [PATCH 3.16.y-ckt 125/180] powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (123 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 124/180] Btrfs: fix inode eviction infinite loop after cloning into it Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 126/180] ACPICA: Tables: Don't release ACPI_MTX_TABLES in acpi_tb_install_standard_table() Luis Henriques
                   ` (54 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Anton Blanchard, Michael Ellerman, Luis Henriques

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

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

From: Anton Blanchard <anton@samba.org>

commit 9a5cbce421a283e6aea3c4007f141735bf9da8c3 upstream.

We cap 32bit userspace backtraces to PERF_MAX_STACK_DEPTH
(currently 127), but we forgot to do the same for 64bit backtraces.

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/perf/callchain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index 2396dda282cd..ead55351b254 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -243,7 +243,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
 	sp = regs->gpr[1];
 	perf_callchain_store(entry, next_ip);
 
-	for (;;) {
+	while (entry->nr < PERF_MAX_STACK_DEPTH) {
 		fp = (unsigned long __user *) sp;
 		if (!valid_user_sp(sp, 1) || read_user_stack_64(fp, &next_sp))
 			return;

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

* [PATCH 3.16.y-ckt 126/180] ACPICA: Tables: Don't release ACPI_MTX_TABLES in acpi_tb_install_standard_table().
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (124 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 125/180] powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 127/180] drm/i915: Dont enable CS_PARSER_ERROR interrupts at all Luis Henriques
                   ` (53 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Octavian Purdila, Lv Zheng, Bob Moore, Rafael J. Wysocki, Luis Henriques

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

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

From: Octavian Purdila <octavian.purdila@intel.com>

commit 77ddc2fe08329e375505bc36a3df3233fe57317b upstream.

ACPICA commit c70434d4da13e65b6163c79a5aa16b40193631c7

ACPI_MTX_TABLES is acquired and released by the callers of
acpi_tb_install_standard_table() so releasing it in the function itself is
causing the following error in Linux kernel if the table is reloaded:

ACPI Error: Mutex [0x2] is not acquired, cannot release (20141107/utmutex-321)
Call Trace:
  [<ffffffff81b0bd48>] dump_stack+0x4f/0x7b
  [<ffffffff81546bf5>] acpi_ut_release_mutex+0x47/0x67
  [<ffffffff81544357>] acpi_load_table+0x73/0xcb

Link: https://github.com/acpica/acpica/commit/c70434d4
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/acpica/tbinstal.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 755b90c40ddf..c0b39f304ea3 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -346,7 +346,6 @@ acpi_tb_install_standard_table(acpi_physical_address address,
 				 */
 				acpi_tb_uninstall_table(&new_table_desc);
 				*table_index = i;
-				(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
 				return_ACPI_STATUS(AE_OK);
 			}
 		}

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

* [PATCH 3.16.y-ckt 127/180] drm/i915: Dont enable CS_PARSER_ERROR interrupts at all
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (125 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 126/180] ACPICA: Tables: Don't release ACPI_MTX_TABLES in acpi_tb_install_standard_table() Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 128/180] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save Luis Henriques
                   ` (52 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Vetter, Jani Nikula, Luis Henriques

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

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

From: Daniel Vetter <daniel.vetter@ffwll.ch>

commit 37ef01ab5d24d1d520dc79f6a98099d451c2a901 upstream.

We stopped handling them in

commit aaecdf611a05cac26a94713bad25297e60225c29
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue Nov 4 15:52:22 2014 +0100

    drm/i915: Stop gathering error states for CS error interrupts

but just clearing is apparently not enough: A sufficiently dead gpu
left behind by firmware (*cough* coreboot *cough*) can keep the gpu in
an endless loop of such interrupts, eventually leading to the nmi
firing. And definitely to what looks like a machine hang.

Since we don't even enable these interrupts on gen5+ let's do the same
on earlier platforms.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=93171
Tested-by: Mono <mono-for-kernel-org@donderklumpen.de>
Tested-by: info@gluglug.org.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 085cb5645e66..a736b4af46f1 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -3687,14 +3687,12 @@ static int i8xx_irq_postinstall(struct drm_device *dev)
 		~(I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
 		  I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
 		  I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
-		  I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT |
-		  I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
+		  I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT);
 	I915_WRITE16(IMR, dev_priv->irq_mask);
 
 	I915_WRITE16(IER,
 		     I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
 		     I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
-		     I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT |
 		     I915_USER_INTERRUPT);
 	POSTING_READ16(IER);
 
@@ -3856,14 +3854,12 @@ static int i915_irq_postinstall(struct drm_device *dev)
 		  I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
 		  I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
 		  I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
-		  I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT |
-		  I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
+		  I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT);
 
 	enable_mask =
 		I915_ASLE_INTERRUPT |
 		I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
 		I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
-		I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT |
 		I915_USER_INTERRUPT;
 
 	if (I915_HAS_HOTPLUG(dev)) {

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

* [PATCH 3.16.y-ckt 128/180] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (126 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 127/180] drm/i915: Dont enable CS_PARSER_ERROR interrupts at all Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 129/180] target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling Luis Henriques
                   ` (51 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nadav Amit, Paolo Bonzini, Luis Henriques

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

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

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

commit 9e9c3fe40bcd28e3f98f0ad8408435f4503f2781 upstream.

kvm_init_msr_list is currently called before hardware_setup. As a result,
vmx_mpx_supported always returns false when kvm_init_msr_list checks whether to
save MSR_IA32_BNDCFGS.

Move kvm_init_msr_list after vmx_hardware_setup is called to fix this issue.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>

Message-Id: <1428864435-4732-1-git-send-email-namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kvm/x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a711a0d1ebc3..6018e319d7fb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5634,7 +5634,6 @@ int kvm_arch_init(void *opaque)
 	kvm_set_mmio_spte_mask();
 
 	kvm_x86_ops = ops;
-	kvm_init_msr_list();
 
 	kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
 			PT_DIRTY_MASK, PT64_NX_MASK, 0);
@@ -7015,7 +7014,14 @@ void kvm_arch_hardware_disable(void *garbage)
 
 int kvm_arch_hardware_setup(void)
 {
-	return kvm_x86_ops->hardware_setup();
+	int r;
+
+	r = kvm_x86_ops->hardware_setup();
+	if (r != 0)
+		return r;
+
+	kvm_init_msr_list();
+	return 0;
 }
 
 void kvm_arch_hardware_unsetup(void)

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

* [PATCH 3.16.y-ckt 129/180] target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (127 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 128/180] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 130/180] mm/hugetlb: use pmd_page() in follow_huge_pmd() Luis Henriques
                   ` (50 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christoph Hellwig, Nicholas Bellinger, Luis Henriques

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

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

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

commit c8e639852ad720499912acedfd6b072325fd2807 upstream.

This patch fixes a bug for COMPARE_AND_WRITE handling with
fabrics using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.

It adds the missing allocation for cmd->t_bidi_data_sg within
transport_generic_new_cmd() that is used by COMPARE_AND_WRITE
for the initial READ payload, even if the fabric is already
providing a pre-allocated buffer for cmd->t_data_sg.

Also, fix zero-length COMPARE_AND_WRITE handling within the
compare_and_write_callback() and target_complete_ok_work()
to queue the response, skipping the initial READ.

This fixes COMPARE_AND_WRITE emulation with loopback, vhost,
and xen-backend fabric drivers using SG_TO_MEM_NOALLOC.

Reported-by: Christoph Hellwig <hch@lst.de>
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_sbc.c       | 15 +++++++++-----
 drivers/target/target_core_transport.c | 37 ++++++++++++++++++++++++++++++----
 include/target/target_core_base.h      |  2 +-
 3 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index ccddbd1d97ed..be2a1000e3dd 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -299,7 +299,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
 	return 0;
 }
 
-static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd)
+static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success)
 {
 	unsigned char *buf, *addr;
 	struct scatterlist *sg;
@@ -363,7 +363,7 @@ sbc_execute_rw(struct se_cmd *cmd)
 			       cmd->data_direction);
 }
 
-static sense_reason_t compare_and_write_post(struct se_cmd *cmd)
+static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success)
 {
 	struct se_device *dev = cmd->se_dev;
 
@@ -386,7 +386,7 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd)
 	return TCM_NO_SENSE;
 }
 
-static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
+static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success)
 {
 	struct se_device *dev = cmd->se_dev;
 	struct scatterlist *write_sg = NULL, *sg;
@@ -401,11 +401,16 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
 
 	/*
 	 * Handle early failure in transport_generic_request_failure(),
-	 * which will not have taken ->caw_mutex yet..
+	 * which will not have taken ->caw_sem yet..
 	 */
-	if (!cmd->t_data_sg || !cmd->t_bidi_data_sg)
+	if (!success && (!cmd->t_data_sg || !cmd->t_bidi_data_sg))
 		return TCM_NO_SENSE;
 	/*
+	 * Handle special case for zero-length COMPARE_AND_WRITE
+	 */
+	if (!cmd->data_length)
+		goto out;
+	/*
 	 * Immediately exit + release dev->caw_sem if command has already
 	 * been failed with a non-zero SCSI status.
 	 */
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 83b0d08c9d5b..b32cbb8ab5b8 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1613,11 +1613,11 @@ void transport_generic_request_failure(struct se_cmd *cmd,
 	transport_complete_task_attr(cmd);
 	/*
 	 * Handle special case for COMPARE_AND_WRITE failure, where the
-	 * callback is expected to drop the per device ->caw_mutex.
+	 * callback is expected to drop the per device ->caw_sem.
 	 */
 	if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
 	     cmd->transport_complete_callback)
-		cmd->transport_complete_callback(cmd);
+		cmd->transport_complete_callback(cmd, false);
 
 	switch (sense_reason) {
 	case TCM_NON_EXISTENT_LUN:
@@ -1978,8 +1978,12 @@ static void target_complete_ok_work(struct work_struct *work)
 	if (cmd->transport_complete_callback) {
 		sense_reason_t rc;
 
-		rc = cmd->transport_complete_callback(cmd);
+		rc = cmd->transport_complete_callback(cmd, true);
 		if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
+			if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
+			    !cmd->data_length)
+				goto queue_rsp;
+
 			return;
 		} else if (rc) {
 			ret = transport_send_check_condition_and_sense(cmd,
@@ -1993,6 +1997,7 @@ static void target_complete_ok_work(struct work_struct *work)
 		}
 	}
 
+queue_rsp:
 	switch (cmd->data_direction) {
 	case DMA_FROM_DEVICE:
 		spin_lock(&cmd->se_lun->lun_sep_lock);
@@ -2097,6 +2102,16 @@ static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
 static inline void transport_free_pages(struct se_cmd *cmd)
 {
 	if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
+		/*
+		 * Release special case READ buffer payload required for
+		 * SG_TO_MEM_NOALLOC to function with COMPARE_AND_WRITE
+		 */
+		if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) {
+			transport_free_sgl(cmd->t_bidi_data_sg,
+					   cmd->t_bidi_data_nents);
+			cmd->t_bidi_data_sg = NULL;
+			cmd->t_bidi_data_nents = 0;
+		}
 		transport_reset_sgl_orig(cmd);
 		return;
 	}
@@ -2249,6 +2264,7 @@ sense_reason_t
 transport_generic_new_cmd(struct se_cmd *cmd)
 {
 	int ret = 0;
+	bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
 
 	/*
 	 * Determine is the TCM fabric module has already allocated physical
@@ -2257,7 +2273,6 @@ transport_generic_new_cmd(struct se_cmd *cmd)
 	 */
 	if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) &&
 	    cmd->data_length) {
-		bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
 
 		if ((cmd->se_cmd_flags & SCF_BIDI) ||
 		    (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE)) {
@@ -2288,6 +2303,20 @@ transport_generic_new_cmd(struct se_cmd *cmd)
 				       cmd->data_length, zero_flag);
 		if (ret < 0)
 			return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+	} else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
+		    cmd->data_length) {
+		/*
+		 * Special case for COMPARE_AND_WRITE with fabrics
+		 * using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.
+		 */
+		u32 caw_length = cmd->t_task_nolb *
+				 cmd->se_dev->dev_attrib.block_size;
+
+		ret = target_alloc_sgl(&cmd->t_bidi_data_sg,
+				       &cmd->t_bidi_data_nents,
+				       caw_length, zero_flag);
+		if (ret < 0)
+			return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 	/*
 	 * If this command is not a write we can execute it right here,
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 9cbe50191dd6..edfd69a25884 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -518,7 +518,7 @@ struct se_cmd {
 	sense_reason_t		(*execute_cmd)(struct se_cmd *);
 	sense_reason_t		(*execute_rw)(struct se_cmd *, struct scatterlist *,
 					      u32, enum dma_data_direction);
-	sense_reason_t (*transport_complete_callback)(struct se_cmd *);
+	sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
 
 	unsigned char		*t_task_cdb;
 	unsigned char		__t_task_cdb[TCM_MAX_COMMAND_SIZE];

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

* [PATCH 3.16.y-ckt 130/180] mm/hugetlb: use pmd_page() in follow_huge_pmd()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (128 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 129/180] target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 131/180] fs/binfmt_elf.c: fix bug in loading of PIE binaries Luis Henriques
                   ` (49 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Gerald Schaefer, Hugh Dickins, Michal Hocko, Martin Schwidefsky,
	Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Gerald Schaefer <gerald.schaefer@de.ibm.com>

commit 97534127012f0e396eddea4691f4c9b170aed74b upstream.

Commit 61f77eda9bbf ("mm/hugetlb: reduce arch dependent code around
follow_huge_*") broke follow_huge_pmd() on s390, where pmd and pte
layout differ and using pte_page() on a huge pmd will return wrong
results.  Using pmd_page() instead fixes this.

All architectures that were touched by that commit have pmd_page()
defined, so this should not break anything on other architectures.

Fixes: 61f77eda "mm/hugetlb: reduce arch dependent code around follow_huge_*"
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Michal Hocko <mhocko@suse.cz>, Andrea Arcangeli <aarcange@redhat.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.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/hugetlb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 5f217e906ff9..1e080a06e6ba 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3723,8 +3723,7 @@ retry:
 	if (!pmd_huge(*pmd))
 		goto out;
 	if (pmd_present(*pmd)) {
-		page = pte_page(*(pte_t *)pmd) +
-			((address & ~PMD_MASK) >> PAGE_SHIFT);
+		page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);
 		if (flags & FOLL_GET)
 			get_page(page);
 	} else {

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

* [PATCH 3.16.y-ckt 131/180] fs/binfmt_elf.c: fix bug in loading of PIE binaries
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (129 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 130/180] mm/hugetlb: use pmd_page() in follow_huge_pmd() Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 132/180] IB/core: disallow registering 0-sized memory region Luis Henriques
                   ` (48 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Davidson, Alexander Viro, Jiri Kosina, Kees Cook,
	Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Michael Davidson <md@google.com>

commit a87938b2e246b81b4fb713edb371a9fa3c5c3c86 upstream.

With CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE enabled, and a normal top-down
address allocation strategy, load_elf_binary() will attempt to map a PIE
binary into an address range immediately below mm->mmap_base.

Unfortunately, load_elf_ binary() does not take account of the need to
allocate sufficient space for the entire binary which means that, while
the first PT_LOAD segment is mapped below mm->mmap_base, the subsequent
PT_LOAD segment(s) end up being mapped above mm->mmap_base into the are
that is supposed to be the "gap" between the stack and the binary.

Since the size of the "gap" on x86_64 is only guaranteed to be 128MB this
means that binaries with large data segments > 128MB can end up mapping
part of their data segment over their stack resulting in corruption of the
stack (and the data segment once the binary starts to run).

Any PIE binary with a data segment > 128MB is vulnerable to this although
address randomization means that the actual gap between the stack and the
end of the binary is normally greater than 128MB.  The larger the data
segment of the binary the higher the probability of failure.

Fix this by calculating the total size of the binary in the same way as
load_elf_interp().

Signed-off-by: Michael Davidson <md@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Kees Cook <keescook@chromium.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/binfmt_elf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index c10fc70e4912..44bdf7b200c3 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -752,6 +752,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 	    i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
 		int elf_prot = 0, elf_flags;
 		unsigned long k, vaddr;
+		unsigned long total_size = 0;
 
 		if (elf_ppnt->p_type != PT_LOAD)
 			continue;
@@ -816,10 +817,16 @@ static int load_elf_binary(struct linux_binprm *bprm)
 #else
 			load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
 #endif
+			total_size = total_mapping_size(elf_phdata,
+							loc->elf_ex.e_phnum);
+			if (!total_size) {
+				error = -EINVAL;
+				goto out_free_dentry;
+			}
 		}
 
 		error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
-				elf_prot, elf_flags, 0);
+				elf_prot, elf_flags, total_size);
 		if (BAD_ADDR(error)) {
 			send_sig(SIGKILL, current, 0);
 			retval = IS_ERR((void *)error) ?

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

* [PATCH 3.16.y-ckt 132/180] IB/core: disallow registering 0-sized memory region
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (130 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 131/180] fs/binfmt_elf.c: fix bug in loading of PIE binaries Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 133/180] IB/core: don't disallow registering region starting at 0x0 Luis Henriques
                   ` (47 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shachar Raindel, Jack Morgenstein, Or Gerlitz, Yann Droneaud,
	Doug Ledford, Luis Henriques

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

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

From: Yann Droneaud <ydroneaud@opteya.com>

commit 8abaae62f3fdead8f4ce0ab46b4ab93dee39bab2 upstream.

If ib_umem_get() is called with a size equal to 0 and an
non-page aligned address, one page will be pinned and a
0-sized umem will be returned to the caller.

This should not be allowed: it's not expected for a memory
region to have a size equal to 0.

This patch adds a check to explicitly refuse to register
a 0-sized region.

Link: http://mid.gmane.org/cover.1428929103.git.ydroneaud@opteya.com
Cc: Shachar Raindel <raindel@mellanox.com>
Cc: Jack Morgenstein <jackm@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/core/umem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 0b2584dbeba0..9cc7af4bca94 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -94,6 +94,9 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	if (dmasync)
 		dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
 
+	if (!size)
+		return ERR_PTR(-EINVAL);
+
 	/*
 	 * If the combination of the addr and size requested for this memory
 	 * region causes an integer overflow, return error.

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

* [PATCH 3.16.y-ckt 133/180] IB/core: don't disallow registering region starting at 0x0
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (131 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 132/180] IB/core: disallow registering 0-sized memory region Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 134/180] target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled Luis Henriques
                   ` (46 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shachar Raindel, Jack Morgenstein, Or Gerlitz, Yann Droneaud,
	Doug Ledford, Luis Henriques

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

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

From: Yann Droneaud <ydroneaud@opteya.com>

commit 66578b0b2f69659f00b6169e6fe7377c4b100d18 upstream.

In a call to ib_umem_get(), if address is 0x0 and size is
already page aligned, check added in commit 8494057ab5e4
("IB/uverbs: Prevent integer overflow in ib_umem_get address
arithmetic") will refuse to register a memory region that
could otherwise be valid (provided vm.mmap_min_addr sysctl
and mmap_low_allowed SELinux knobs allow userspace to map
something at address 0x0).

This patch allows back such registration: ib_umem_get()
should probably don't care of the base address provided it
can be pinned with get_user_pages().

There's two possible overflows, in (addr + size) and in
PAGE_ALIGN(addr + size), this patch keep ensuring none
of them happen while allowing to pin memory at address
0x0. Anyway, the case of size equal 0 is no more (partially)
handled as 0-length memory region are disallowed by an
earlier check.

Link: http://mid.gmane.org/cover.1428929103.git.ydroneaud@opteya.com
Cc: Shachar Raindel <raindel@mellanox.com>
Cc: Jack Morgenstein <jackm@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/core/umem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 9cc7af4bca94..c9fed8f2e070 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -101,8 +101,8 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	 * 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))
+	if (((addr + size) < addr) ||
+	    PAGE_ALIGN(addr + size) < (addr + size))
 		return ERR_PTR(-EINVAL);
 
 	if (!can_do_mlock())

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

* [PATCH 3.16.y-ckt 134/180] target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (132 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 133/180] IB/core: don't disallow registering region starting at 0x0 Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 135/180] target/file: Fix SG table for prot_buf initialization Luis Henriques
                   ` (45 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Akinobu Mita, Sagi Grimberg, Martin K. Petersen,
	Christoph Hellwig, James E.J. Bottomley, Nicholas Bellinger,
	Luis Henriques

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

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

From: Akinobu Mita <akinobu.mita@gmail.com>

commit 38da0f49e8aa1649af397d53f88e163d0e60c058 upstream.

When CONFIG_DEBUG_SG=y and DIF protection support enabled, kernel
BUG()s are triggered due to the following two issues:

1) prot_sg is not initialized by sg_init_table().

When CONFIG_DEBUG_SG=y, scatterlist helpers check sg entry has a
correct magic value.

2) vmalloc'ed buffer is passed to sg_set_buf().

sg_set_buf() uses virt_to_page() to convert virtual address to struct
page, but it doesn't work with vmalloc address.  vmalloc_to_page()
should be used instead.  As prot_buf isn't usually too large, so
fix it by allocating prot_buf by kmalloc instead of vmalloc.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_file.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 6f9f0c499813..e031ea8895e5 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -273,7 +273,7 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
 		     se_dev->prot_length;
 
 	if (!is_write) {
-		fd_prot->prot_buf = vzalloc(prot_size);
+		fd_prot->prot_buf = kzalloc(prot_size, GFP_KERNEL);
 		if (!fd_prot->prot_buf) {
 			pr_err("Unable to allocate fd_prot->prot_buf\n");
 			return -ENOMEM;
@@ -285,9 +285,10 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
 					   fd_prot->prot_sg_nents, GFP_KERNEL);
 		if (!fd_prot->prot_sg) {
 			pr_err("Unable to allocate fd_prot->prot_sg\n");
-			vfree(fd_prot->prot_buf);
+			kfree(fd_prot->prot_buf);
 			return -ENOMEM;
 		}
+		sg_init_table(fd_prot->prot_sg, fd_prot->prot_sg_nents);
 		size = prot_size;
 
 		for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
@@ -317,7 +318,7 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
 
 	if (is_write || ret < 0) {
 		kfree(fd_prot->prot_sg);
-		vfree(fd_prot->prot_buf);
+		kfree(fd_prot->prot_buf);
 	}
 
 	return ret;
@@ -652,11 +653,11 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 						 0, fd_prot.prot_sg, 0);
 			if (rc) {
 				kfree(fd_prot.prot_sg);
-				vfree(fd_prot.prot_buf);
+				kfree(fd_prot.prot_buf);
 				return rc;
 			}
 			kfree(fd_prot.prot_sg);
-			vfree(fd_prot.prot_buf);
+			kfree(fd_prot.prot_buf);
 		}
 	} else {
 		memset(&fd_prot, 0, sizeof(struct fd_prot));
@@ -672,7 +673,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 						  0, fd_prot.prot_sg, 0);
 			if (rc) {
 				kfree(fd_prot.prot_sg);
-				vfree(fd_prot.prot_buf);
+				kfree(fd_prot.prot_buf);
 				return rc;
 			}
 		}
@@ -703,7 +704,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 	if (ret < 0) {
 		kfree(fd_prot.prot_sg);
-		vfree(fd_prot.prot_buf);
+		kfree(fd_prot.prot_buf);
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 

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

* [PATCH 3.16.y-ckt 135/180] target/file: Fix SG table for prot_buf initialization
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (133 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 134/180] target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 136/180] target/file: Fix UNMAP with DIF protection support Luis Henriques
                   ` (44 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Akinobu Mita, Sagi Grimberg, Martin K. Petersen,
	Christoph Hellwig, James E.J. Bottomley, Nicholas Bellinger,
	Luis Henriques

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

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

From: Akinobu Mita <akinobu.mita@gmail.com>

commit c836777830428372074d5129ac513e1472c99791 upstream.

In fd_do_prot_rw(), it allocates prot_buf which is used to copy from
se_cmd->t_prot_sg by sbc_dif_copy_prot().  The SG table for prot_buf
is also initialized by allocating 'se_cmd->t_prot_nents' entries of
scatterlist and setting the data length of each entry to PAGE_SIZE
at most.

However if se_cmd->t_prot_sg contains a clustered entry (i.e.
sg->length > PAGE_SIZE), the SG table for prot_buf can't be
initialized correctly and sbc_dif_copy_prot() can't copy to prot_buf.
(This actually happened with TCM loopback fabric module)

As prot_buf is allocated by kzalloc() and it's physically contiguous,
we only need a single scatterlist entry.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_file.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index e031ea8895e5..e05858a3c97e 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -263,11 +263,10 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
 	struct se_device *se_dev = cmd->se_dev;
 	struct fd_dev *dev = FD_DEV(se_dev);
 	struct file *prot_fd = dev->fd_prot_file;
-	struct scatterlist *sg;
 	loff_t pos = (cmd->t_task_lba * se_dev->prot_length);
 	unsigned char *buf;
-	u32 prot_size, len, size;
-	int rc, ret = 1, i;
+	u32 prot_size;
+	int rc, ret = 1;
 
 	prot_size = (cmd->data_length / se_dev->dev_attrib.block_size) *
 		     se_dev->prot_length;
@@ -280,24 +279,16 @@ static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
 		}
 		buf = fd_prot->prot_buf;
 
-		fd_prot->prot_sg_nents = cmd->t_prot_nents;
-		fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist) *
-					   fd_prot->prot_sg_nents, GFP_KERNEL);
+		fd_prot->prot_sg_nents = 1;
+		fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist),
+					   GFP_KERNEL);
 		if (!fd_prot->prot_sg) {
 			pr_err("Unable to allocate fd_prot->prot_sg\n");
 			kfree(fd_prot->prot_buf);
 			return -ENOMEM;
 		}
 		sg_init_table(fd_prot->prot_sg, fd_prot->prot_sg_nents);
-		size = prot_size;
-
-		for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
-
-			len = min_t(u32, PAGE_SIZE, size);
-			sg_set_buf(sg, buf, len);
-			size -= len;
-			buf += len;
-		}
+		sg_set_buf(fd_prot->prot_sg, buf, prot_size);
 	}
 
 	if (is_write) {

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

* [PATCH 3.16.y-ckt 136/180] target/file: Fix UNMAP with DIF protection support
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (134 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 135/180] target/file: Fix SG table for prot_buf initialization Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 137/180] ptrace: fix race between ptrace_resume() and wait_task_stopped() Luis Henriques
                   ` (43 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Akinobu Mita, Christoph Hellwig, James E.J. Bottomley,
	Nicholas Bellinger, Luis Henriques

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

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

From: Akinobu Mita <akinobu.mita@gmail.com>

commit 64d240b721b21e266ffde645ec965c3b6d1c551f upstream.

When UNMAP command is issued with DIF protection support enabled,
the protection info for the unmapped region is remain unchanged.
So READ command for the region causes data integrity failure.

This fixes it by invalidating protection info for the unmapped region
by filling with 0xff pattern.  This change also adds helper function
fd_do_prot_fill() in order to reduce code duplication with existing
fd_format_prot().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_file.c | 86 +++++++++++++++++++++++++++------------
 1 file changed, 61 insertions(+), 25 deletions(-)

diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index e05858a3c97e..4568dc549a63 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -535,6 +535,56 @@ fd_execute_write_same(struct se_cmd *cmd)
 	return 0;
 }
 
+static int
+fd_do_prot_fill(struct se_device *se_dev, sector_t lba, sector_t nolb,
+		void *buf, size_t bufsize)
+{
+	struct fd_dev *fd_dev = FD_DEV(se_dev);
+	struct file *prot_fd = fd_dev->fd_prot_file;
+	sector_t prot_length, prot;
+	loff_t pos = lba * se_dev->prot_length;
+
+	if (!prot_fd) {
+		pr_err("Unable to locate fd_dev->fd_prot_file\n");
+		return -ENODEV;
+	}
+
+	prot_length = nolb * se_dev->prot_length;
+
+	for (prot = 0; prot < prot_length;) {
+		sector_t len = min_t(sector_t, bufsize, prot_length - prot);
+		ssize_t ret = kernel_write(prot_fd, buf, len, pos + prot);
+
+		if (ret != len) {
+			pr_err("vfs_write to prot file failed: %zd\n", ret);
+			return ret < 0 ? ret : -ENODEV;
+		}
+		prot += ret;
+	}
+
+	return 0;
+}
+
+static int
+fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
+{
+	void *buf;
+	int rc;
+
+	buf = (void *)__get_free_page(GFP_KERNEL);
+	if (!buf) {
+		pr_err("Unable to allocate FILEIO prot buf\n");
+		return -ENOMEM;
+	}
+	memset(buf, 0xff, PAGE_SIZE);
+
+	rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE);
+
+	free_page((unsigned long)buf);
+
+	return rc;
+}
+
 static sense_reason_t
 fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb)
 {
@@ -542,6 +592,12 @@ fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb)
 	struct inode *inode = file->f_mapping->host;
 	int ret;
 
+	if (cmd->se_dev->dev_attrib.pi_prot_type) {
+		ret = fd_do_prot_unmap(cmd, lba, nolb);
+		if (ret)
+			return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+	}
+
 	if (S_ISBLK(inode->i_mode)) {
 		/* The backend is block device, use discard */
 		struct block_device *bdev = inode->i_bdev;
@@ -857,48 +913,28 @@ static int fd_init_prot(struct se_device *dev)
 
 static int fd_format_prot(struct se_device *dev)
 {
-	struct fd_dev *fd_dev = FD_DEV(dev);
-	struct file *prot_fd = fd_dev->fd_prot_file;
-	sector_t prot_length, prot;
 	unsigned char *buf;
-	loff_t pos = 0;
 	int unit_size = FDBD_FORMAT_UNIT_SIZE * dev->dev_attrib.block_size;
-	int rc, ret = 0, size, len;
+	int ret;
 
 	if (!dev->dev_attrib.pi_prot_type) {
 		pr_err("Unable to format_prot while pi_prot_type == 0\n");
 		return -ENODEV;
 	}
-	if (!prot_fd) {
-		pr_err("Unable to locate fd_dev->fd_prot_file\n");
-		return -ENODEV;
-	}
 
 	buf = vzalloc(unit_size);
 	if (!buf) {
 		pr_err("Unable to allocate FILEIO prot buf\n");
 		return -ENOMEM;
 	}
-	prot_length = (dev->transport->get_blocks(dev) + 1) * dev->prot_length;
-	size = prot_length;
 
 	pr_debug("Using FILEIO prot_length: %llu\n",
-		 (unsigned long long)prot_length);
+		 (unsigned long long)(dev->transport->get_blocks(dev) + 1) *
+					dev->prot_length);
 
 	memset(buf, 0xff, unit_size);
-	for (prot = 0; prot < prot_length; prot += unit_size) {
-		len = min(unit_size, size);
-		rc = kernel_write(prot_fd, buf, len, pos);
-		if (rc != len) {
-			pr_err("vfs_write to prot file failed: %d\n", rc);
-			ret = -ENODEV;
-			goto out;
-		}
-		pos += len;
-		size -= len;
-	}
-
-out:
+	ret = fd_do_prot_fill(dev, 0, dev->transport->get_blocks(dev) + 1,
+			      buf, unit_size);
 	vfree(buf);
 	return ret;
 }

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

* [PATCH 3.16.y-ckt 137/180] ptrace: fix race between ptrace_resume() and wait_task_stopped()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (135 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 136/180] target/file: Fix UNMAP with DIF protection support Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 138/180] mvsas: fix panic on expander attached SATA devices Luis Henriques
                   ` (42 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Oleg Nesterov <oleg@redhat.com>

commit b72c186999e689cb0b055ab1c7b3cd8fffbeb5ed upstream.

ptrace_resume() is called when the tracee is still __TASK_TRACED.  We set
tracee->exit_code and then wake_up_state() changes tracee->state.  If the
tracer's sub-thread does wait() in between, task_stopped_code(ptrace => T)
wrongly looks like another report from tracee.

This confuses debugger, and since wait_task_stopped() clears ->exit_code
the tracee can miss a signal.

Test-case:

	#include <stdio.h>
	#include <unistd.h>
	#include <sys/wait.h>
	#include <sys/ptrace.h>
	#include <pthread.h>
	#include <assert.h>

	int pid;

	void *waiter(void *arg)
	{
		int stat;

		for (;;) {
			assert(pid == wait(&stat));
			assert(WIFSTOPPED(stat));
			if (WSTOPSIG(stat) == SIGHUP)
				continue;

			assert(WSTOPSIG(stat) == SIGCONT);
			printf("ERR! extra/wrong report:%x\n", stat);
		}
	}

	int main(void)
	{
		pthread_t thread;

		pid = fork();
		if (!pid) {
			assert(ptrace(PTRACE_TRACEME, 0,0,0) == 0);
			for (;;)
				kill(getpid(), SIGHUP);
		}

		assert(pthread_create(&thread, NULL, waiter, NULL) == 0);

		for (;;)
			ptrace(PTRACE_CONT, pid, 0, SIGCONT);

		return 0;
	}

Note for stable: the bug is very old, but without 9899d11f6544 "ptrace:
ensure arch_ptrace/ptrace_request can never race with SIGKILL" the fix
should use lock_task_sighand(child).

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Pavel Labath <labath@google.com>
Tested-by: Pavel Labath <labath@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>
---
 kernel/ptrace.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index adf98622cb32..808e5dbcbd9f 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -720,6 +720,8 @@ static int ptrace_peek_siginfo(struct task_struct *child,
 static int ptrace_resume(struct task_struct *child, long request,
 			 unsigned long data)
 {
+	bool need_siglock;
+
 	if (!valid_signal(data))
 		return -EIO;
 
@@ -747,8 +749,26 @@ static int ptrace_resume(struct task_struct *child, long request,
 		user_disable_single_step(child);
 	}
 
+	/*
+	 * Change ->exit_code and ->state under siglock to avoid the race
+	 * with wait_task_stopped() in between; a non-zero ->exit_code will
+	 * wrongly look like another report from tracee.
+	 *
+	 * Note that we need siglock even if ->exit_code == data and/or this
+	 * status was not reported yet, the new status must not be cleared by
+	 * wait_task_stopped() after resume.
+	 *
+	 * If data == 0 we do not care if wait_task_stopped() reports the old
+	 * status and clears the code too; this can't race with the tracee, it
+	 * takes siglock after resume.
+	 */
+	need_siglock = data && !thread_group_empty(current);
+	if (need_siglock)
+		spin_lock_irq(&child->sighand->siglock);
 	child->exit_code = data;
 	wake_up_state(child, __TASK_TRACED);
+	if (need_siglock)
+		spin_unlock_irq(&child->sighand->siglock);
 
 	return 0;
 }

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

* [PATCH 3.16.y-ckt 138/180] mvsas: fix panic on expander attached SATA devices
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (136 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 137/180] ptrace: fix race between ptrace_resume() and wait_task_stopped() Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 139/180] nfsd: fix nsfd startup race triggering BUG_ON Luis Henriques
                   ` (41 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: James Bottomley, Luis Henriques

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

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

From: James Bottomley <JBottomley@Odin.com>

commit 56cbd0ccc1b508de19561211d7ab9e1c77e6b384 upstream.

mvsas is giving a General protection fault when it encounters an expander
attached ATA device.  Analysis of mvs_task_prep_ata() shows that the driver is
assuming all ATA devices are locally attached and obtaining the phy mask by
indexing the local phy table (in the HBA structure) with the phy id.  Since
expanders have many more phys than the HBA, this is causing the index into the
HBA phy table to overflow and returning rubbish as the pointer.

mvs_task_prep_ssp() instead does the phy mask using the port properties.
Mirror this in mvs_task_prep_ata() to fix the panic.

Reported-by: Adam Talbot <ajtalbot1@gmail.com>
Tested-by: Adam Talbot <ajtalbot1@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/mvsas/mv_sas.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index 6c1f223a8e1d..4c0b8b4e1d40 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -441,14 +441,11 @@ static u32 mvs_get_ncq_tag(struct sas_task *task, u32 *tag)
 static int mvs_task_prep_ata(struct mvs_info *mvi,
 			     struct mvs_task_exec_info *tei)
 {
-	struct sas_ha_struct *sha = mvi->sas;
 	struct sas_task *task = tei->task;
 	struct domain_device *dev = task->dev;
 	struct mvs_device *mvi_dev = dev->lldd_dev;
 	struct mvs_cmd_hdr *hdr = tei->hdr;
 	struct asd_sas_port *sas_port = dev->port;
-	struct sas_phy *sphy = dev->phy;
-	struct asd_sas_phy *sas_phy = sha->sas_phy[sphy->number];
 	struct mvs_slot_info *slot;
 	void *buf_prd;
 	u32 tag = tei->tag, hdr_tag;
@@ -468,7 +465,7 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
 	slot->tx = mvi->tx_prod;
 	del_q = TXQ_MODE_I | tag |
 		(TXQ_CMD_STP << TXQ_CMD_SHIFT) |
-		(MVS_PHY_ID << TXQ_PHY_SHIFT) |
+		((sas_port->phy_mask & TXQ_PHY_MASK) << TXQ_PHY_SHIFT) |
 		(mvi_dev->taskfileset << TXQ_SRS_SHIFT);
 	mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q);
 

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

* [PATCH 3.16.y-ckt 139/180] nfsd: fix nsfd startup race triggering BUG_ON
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (137 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 138/180] mvsas: fix panic on expander attached SATA devices Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 140/180] i2c: rk3x: report number of messages transmitted Luis Henriques
                   ` (40 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Giuseppe Cantavenera, Lorenzo Restelli, J. Bruce Fields, Luis Henriques

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

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

From: Giuseppe Cantavenera <giuseppe.cantavenera.ext@nokia.com>

commit bb7ffbf29e76b89a86ca4c3ee0d4690641f2f772 upstream.

nfsd triggered a BUG_ON in net_generic(...) when rpc_pipefs_event(...)
in fs/nfsd/nfs4recover.c was called before assigning ntfsd_net_id.
The following was observed on a MIPS 32-core processor:
kernel: Call Trace:
kernel: [<ffffffffc00bc5e4>] rpc_pipefs_event+0x7c/0x158 [nfsd]
kernel: [<ffffffff8017a2a0>] notifier_call_chain+0x70/0xb8
kernel: [<ffffffff8017a4e4>] __blocking_notifier_call_chain+0x4c/0x70
kernel: [<ffffffff8053aff8>] rpc_fill_super+0xf8/0x1a0
kernel: [<ffffffff8022204c>] mount_ns+0xb4/0xf0
kernel: [<ffffffff80222b48>] mount_fs+0x50/0x1f8
kernel: [<ffffffff8023dc00>] vfs_kern_mount+0x58/0xf0
kernel: [<ffffffff802404ac>] do_mount+0x27c/0xa28
kernel: [<ffffffff80240cf0>] SyS_mount+0x98/0xe8
kernel: [<ffffffff80135d24>] handle_sys64+0x44/0x68
kernel:
kernel:
        Code: 0040f809  00000000  2e020001 <00020336> 3c12c00d
                3c02801a  de100000 6442eb98  0040f809
kernel: ---[ end trace 7471374335809536 ]---

Fixed this behaviour by calling register_pernet_subsys(&nfsd_net_ops) before
registering rpc_pipefs_event(...) with the notifier chain.

Signed-off-by: Giuseppe Cantavenera <giuseppe.cantavenera.ext@nokia.com>
Signed-off-by: Lorenzo Restelli <lorenzo.restelli.ext@nokia.com>
Reviewed-by: Kinlong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nfsd/nfsctl.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 51844048937f..1f451f90f857 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1170,15 +1170,15 @@ static int __init init_nfsd(void)
 	int retval;
 	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
 
-	retval = register_cld_notifier();
-	if (retval)
-		return retval;
 	retval = register_pernet_subsys(&nfsd_net_ops);
 	if (retval < 0)
-		goto out_unregister_notifier;
-	retval = nfsd4_init_slabs();
+		return retval;
+	retval = register_cld_notifier();
 	if (retval)
 		goto out_unregister_pernet;
+	retval = nfsd4_init_slabs();
+	if (retval)
+		goto out_unregister_notifier;
 	retval = nfsd_fault_inject_init(); /* nfsd fault injection controls */
 	if (retval)
 		goto out_free_slabs;
@@ -1205,10 +1205,10 @@ out_free_stat:
 	nfsd_fault_inject_cleanup();
 out_free_slabs:
 	nfsd4_free_slabs();
-out_unregister_pernet:
-	unregister_pernet_subsys(&nfsd_net_ops);
 out_unregister_notifier:
 	unregister_cld_notifier();
+out_unregister_pernet:
+	unregister_pernet_subsys(&nfsd_net_ops);
 	return retval;
 }
 
@@ -1222,8 +1222,8 @@ static void __exit exit_nfsd(void)
 	nfsd4_free_slabs();
 	nfsd_fault_inject_cleanup();
 	unregister_filesystem(&nfsd_fs_type);
-	unregister_pernet_subsys(&nfsd_net_ops);
 	unregister_cld_notifier();
+	unregister_pernet_subsys(&nfsd_net_ops);
 }
 
 MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");

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

* [PATCH 3.16.y-ckt 140/180] i2c: rk3x: report number of messages transmitted
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (138 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 139/180] nfsd: fix nsfd startup race triggering BUG_ON Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 141/180] i2c: Mark adapter devices with pm_runtime_no_callbacks Luis Henriques
                   ` (39 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Torokhov, Wolfram Sang, Luis Henriques

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

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

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

commit c6cbfb91b878224e78408a2e15901c79de77115a upstream.

master_xfer() method should return number of i2c messages transferred,
but on Rockchip we were usually returning just 1, which caused trouble
with users that actually check number of transferred messages vs.
checking for negative error codes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/i2c/busses/i2c-rk3x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index b38b0529946a..f8e9a8b06d88 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -588,7 +588,7 @@ static int rk3x_i2c_xfer(struct i2c_adapter *adap,
 	clk_disable(i2c->clk);
 	spin_unlock_irqrestore(&i2c->lock, flags);
 
-	return ret;
+	return ret < 0 ? ret : num;
 }
 
 static u32 rk3x_i2c_func(struct i2c_adapter *adap)

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

* [PATCH 3.16.y-ckt 141/180] i2c: Mark adapter devices with pm_runtime_no_callbacks
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (139 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 140/180] i2c: rk3x: report number of messages transmitted Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 142/180] nfs: fix high load average due to callback thread sleeping Luis Henriques
                   ` (38 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Charles Keepax, Wolfram Sang, Luis Henriques

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

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

From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

commit 6ada5c1e1b077ab98fc144d7ac132b4dcc0148ec upstream.

Commit 523c5b89640e ("i2c: Remove support for legacy PM") removed the PM
ops from the bus type, which causes the pm operations on the s3c2410
adapter device to fail (-ENOSUPP in rpm_callback). The adapter device
doesn't get bound to a driver and as such can't have its own pm_runtime
callbacks. Previously this was fine as the bus callbacks would have been
used, but now this can cause devices which use PM runtime and are
attached over I2C to fail to resume.

This commit fixes this issue by marking all adapter devices with
pm_runtime_no_callbacks, since they can't have any.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Beata Michalska <b.michalska@samsung.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Fixes: 523c5b89640e
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/i2c/i2c-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 7c7f4b856bad..4c349b119642 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1249,6 +1249,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 
 	dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
 
+	pm_runtime_no_callbacks(&adap->dev);
+
 #ifdef CONFIG_I2C_COMPAT
 	res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev,
 				       adap->dev.parent);

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

* [PATCH 3.16.y-ckt 142/180] nfs: fix high load average due to callback thread sleeping
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (140 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 141/180] i2c: Mark adapter devices with pm_runtime_no_callbacks Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 143/180] drm/i915: cope with large i2c transfers Luis Henriques
                   ` (37 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jeff Layton, Trond Myklebust, Luis Henriques

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

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

From: Jeff Layton <jlayton@poochiereds.net>

commit 5d05e54af3cdbb13cf19c557ff2184781b91a22c upstream.

Chuck pointed out a problem that crept in with commit 6ffa30d3f734 (nfs:
don't call blocking operations while !TASK_RUNNING). Linux counts tasks
in uninterruptible sleep against the load average, so this caused the
system's load average to be pinned at at least 1 when there was a
NFSv4.1+ mount active.

Not a huge problem, but it's probably worth fixing before we get too
many complaints about it. This patch converts the code back to use
TASK_INTERRUPTIBLE sleep, simply has it flush any signals on each loop
iteration. In practice no one should really be signalling this thread at
all, so I think this is reasonably safe.

With this change, there's also no need to game the hung task watchdog so
we can also convert the schedule_timeout call back to a normal schedule.

Reported-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Fixes: commit 6ffa30d3f734 (“nfs: don't call blocking . . .”)
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nfs/callback.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 0a2016bd6e58..8c849947d34f 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -128,7 +128,7 @@ nfs41_callback_svc(void *vrqstp)
 		if (try_to_freeze())
 			continue;
 
-		prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
 		spin_lock_bh(&serv->sv_cb_lock);
 		if (!list_empty(&serv->sv_cb_list)) {
 			req = list_first_entry(&serv->sv_cb_list,
@@ -142,10 +142,10 @@ nfs41_callback_svc(void *vrqstp)
 				error);
 		} else {
 			spin_unlock_bh(&serv->sv_cb_lock);
-			/* schedule_timeout to game the hung task watchdog */
-			schedule_timeout(60 * HZ);
+			schedule();
 			finish_wait(&serv->sv_cb_waitq, &wq);
 		}
+		flush_signals(current);
 	}
 	return 0;
 }

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

* [PATCH 3.16.y-ckt 143/180] drm/i915: cope with large i2c transfers
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (141 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 142/180] nfs: fix high load average due to callback thread sleeping Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 144/180] drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg Luis Henriques
                   ` (36 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Torokhov, Jani Nikula, Luis Henriques

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

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

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

commit 9535c4757b881e06fae72a857485ad57c422b8d2 upstream.

The hardware, according to the specs, is limited to 256 byte transfers,
and current driver has no protections in case users attempt to do larger
transfers. The code will just stomp over status register and mayhem
ensues.

Let's split larger transfers into digestable chunks. Doing this allows
Atmel MXT driver on Pixel 1 function properly (it hasn't since commit
9d8dc3e529a19e427fd379118acd132520935c5d "Input: atmel_mxt_ts -
implement T44 message handling" which tries to consume multiple
touchscreen/touchpad reports in a single transaction).

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_reg.h  |  1 +
 drivers/gpu/drm/i915/intel_i2c.c | 66 ++++++++++++++++++++++++++++++++++------
 2 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 37dacd14c208..dda970cb01c1 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1551,6 +1551,7 @@ enum punit_power_well {
 #define   GMBUS_CYCLE_INDEX	(2<<25)
 #define   GMBUS_CYCLE_STOP	(4<<25)
 #define   GMBUS_BYTE_COUNT_SHIFT 16
+#define   GMBUS_BYTE_COUNT_MAX   256U
 #define   GMBUS_SLAVE_INDEX_SHIFT 8
 #define   GMBUS_SLAVE_ADDR_SHIFT 1
 #define   GMBUS_SLAVE_READ	(1<<0)
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index d33b61d0dd33..1d02970ed395 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -324,18 +324,17 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv)
 }
 
 static int
-gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
-		u32 gmbus1_index)
+gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv,
+		      unsigned short addr, u8 *buf, unsigned int len,
+		      u32 gmbus1_index)
 {
 	int reg_offset = dev_priv->gpio_mmio_base;
-	u16 len = msg->len;
-	u8 *buf = msg->buf;
 
 	I915_WRITE(GMBUS1 + reg_offset,
 		   gmbus1_index |
 		   GMBUS_CYCLE_WAIT |
 		   (len << GMBUS_BYTE_COUNT_SHIFT) |
-		   (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) |
+		   (addr << GMBUS_SLAVE_ADDR_SHIFT) |
 		   GMBUS_SLAVE_READ | GMBUS_SW_RDY);
 	while (len) {
 		int ret;
@@ -357,11 +356,35 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
 }
 
 static int
-gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
+gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg,
+		u32 gmbus1_index)
 {
-	int reg_offset = dev_priv->gpio_mmio_base;
-	u16 len = msg->len;
 	u8 *buf = msg->buf;
+	unsigned int rx_size = msg->len;
+	unsigned int len;
+	int ret;
+
+	do {
+		len = min(rx_size, GMBUS_BYTE_COUNT_MAX);
+
+		ret = gmbus_xfer_read_chunk(dev_priv, msg->addr,
+					    buf, len, gmbus1_index);
+		if (ret)
+			return ret;
+
+		rx_size -= len;
+		buf += len;
+	} while (rx_size != 0);
+
+	return 0;
+}
+
+static int
+gmbus_xfer_write_chunk(struct drm_i915_private *dev_priv,
+		       unsigned short addr, u8 *buf, unsigned int len)
+{
+	int reg_offset = dev_priv->gpio_mmio_base;
+	unsigned int chunk_size = len;
 	u32 val, loop;
 
 	val = loop = 0;
@@ -373,8 +396,8 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
 	I915_WRITE(GMBUS3 + reg_offset, val);
 	I915_WRITE(GMBUS1 + reg_offset,
 		   GMBUS_CYCLE_WAIT |
-		   (msg->len << GMBUS_BYTE_COUNT_SHIFT) |
-		   (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) |
+		   (chunk_size << GMBUS_BYTE_COUNT_SHIFT) |
+		   (addr << GMBUS_SLAVE_ADDR_SHIFT) |
 		   GMBUS_SLAVE_WRITE | GMBUS_SW_RDY);
 	while (len) {
 		int ret;
@@ -391,6 +414,29 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
 		if (ret)
 			return ret;
 	}
+
+	return 0;
+}
+
+static int
+gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg)
+{
+	u8 *buf = msg->buf;
+	unsigned int tx_size = msg->len;
+	unsigned int len;
+	int ret;
+
+	do {
+		len = min(tx_size, GMBUS_BYTE_COUNT_MAX);
+
+		ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len);
+		if (ret)
+			return ret;
+
+		buf += len;
+		tx_size -= len;
+	} while (tx_size != 0);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 144/180] drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (142 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 143/180] drm/i915: cope with large i2c transfers Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 145/180] ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline() Luis Henriques
                   ` (35 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Imre Deak, Rodrigo Vivi, Jani Nikula, Luis Henriques

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

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

From: Imre Deak <imre.deak@intel.com>

commit b5f1c97f944482e98e6e39208af356630389d1ea upstream.

Due this typo we don't save/restore the GFX_MAX_REQ_COUNT register across
suspend/resume, so fix this.

This was introduced in

commit ddeea5b0c36f3665446518c609be91f9336ef674
Author: Imre Deak <imre.deak@intel.com>
Date:   Mon May 5 15:19:56 2014 +0300

    drm/i915: vlv: add runtime PM support

I noticed this only by reading the code. To my knowledge it shouldn't
cause any real problems at the moment, since the power well backing this
register remains on across a runtime s/r. This may change once
system-wide s0ix functionality is enabled in the kernel.

v2:
- resend after a missing git add -u :/

Signed-off-by: Imre Deak <imre.deak@intel.com>
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index caef2e1774b3..17d375344f46 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1018,7 +1018,7 @@ static void vlv_save_gunit_s0ix_state(struct drm_i915_private *dev_priv)
 		s->lra_limits[i] = I915_READ(GEN7_LRA_LIMITS_BASE + i * 4);
 
 	s->media_max_req_count	= I915_READ(GEN7_MEDIA_MAX_REQ_COUNT);
-	s->gfx_max_req_count	= I915_READ(GEN7_MEDIA_MAX_REQ_COUNT);
+	s->gfx_max_req_count	= I915_READ(GEN7_GFX_MAX_REQ_COUNT);
 
 	s->render_hwsp		= I915_READ(RENDER_HWS_PGA_GEN7);
 	s->ecochk		= I915_READ(GAM_ECOCHK);
@@ -1100,7 +1100,7 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *dev_priv)
 		I915_WRITE(GEN7_LRA_LIMITS_BASE + i * 4, s->lra_limits[i]);
 
 	I915_WRITE(GEN7_MEDIA_MAX_REQ_COUNT, s->media_max_req_count);
-	I915_WRITE(GEN7_MEDIA_MAX_REQ_COUNT, s->gfx_max_req_count);
+	I915_WRITE(GEN7_GFX_MAX_REQ_COUNT, s->gfx_max_req_count);
 
 	I915_WRITE(RENDER_HWS_PGA_GEN7,	s->render_hwsp);
 	I915_WRITE(GAM_ECOCHK,		s->ecochk);

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

* [PATCH 3.16.y-ckt 145/180] ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (143 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 144/180] drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 146/180] RCU pathwalk breakage when running into a symlink overmounting something Luis Henriques
                   ` (34 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Rafael J. Wysocki, Luis Henriques

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

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

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

commit 4c533c801d1c9b5c38458a0e7516e0cf50643782 upstream.

acpi_scan_is_offline() may be called under the physical_node_lock
lock of the given device object's parent, so prevent lockdep from
complaining about that by annotating that instance with
SINGLE_DEPTH_NESTING.

Fixes: caa73ea158de (ACPI / hotplug / driver core: Handle containers in a special way)
Reported-and-tested-by: Xie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/scan.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index f002835894c1..3d0924ed0b46 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -214,7 +214,11 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
 	struct acpi_device_physical_node *pn;
 	bool offline = true;
 
-	mutex_lock(&adev->physical_node_lock);
+	/*
+	 * acpi_container_offline() calls this for all of the container's
+	 * children under the container's physical_node_lock lock.
+	 */
+	mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
 
 	list_for_each_entry(pn, &adev->physical_node_list, node)
 		if (device_supports_offline(pn->dev) && !pn->dev->offline) {

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

* [PATCH 3.16.y-ckt 146/180] RCU pathwalk breakage when running into a symlink overmounting something
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (144 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 145/180] ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline() Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 147/180] drivers/of: Add empty ranges quirk for PA-Semi Luis Henriques
                   ` (33 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Luis Henriques

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 3cab989afd8d8d1bc3d99fef0e7ed87c31e7b647 upstream.

Calling unlazy_walk() in walk_component() and do_last() when we find
a symlink that needs to be followed doesn't acquire a reference to vfsmount.
That's fine when the symlink is on the same vfsmount as the parent directory
(which is almost always the case), but it's not always true - one _can_
manage to bind a symlink on top of something.  And in such cases we end up
with excessive mntput().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/namei.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 0b79fe47502a..19ac9c89dbab 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1554,7 +1554,8 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
 
 	if (should_follow_link(path->dentry, follow)) {
 		if (nd->flags & LOOKUP_RCU) {
-			if (unlikely(unlazy_walk(nd, path->dentry))) {
+			if (unlikely(nd->path.mnt != path->mnt ||
+				     unlazy_walk(nd, path->dentry))) {
 				err = -ECHILD;
 				goto out_err;
 			}
@@ -3015,7 +3016,8 @@ finish_lookup:
 
 	if (should_follow_link(path->dentry, !symlink_ok)) {
 		if (nd->flags & LOOKUP_RCU) {
-			if (unlikely(unlazy_walk(nd, path->dentry))) {
+			if (unlikely(nd->path.mnt != path->mnt ||
+				     unlazy_walk(nd, path->dentry))) {
 				error = -ECHILD;
 				goto out;
 			}

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

* [PATCH 3.16.y-ckt 147/180] drivers/of: Add empty ranges quirk for PA-Semi
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (145 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 146/180] RCU pathwalk breakage when running into a symlink overmounting something Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 148/180] e1000: add dummy allocator to fix race condition between mtu change and netpoll Luis Henriques
                   ` (32 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Herrenschmidt, Grant Likely, Luis Henriques

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

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

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

commit a5ed1ad07b3a75894311e12fdd401bf64d0667fe upstream.

The "sdc" node is missing the ranges property, it needs to be treated
as having an empty one otherwise translation fails for its children.

Fixes 746c9e9f92dd, "of/base: Fix PowerPC address parsing hack"

Tested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/of/address.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 22ce1572af38..bab28871b992 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -403,12 +403,17 @@ static struct of_bus *of_match_bus(struct device_node *np)
 	return NULL;
 }
 
-static int of_empty_ranges_quirk(void)
+static int of_empty_ranges_quirk(struct device_node *np)
 {
 	if (IS_ENABLED(CONFIG_PPC)) {
-		/* To save cycles, we cache the result */
+		/* To save cycles, we cache the result for global "Mac" setting */
 		static int quirk_state = -1;
 
+		/* PA-SEMI sdc DT bug */
+		if (of_device_is_compatible(np, "1682m-sdc"))
+			return true;
+
+		/* Make quirk cached */
 		if (quirk_state < 0)
 			quirk_state =
 				of_machine_is_compatible("Power Macintosh") ||
@@ -443,7 +448,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
 	 * This code is only enabled on powerpc. --gcl
 	 */
 	ranges = of_get_property(parent, rprop, &rlen);
-	if (ranges == NULL && !of_empty_ranges_quirk()) {
+	if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
 		pr_err("OF: no ranges; cannot translate\n");
 		return 1;
 	}

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

* [PATCH 3.16.y-ckt 148/180] e1000: add dummy allocator to fix race condition between mtu change and netpoll
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (146 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 147/180] drivers/of: Add empty ranges quirk for PA-Semi Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 149/180] wl18xx: show rx_frames_per_rates as an array as it really is Luis Henriques
                   ` (31 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sabrina Dubroca, Jeff Kirsher, Luis Henriques

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

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

From: Sabrina Dubroca <sd@queasysnail.net>

commit 08e8331654d1d7b2c58045e549005bc356aa7810 upstream.

There is a race condition between e1000_change_mtu's cleanups and
netpoll, when we change the MTU across jumbo size:

Changing MTU frees all the rx buffers:
    e1000_change_mtu -> e1000_down -> e1000_clean_all_rx_rings ->
        e1000_clean_rx_ring

Then, close to the end of e1000_change_mtu:
    pr_info -> ... -> netpoll_poll_dev -> e1000_clean ->
        e1000_clean_rx_irq -> e1000_alloc_rx_buffers -> e1000_alloc_frag

And when we come back to do the rest of the MTU change:
    e1000_up -> e1000_configure -> e1000_configure_rx ->
        e1000_alloc_jumbo_rx_buffers

alloc_jumbo finds the buffers already != NULL, since data (shared with
page in e1000_rx_buffer->rxbuf) has been re-alloc'd, but it's garbage,
or at least not what is expected when in jumbo state.

This results in an unusable adapter (packets don't get through), and a
NULL pointer dereference on the next call to e1000_clean_rx_ring
(other mtu change, link down, shutdown):

BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<ffffffff81194d6e>] put_compound_page+0x7e/0x330

    [...]

Call Trace:
 [<ffffffff81195445>] put_page+0x55/0x60
 [<ffffffff815d9f44>] e1000_clean_rx_ring+0x134/0x200
 [<ffffffff815da055>] e1000_clean_all_rx_rings+0x45/0x60
 [<ffffffff815df5e0>] e1000_down+0x1c0/0x1d0
 [<ffffffff811e2260>] ? deactivate_slab+0x7f0/0x840
 [<ffffffff815e21bc>] e1000_change_mtu+0xdc/0x170
 [<ffffffff81647050>] dev_set_mtu+0xa0/0x140
 [<ffffffff81664218>] do_setlink+0x218/0xac0
 [<ffffffff814459e9>] ? nla_parse+0xb9/0x120
 [<ffffffff816652d0>] rtnl_newlink+0x6d0/0x890
 [<ffffffff8104f000>] ? kvm_clock_read+0x20/0x40
 [<ffffffff810a2068>] ? sched_clock_cpu+0xa8/0x100
 [<ffffffff81663802>] rtnetlink_rcv_msg+0x92/0x260

By setting the allocator to a dummy version, netpoll can't mess up our
rx buffers.  The allocator is set back to a sane value in
e1000_configure_rx.

Fixes: edbbb3ca1077 ("e1000: implement jumbo receive with partial descriptors")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/intel/e1000/e1000_main.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 660971f304b2..2a26dd187a49 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -144,6 +144,11 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
 				     struct e1000_rx_ring *rx_ring,
 				     int *work_done, int work_to_do);
+static void e1000_alloc_dummy_rx_buffers(struct e1000_adapter *adapter,
+					 struct e1000_rx_ring *rx_ring,
+					 int cleaned_count)
+{
+}
 static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
 				   struct e1000_rx_ring *rx_ring,
 				   int cleaned_count);
@@ -3525,8 +3530,11 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
 		msleep(1);
 	/* e1000_down has a dependency on max_frame_size */
 	hw->max_frame_size = max_frame;
-	if (netif_running(netdev))
+	if (netif_running(netdev)) {
+		/* prevent buffers from being reallocated */
+		adapter->alloc_rx_buf = e1000_alloc_dummy_rx_buffers;
 		e1000_down(adapter);
+	}
 
 	/* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
 	 * means we reserve 2 more, this pushes us to allocate from the next

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

* [PATCH 3.16.y-ckt 149/180] wl18xx: show rx_frames_per_rates as an array as it really is
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (147 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 148/180] e1000: add dummy allocator to fix race condition between mtu change and netpoll Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 150/180] ARM: shmobile: r8a7790: Correct SYSCIER value Luis Henriques
                   ` (30 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Iooss, Kalle Valo, Luis Henriques

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

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

From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

commit a3fa71c40f1853d0c27e8f5bc01a722a705d9682 upstream.

In struct wl18xx_acx_rx_rate_stat, rx_frames_per_rates field is an
array, not a number.  This means WL18XX_DEBUGFS_FWSTATS_FILE can't be
used to display this field in debugfs (it would display a pointer, not
the actual data).  Use WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY instead.

This bug has been found by adding a __printf attribute to
wl1271_format_buffer.  gcc complained about "format '%u' expects
argument of type 'unsigned int', but argument 5 has type 'u32 *'".

Fixes: c5d94169e818 ("wl18xx: use new fw stats structures")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/ti/wl18xx/debugfs.c | 2 +-
 drivers/net/wireless/ti/wlcore/debugfs.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c
index 7f1669cdea09..779dc2b2ca75 100644
--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
@@ -136,7 +136,7 @@ WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u");
 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u");
 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u");
 
-WL18XX_DEBUGFS_FWSTATS_FILE(rx_rate, rx_frames_per_rates, "%u");
+WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50);
 
 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_vs_rate,
 				  AGGR_STATS_TX_AGG*AGGR_STATS_TX_RATE);
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.h b/drivers/net/wireless/ti/wlcore/debugfs.h
index 0f2cfb0d2a9e..bf14676e6515 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.h
+++ b/drivers/net/wireless/ti/wlcore/debugfs.h
@@ -26,8 +26,8 @@
 
 #include "wlcore.h"
 
-int wl1271_format_buffer(char __user *userbuf, size_t count,
-			 loff_t *ppos, char *fmt, ...);
+__printf(4, 5) int wl1271_format_buffer(char __user *userbuf, size_t count,
+					loff_t *ppos, char *fmt, ...);
 
 int wl1271_debugfs_init(struct wl1271 *wl);
 void wl1271_debugfs_exit(struct wl1271 *wl);

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

* [PATCH 3.16.y-ckt 150/180] ARM: shmobile: r8a7790: Correct SYSCIER value
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (148 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 149/180] wl18xx: show rx_frames_per_rates as an array as it really is Luis Henriques
@ 2015-05-07  9:45 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 151/180] apple-gmux: lock iGP IO to protect from vgaarb changes Luis Henriques
                   ` (29 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Simon Horman, Luis Henriques

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

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

From: Simon Horman <horms+renesas@verge.net.au>

commit ee72f6adfdd95b53432eb60b6944c6fe2790dd13 upstream.

Set the SYSCIER as per the values indicated in the documentation.
The value previously used appears to been copied from the r8a7779
implementation but on closer inspection is not correct for the r8a7790.

Fixes: a48f165509c1 ("ARM: shmobile: r8a7790 SYSC setup code")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mach-shmobile/pm-r8a7790.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
index fc82839e2c2a..886b0b3b8ff5 100644
--- a/arch/arm/mach-shmobile/pm-r8a7790.c
+++ b/arch/arm/mach-shmobile/pm-r8a7790.c
@@ -26,7 +26,7 @@ static void __init r8a7790_sysc_init(void)
 	void __iomem *base = rcar_sysc_init(0xe6180000);
 
 	/* enable all interrupt sources, but do not use interrupt handler */
-	iowrite32(0x0131000e, base + SYSCIER);
+	iowrite32(0x013111ef, base + SYSCIER);
 	iowrite32(0, base + SYSCIMR);
 }
 

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

* [PATCH 3.16.y-ckt 151/180] apple-gmux: lock iGP IO to protect from vgaarb changes
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (149 preceding siblings ...)
  2015-05-07  9:45 ` [PATCH 3.16.y-ckt 150/180] ARM: shmobile: r8a7790: Correct SYSCIER value Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 152/180] lib: memzero_explicit: use barrier instead of OPTIMIZER_HIDE_VAR Luis Henriques
                   ` (28 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjorn Helgaas, Matthew Garrett, Bruno Prémont, Darren Hart,
	Luis Henriques

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

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

From: =?UTF-8?q?Bruno=20Pr=C3=A9mont?= <bonbons@linux-vserver.org>

commit 4eebd5a4e72697aac25a8a57d3f888a9d5f80370 upstream.

As GMUX depends on IO for iGP to be enabled and active, lock the IO at
vgaarb level. This should prevent GPU driver for dGPU to disable IO for
iGP while it tries to own legacy VGA IO.

This fixes usage of backlight control combined with closed nvidia
driver on some Apple dual-GPU (intel/nvidia) systems.

On those systems loading nvidia driver disables intel IO decoding,
disabling the gmux backlight controls as a side effect.
Prior to commits moving boot_vga from (optional) efifb to less optional
vgaarb this mis-behavior could be avoided by using right kernel config
(efifb enabled but vgaarb disabled).

This patch explicitly does not try to trigger vgaarb changes in order
to avoid confusing already running graphics drivers. If IO has been
mis-configured by vgaarb gmux will thus fail to probe.
It is expected to load/probe gmux prior to graphics drivers.

Fixes: ce027dac592c0ada241ce0f95ae65856828ac450 # nvidia interaction
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=86121
Reported-by: Petri Hodju <petrihodju@yahoo.com>
Tested-by: Petri Hodju <petrihodju@yahoo.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/platform/x86/apple-gmux.c | 48 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index b9429fbf1cd8..e743b03f50da 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -22,6 +22,7 @@
 #include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/vga_switcheroo.h>
+#include <linux/vgaarb.h>
 #include <acpi/video.h>
 #include <asm/io.h>
 
@@ -31,6 +32,7 @@ struct apple_gmux_data {
 	bool indexed;
 	struct mutex index_lock;
 
+	struct pci_dev *pdev;
 	struct backlight_device *bdev;
 
 	/* switcheroo data */
@@ -415,6 +417,23 @@ static int gmux_resume(struct device *dev)
 	return 0;
 }
 
+static struct pci_dev *gmux_get_io_pdev(void)
+{
+	struct pci_dev *pdev = NULL;
+
+	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev))) {
+		u16 cmd;
+
+		pci_read_config_word(pdev, PCI_COMMAND, &cmd);
+		if (!(cmd & PCI_COMMAND_IO))
+			continue;
+
+		return pdev;
+	}
+
+	return NULL;
+}
+
 static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
 {
 	struct apple_gmux_data *gmux_data;
@@ -425,6 +444,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
 	int ret = -ENXIO;
 	acpi_status status;
 	unsigned long long gpe;
+	struct pci_dev *pdev = NULL;
 
 	if (apple_gmux_data)
 		return -EBUSY;
@@ -475,7 +495,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
 			ver_minor = (version >> 16) & 0xff;
 			ver_release = (version >> 8) & 0xff;
 		} else {
-			pr_info("gmux device not present\n");
+			pr_info("gmux device not present or IO disabled\n");
 			ret = -ENODEV;
 			goto err_release;
 		}
@@ -483,6 +503,23 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
 	pr_info("Found gmux version %d.%d.%d [%s]\n", ver_major, ver_minor,
 		ver_release, (gmux_data->indexed ? "indexed" : "classic"));
 
+	/*
+	 * Apple systems with gmux are EFI based and normally don't use
+	 * VGA. In addition changing IO+MEM ownership between IGP and dGPU
+	 * disables IO/MEM used for backlight control on some systems.
+	 * Lock IO+MEM to GPU with active IO to prevent switch.
+	 */
+	pdev = gmux_get_io_pdev();
+	if (pdev && vga_tryget(pdev,
+			       VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM)) {
+		pr_err("IO+MEM vgaarb-locking for PCI:%s failed\n",
+			pci_name(pdev));
+		ret = -EBUSY;
+		goto err_release;
+	} else if (pdev)
+		pr_info("locked IO for PCI:%s\n", pci_name(pdev));
+	gmux_data->pdev = pdev;
+
 	memset(&props, 0, sizeof(props));
 	props.type = BACKLIGHT_PLATFORM;
 	props.max_brightness = gmux_read32(gmux_data, GMUX_PORT_MAX_BRIGHTNESS);
@@ -574,6 +611,10 @@ err_enable_gpe:
 err_notify:
 	backlight_device_unregister(bdev);
 err_release:
+	if (gmux_data->pdev)
+		vga_put(gmux_data->pdev,
+			VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM);
+	pci_dev_put(pdev);
 	release_region(gmux_data->iostart, gmux_data->iolen);
 err_free:
 	kfree(gmux_data);
@@ -593,6 +634,11 @@ static void gmux_remove(struct pnp_dev *pnp)
 					   &gmux_notify_handler);
 	}
 
+	if (gmux_data->pdev) {
+		vga_put(gmux_data->pdev,
+			VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM);
+		pci_dev_put(gmux_data->pdev);
+	}
 	backlight_device_unregister(gmux_data->bdev);
 
 	release_region(gmux_data->iostart, gmux_data->iolen);

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

* [PATCH 3.16.y-ckt 152/180] lib: memzero_explicit: use barrier instead of OPTIMIZER_HIDE_VAR
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (150 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 151/180] apple-gmux: lock iGP IO to protect from vgaarb changes Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 153/180] clk: qcom: fix RCG M/N counter configuration Luis Henriques
                   ` (27 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Theodore Ts'o, mancha security, Daniel Borkmann, Herbert Xu,
	Luis Henriques

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

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

From: mancha security <mancha1@zoho.com>

commit 0b053c9518292705736329a8fe20ef4686ffc8e9 upstream.

OPTIMIZER_HIDE_VAR(), as defined when using gcc, is insufficient to
ensure protection from dead store optimization.

For the random driver and crypto drivers, calls are emitted ...

  $ gdb vmlinux
  (gdb) disassemble memzero_explicit
  Dump of assembler code for function memzero_explicit:
    0xffffffff813a18b0 <+0>:	push   %rbp
    0xffffffff813a18b1 <+1>:	mov    %rsi,%rdx
    0xffffffff813a18b4 <+4>:	xor    %esi,%esi
    0xffffffff813a18b6 <+6>:	mov    %rsp,%rbp
    0xffffffff813a18b9 <+9>:	callq  0xffffffff813a7120 <memset>
    0xffffffff813a18be <+14>:	pop    %rbp
    0xffffffff813a18bf <+15>:	retq
  End of assembler dump.

  (gdb) disassemble extract_entropy
  [...]
    0xffffffff814a5009 <+313>:	mov    %r12,%rdi
    0xffffffff814a500c <+316>:	mov    $0xa,%esi
    0xffffffff814a5011 <+321>:	callq  0xffffffff813a18b0 <memzero_explicit>
    0xffffffff814a5016 <+326>:	mov    -0x48(%rbp),%rax
  [...]

... but in case in future we might use facilities such as LTO, then
OPTIMIZER_HIDE_VAR() is not sufficient to protect gcc from a possible
eviction of the memset(). We have to use a compiler barrier instead.

Minimal test example when we assume memzero_explicit() would *not* be
a call, but would have been *inlined* instead:

  static inline void memzero_explicit(void *s, size_t count)
  {
    memset(s, 0, count);
    <foo>
  }

  int main(void)
  {
    char buff[20];

    snprintf(buff, sizeof(buff) - 1, "test");
    printf("%s", buff);

    memzero_explicit(buff, sizeof(buff));
    return 0;
  }

With <foo> := OPTIMIZER_HIDE_VAR():

  (gdb) disassemble main
  Dump of assembler code for function main:
  [...]
   0x0000000000400464 <+36>:	callq  0x400410 <printf@plt>
   0x0000000000400469 <+41>:	xor    %eax,%eax
   0x000000000040046b <+43>:	add    $0x28,%rsp
   0x000000000040046f <+47>:	retq
  End of assembler dump.

With <foo> := barrier():

  (gdb) disassemble main
  Dump of assembler code for function main:
  [...]
   0x0000000000400464 <+36>:	callq  0x400410 <printf@plt>
   0x0000000000400469 <+41>:	movq   $0x0,(%rsp)
   0x0000000000400471 <+49>:	movq   $0x0,0x8(%rsp)
   0x000000000040047a <+58>:	movl   $0x0,0x10(%rsp)
   0x0000000000400482 <+66>:	xor    %eax,%eax
   0x0000000000400484 <+68>:	add    $0x28,%rsp
   0x0000000000400488 <+72>:	retq
  End of assembler dump.

As can be seen, movq, movq, movl are being emitted inlined
via memset().

Reference: http://thread.gmane.org/gmane.linux.kernel.cryptoapi/13764/
Fixes: d4c5efdb9777 ("random: add and use memzero_explicit() for clearing data")
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: mancha security <mancha1@zoho.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-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>
---
 lib/string.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/string.c b/lib/string.c
index 3a3120452a1d..30a2f627bc14 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -616,7 +616,7 @@ EXPORT_SYMBOL(memset);
 void memzero_explicit(void *s, size_t count)
 {
 	memset(s, 0, count);
-	OPTIMIZER_HIDE_VAR(s);
+	barrier();
 }
 EXPORT_SYMBOL(memzero_explicit);
 

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

* [PATCH 3.16.y-ckt 153/180] clk: qcom: fix RCG M/N counter configuration
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (151 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 152/180] lib: memzero_explicit: use barrier instead of OPTIMIZER_HIDE_VAR Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 154/180] arm64: head.S: ensure visibility of page tables Luis Henriques
                   ` (26 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Archit Taneja, Stephen Boyd, Luis Henriques

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

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

From: Archit Taneja <architt@codeaurora.org>

commit 0b21503dbbfa669dbd847b33578d4041513cddb2 upstream.

Currently, a RCG's M/N counter (used for fraction division) is
set to either 'bypass' (counter disabled) or 'dual edge' (counter
enabled) based on whether the corresponding rcg struct has a mnd
field specified and a non-zero N.

In the case where M and N are the same value, the M/N counter is
still enabled by code even though no division takes place.
Leaving the RCG in such a state can result in improper behavior.
This was observed with the DSI pixel clock RCG when M and N were
both set to 1.

Add an additional check (M != N) to enable the M/N counter only
when it's needed for fraction division.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Fixes: bcd61c0f535a (clk: qcom: Add support for root clock
generators (RCGs))
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clk/qcom/clk-rcg2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index cd185d5cc67a..9f5e0dfc3699 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -253,7 +253,7 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)
 	mask |= CFG_SRC_SEL_MASK | CFG_MODE_MASK;
 	cfg = f->pre_div << CFG_SRC_DIV_SHIFT;
 	cfg |= rcg->parent_map[f->src] << CFG_SRC_SEL_SHIFT;
-	if (rcg->mnd_width && f->n)
+	if (rcg->mnd_width && f->n && (f->m != f->n))
 		cfg |= CFG_MODE_DUAL_EDGE;
 	ret = regmap_update_bits(rcg->clkr.regmap,
 			rcg->cmd_rcgr + CFG_REG, mask, cfg);

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

* [PATCH 3.16.y-ckt 154/180] arm64: head.S: ensure visibility of page tables
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (152 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 153/180] clk: qcom: fix RCG M/N counter configuration Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 155/180] driver core: bus: Goto appropriate labels on failure in bus_add_device Luis Henriques
                   ` (25 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Rutland, Catalin Marinas, Will Deacon, Luis Henriques

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

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

From: Mark Rutland <mark.rutland@arm.com>

commit 91d57155dc5ab4b311624b7ee570339b6af19ad5 upstream.

After writing the page tables, we use __inval_cache_range to invalidate
any stale cache entries. Strongly Ordered memory accesses are not
ordered w.r.t. cache maintenance instructions, and hence explicit memory
barriers are required to provide this ordering. However,
__inval_cache_range was written to be used on Normal Cacheable memory
once the MMU and caches are on, and does not have any barriers prior to
the DC instructions.

This patch adds a DMB between the page tables being written and the
corresponding cachelines being invalidated, ensuring that the
invalidation makes the new data visible to subsequent cacheable
accesses. A barrier is not required before the prior invalidate as we do
not access the page table memory area prior to this, and earlier
barriers in preserve_boot_args and set_cpu_boot_mode_flag ensures
ordering w.r.t. any stores performed prior to entering Linux.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Fixes: c218bca74eeafa2f ("arm64: Relax the kernel cache requirements for boot")
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/kernel/head.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index a2c1195abb7f..1cd11e73058f 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -599,6 +599,7 @@ __create_page_tables:
 	 */
 	mov	x0, x25
 	add	x1, x26, #SWAPPER_DIR_SIZE
+	dmb	sy
 	bl	__inval_cache_range
 
 	mov	lr, x27

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

* [PATCH 3.16.y-ckt 155/180] driver core: bus: Goto appropriate labels on failure in bus_add_device
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (153 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 154/180] arm64: head.S: ensure visibility of page tables Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 156/180] C6x: time: Ensure consistency in __init Luis Henriques
                   ` (24 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Junjie Mao, Greg Kroah-Hartman, Luis Henriques

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

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

From: Junjie Mao <junjie_mao@yeah.net>

commit 1c34203a1496d1849ba978021b878b3447d433c8 upstream.

It is not necessary to call device_remove_groups() when device_add_groups()
fails.

The group added by device_add_groups() should be removed if sysfs_create_link()
fails.

Fixes: fa6fdb33b486 ("driver core: bus_type: add dev_groups")
Signed-off-by: Junjie Mao <junjie_mao@yeah.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/base/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 876bae5ade33..79bc203f51ef 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -515,11 +515,11 @@ int bus_add_device(struct device *dev)
 			goto out_put;
 		error = device_add_groups(dev, bus->dev_groups);
 		if (error)
-			goto out_groups;
+			goto out_id;
 		error = sysfs_create_link(&bus->p->devices_kset->kobj,
 						&dev->kobj, dev_name(dev));
 		if (error)
-			goto out_id;
+			goto out_groups;
 		error = sysfs_create_link(&dev->kobj,
 				&dev->bus->p->subsys.kobj, "subsystem");
 		if (error)

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

* [PATCH 3.16.y-ckt 156/180] C6x: time: Ensure consistency in __init
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (154 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 155/180] driver core: bus: Goto appropriate labels on failure in bus_add_device Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 157/180] xprtrdma: Prevent infinite loop in rpcrdma_ep_create() Luis Henriques
                   ` (23 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nishanth Menon, Mark Salter, Luis Henriques

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

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

From: Nishanth Menon <nm@ti.com>

commit f4831605f2dacd12730fe73961c77253cc2ea425 upstream.

time_init invokes timer64_init (which is __init annotation)
since all of these are invoked at init time, lets maintain
consistency by ensuring time_init is marked appropriately
as well.

This fixes the following warning with CONFIG_DEBUG_SECTION_MISMATCH=y

WARNING: vmlinux.o(.text+0x3bfc): Section mismatch in reference from the function time_init() to the function .init.text:timer64_init()
The function time_init() references
the function __init timer64_init().
This is often because time_init lacks a __init
annotation or the annotation of timer64_init is wrong.

Fixes: 546a39546c64 ("C6X: time management")
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/c6x/kernel/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/c6x/kernel/time.c b/arch/c6x/kernel/time.c
index 356ee84cad95..04845aaf5985 100644
--- a/arch/c6x/kernel/time.c
+++ b/arch/c6x/kernel/time.c
@@ -49,7 +49,7 @@ u64 sched_clock(void)
 	return (tsc * sched_clock_multiplier) >> SCHED_CLOCK_SHIFT;
 }
 
-void time_init(void)
+void __init time_init(void)
 {
 	u64 tmp = (u64)NSEC_PER_SEC << SCHED_CLOCK_SHIFT;
 

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

* [PATCH 3.16.y-ckt 157/180] xprtrdma: Prevent infinite loop in rpcrdma_ep_create()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (155 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 156/180] C6x: time: Ensure consistency in __init Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 158/180] crypto: omap-aes - Fix support for unequal lengths Luis Henriques
                   ` (22 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chuck Lever, Anna Schumaker, Luis Henriques

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

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

From: Chuck Lever <chuck.lever@oracle.com>

commit 41f97028969e4c88efa5fcf58bc6125210413a6d upstream.

If a provider advertizes a zero max_fast_reg_page_list_len, FRWR
depth detection loops forever. Instead of just failing the mount,
try other memory registration modes.

Fixes: 0fc6c4e7bb28 ("xprtrdma: mind the device's max fast . . .")
Reported-by: Devesh Sharma <Devesh.Sharma@Emulex.Com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Devesh Sharma <Devesh.Sharma@Emulex.Com>
Tested-by: Meghana Cheripady <Meghana.Cheripady@Emulex.Com>
Tested-by: Veeresh U. Kokatnur <veereshuk@chelsio.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
[ luis: backported to 3.16:
  - devattr struct isn't a pointer ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sunrpc/xprtrdma/verbs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 13dbd1c389ff..9ec12f834c43 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -541,9 +541,10 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
 
 	if (memreg == RPCRDMA_FRMR) {
 		/* Requires both frmr reg and local dma lkey */
-		if ((devattr.device_cap_flags &
+		if (((devattr.device_cap_flags &
 		     (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) !=
-		    (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) {
+		    (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) ||
+		      (devattr.max_fast_reg_page_list_len == 0)) {
 			dprintk("RPC:       %s: FRMR registration "
 				"not supported by HCA\n", __func__);
 			memreg = RPCRDMA_MTHCAFMR;

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

* [PATCH 3.16.y-ckt 158/180] crypto: omap-aes - Fix support for unequal lengths
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (156 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 157/180] xprtrdma: Prevent infinite loop in rpcrdma_ep_create() Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 159/180] ARM: fix broken hibernation Luis Henriques
                   ` (21 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lokesh Vutla, Herbert Xu, Luis Henriques

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

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

From: "Vutla, Lokesh" <lokeshvutla@ti.com>

commit 6d7e7e02a044025237b6f62a20521170b794537f upstream.

For cases where total length of an input SGs is not same as
length of the input data for encryption, omap-aes driver
crashes. This happens in the case when IPsec is trying to use
omap-aes driver.

To avoid this, we copy all the pages from the input SG list
into a contiguous buffer and prepare a single element SG list
for this buffer with length as the total bytes to crypt, which is
similar thing that is done in case of unaligned lengths.

Fixes: 6242332ff2f3 ("crypto: omap-aes - Add support for cases of unaligned lengths")
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/crypto/omap-aes.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index cb98fa54573d..f7826ee3754b 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -554,15 +554,23 @@ static int omap_aes_crypt_dma_stop(struct omap_aes_dev *dd)
 	return err;
 }
 
-static int omap_aes_check_aligned(struct scatterlist *sg)
+static int omap_aes_check_aligned(struct scatterlist *sg, int total)
 {
+	int len = 0;
+
 	while (sg) {
 		if (!IS_ALIGNED(sg->offset, 4))
 			return -1;
 		if (!IS_ALIGNED(sg->length, AES_BLOCK_SIZE))
 			return -1;
+
+		len += sg->length;
 		sg = sg_next(sg);
 	}
+
+	if (len != total)
+		return -1;
+
 	return 0;
 }
 
@@ -633,8 +641,8 @@ static int omap_aes_handle_queue(struct omap_aes_dev *dd,
 	dd->in_sg = req->src;
 	dd->out_sg = req->dst;
 
-	if (omap_aes_check_aligned(dd->in_sg) ||
-	    omap_aes_check_aligned(dd->out_sg)) {
+	if (omap_aes_check_aligned(dd->in_sg, dd->total) ||
+	    omap_aes_check_aligned(dd->out_sg, dd->total)) {
 		if (omap_aes_copy_sgs(dd))
 			pr_err("Failed to copy SGs for unaligned cases\n");
 		dd->sgs_copied = 1;

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

* [PATCH 3.16.y-ckt 159/180] ARM: fix broken hibernation
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (157 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 158/180] crypto: omap-aes - Fix support for unequal lengths Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 160/180] jhash: Update jhash_[321]words functions to use correct initval Luis Henriques
                   ` (20 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Russell King, Luis Henriques

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

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

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit 767bf7e7a1e82a81c59778348d156993d0a6175d upstream.

Normally, when a CPU wants to clear a cache line to zero in the external
L2 cache, it would generate bus cycles to write each word as it would do
with any other data access.

However, a Cortex A9 connected to a L2C-310 has a specific feature where
the CPU can detect this operation, and signal that it wants to zero an
entire cache line.  This feature, known as Full Line of Zeros (FLZ),
involves a non-standard AXI signalling mechanism which only the L2C-310
can properly interpret.

There are separate enable bits in both the L2C-310 and the Cortex A9 -
the L2C-310 needs to be enabled and have the FLZ enable bit set in the
auxiliary control register before the Cortex A9 has this feature
enabled.

Unfortunately, the suspend code was not respecting this - it's not
obvious from the code:

swsusp_arch_suspend()
 cpu_suspend() /* saves the Cortex A9 auxiliary control register */
  arch_save_image()
  soft_restart() /* turns off FLZ in Cortex A9, and disables L2C */
   cpu_resume() /* restores the Cortex A9 registers, inc auxcr */

At this point, we end up with the L2C disabled, but the Cortex A9 with
FLZ enabled - which means any memset() or zeroing of a full cache line
will fail to take effect.

A similar issue exists in the resume path, but it's slightly more
complex:

swsusp_arch_suspend()
 cpu_suspend() /* saves the Cortex A9 auxiliary control register */
  arch_save_image() /* image with A9 auxcr saved */
...
swsusp_arch_resume()
 call_with_stack()
  arch_restore_image() /* restores image with A9 auxcr saved above */
  soft_restart() /* turns off FLZ in Cortex A9, and disables L2C */
   cpu_resume() /* restores the Cortex A9 registers, inc auxcr */

Again, here we end up with the L2C disabled, but Cortex A9 FLZ enabled.

There's no need to turn off the L2C in either of these two paths; there
are benefits from not doing so - for example, the page copies will be
faster with the L2C enabled.

Hence, fix this by providing a variant of soft_restart() which can be
used without turning the L2 cache controller off, and use it in both
of these paths to keep the L2C enabled across the respective resume
transitions.

Fixes: 8ef418c7178f ("ARM: l2c: trial at enabling some Cortex-A9 optimisations")
Reported-by: Sean Cross <xobs@kosagi.com>
Tested-by: Sean Cross <xobs@kosagi.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/kernel/hibernate.c |  5 +++--
 arch/arm/kernel/process.c   | 10 ++++++++--
 arch/arm/kernel/reboot.h    |  6 ++++++
 3 files changed, 17 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/kernel/reboot.h

diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
index c4cc50e58c13..cfb354ff2a60 100644
--- a/arch/arm/kernel/hibernate.c
+++ b/arch/arm/kernel/hibernate.c
@@ -22,6 +22,7 @@
 #include <asm/suspend.h>
 #include <asm/memory.h>
 #include <asm/sections.h>
+#include "reboot.h"
 
 int pfn_is_nosave(unsigned long pfn)
 {
@@ -61,7 +62,7 @@ static int notrace arch_save_image(unsigned long unused)
 
 	ret = swsusp_save();
 	if (ret == 0)
-		soft_restart(virt_to_phys(cpu_resume));
+		_soft_restart(virt_to_phys(cpu_resume), false);
 	return ret;
 }
 
@@ -86,7 +87,7 @@ static void notrace arch_restore_image(void *unused)
 	for (pbe = restore_pblist; pbe; pbe = pbe->next)
 		copy_page(pbe->orig_address, pbe->address);
 
-	soft_restart(virt_to_phys(cpu_resume));
+	_soft_restart(virt_to_phys(cpu_resume), false);
 }
 
 static u64 resume_stack[PAGE_SIZE/2/sizeof(u64)] __nosavedata;
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index a35f6ebbd2c2..3f688b73dda2 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -41,6 +41,7 @@
 #include <asm/system_misc.h>
 #include <asm/mach/time.h>
 #include <asm/tls.h>
+#include "reboot.h"
 
 #ifdef CONFIG_CC_STACKPROTECTOR
 #include <linux/stackprotector.h>
@@ -95,7 +96,7 @@ static void __soft_restart(void *addr)
 	BUG();
 }
 
-void soft_restart(unsigned long addr)
+void _soft_restart(unsigned long addr, bool disable_l2)
 {
 	u64 *stack = soft_restart_stack + ARRAY_SIZE(soft_restart_stack);
 
@@ -104,7 +105,7 @@ void soft_restart(unsigned long addr)
 	local_fiq_disable();
 
 	/* Disable the L2 if we're the last man standing. */
-	if (num_online_cpus() == 1)
+	if (disable_l2)
 		outer_disable();
 
 	/* Change to the new stack and continue with the reset. */
@@ -118,6 +119,11 @@ static void null_restart(enum reboot_mode reboot_mode, const char *cmd)
 {
 }
 
+void soft_restart(unsigned long addr)
+{
+	_soft_restart(addr, num_online_cpus() == 1);
+}
+
 /*
  * Function pointers to optional machine specific functions
  */
diff --git a/arch/arm/kernel/reboot.h b/arch/arm/kernel/reboot.h
new file mode 100644
index 000000000000..c87f05816d6b
--- /dev/null
+++ b/arch/arm/kernel/reboot.h
@@ -0,0 +1,6 @@
+#ifndef REBOOT_H
+#define REBOOT_H
+
+extern void _soft_restart(unsigned long addr, bool disable_l2);
+
+#endif

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

* [PATCH 3.16.y-ckt 160/180] jhash: Update jhash_[321]words functions to use correct initval
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (158 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 159/180] ARM: fix broken hibernation Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 161/180] vti6: fix uninit when using x-netns Luis Henriques
                   ` (19 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Duyck, David S. Miller, Luis Henriques

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

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

From: Alexander Duyck <alexander.h.duyck@redhat.com>

commit 2e7056c433216f406b90a003aa0ba42e19d3bdcf upstream.

Looking over the implementation for jhash2 and comparing it to jhash_3words
I realized that the two hashes were in fact very different.  Doing a bit of
digging led me to "The new jhash implementation" in which lookup2 was
supposed to have been replaced with lookup3.

In reviewing the patch I noticed that jhash2 had originally initialized a
and b to JHASH_GOLDENRATIO and c to initval, but after the patch a, b, and
c were initialized to initval + (length << 2) + JHASH_INITVAL.  However the
changes in jhash_3words simply replaced the initialization of a and b with
JHASH_INITVAL.

This change corrects what I believe was an oversight so that a, b, and c in
jhash_3words all have the same value added consisting of initval + (length
<< 2) + JHASH_INITVAL so that jhash2 and jhash_3words will now produce the
same hash result given the same inputs.

Fixes: 60d509c823cca ("The new jhash implementation")
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/jhash.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 47cb09edec1a..348c6f47e4cc 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -145,11 +145,11 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
 }
 
 
-/* jhash_3words - hash exactly 3, 2 or 1 word(s) */
-static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
+/* __jhash_nwords - hash exactly 3, 2 or 1 word(s) */
+static inline u32 __jhash_nwords(u32 a, u32 b, u32 c, u32 initval)
 {
-	a += JHASH_INITVAL;
-	b += JHASH_INITVAL;
+	a += initval;
+	b += initval;
 	c += initval;
 
 	__jhash_final(a, b, c);
@@ -157,14 +157,19 @@ static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
 	return c;
 }
 
+static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
+{
+	return __jhash_nwords(a, b, c, initval + JHASH_INITVAL + (3 << 2));
+}
+
 static inline u32 jhash_2words(u32 a, u32 b, u32 initval)
 {
-	return jhash_3words(a, b, 0, initval);
+	return __jhash_nwords(a, b, 0, initval + JHASH_INITVAL + (2 << 2));
 }
 
 static inline u32 jhash_1word(u32 a, u32 initval)
 {
-	return jhash_3words(a, 0, 0, initval);
+	return __jhash_nwords(a, 0, 0, initval + JHASH_INITVAL + (1 << 2));
 }
 
 #endif /* _LINUX_JHASH_H */

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

* [PATCH 3.16.y-ckt 161/180] vti6: fix uninit when using x-netns
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (159 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 160/180] jhash: Update jhash_[321]words functions to use correct initval Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 162/180] powerpc/cell: Fix cell iommu after it_page_shift changes Luis Henriques
                   ` (18 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yao Xiwei, Nicolas Dichtel, Steffen Klassert, Luis Henriques

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

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

From: Yao Xiwei <xiwei.yao@6wind.com>

commit 092a29a40bab8bb4530bb3e58a0597001cdecdef upstream.

When the kernel deleted a vti6 interface, this interface was not removed from
the tunnels list. Thus, when the ip6_vti module was removed, this old interface
was found and the kernel tried to delete it again. This was leading to a kernel
panic.

Fixes: 61220ab34948 ("vti6: Enable namespace changing")
Signed-off-by: Yao Xiwei <xiwei.yao@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>
---
 net/ipv6/ip6_vti.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 7c6e6bfb1b0f..4e083dab7445 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -267,8 +267,7 @@ static struct ip6_tnl *vti6_locate(struct net *net, struct __ip6_tnl_parm *p,
 static void vti6_dev_uninit(struct net_device *dev)
 {
 	struct ip6_tnl *t = netdev_priv(dev);
-	struct net *net = dev_net(dev);
-	struct vti6_net *ip6n = net_generic(net, vti6_net_id);
+	struct vti6_net *ip6n = net_generic(t->net, vti6_net_id);
 
 	if (dev == ip6n->fb_tnl_dev)
 		RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL);

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

* [PATCH 3.16.y-ckt 162/180] powerpc/cell: Fix cell iommu after it_page_shift changes
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (160 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 161/180] vti6: fix uninit when using x-netns Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 163/180] KVM: use slowpath for cross page cached accesses Luis Henriques
                   ` (17 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Ellerman, Michael Ellerman, Luis Henriques

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

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

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

commit 7261b956b276aa97fbf60d00f1d7717d2ea6ee78 upstream.

The patch to add it_page_shift incorrectly changed the increment of
uaddr to use it_page_shift, rather then (1 << it_page_shift).

This broke booting on at least some Cell blades, as the iommu was
basically non-functional.

Fixes: 3a553170d35d ("powerpc/iommu: Add it_page_shift field to determine iommu page size")
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/platforms/cell/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 2b90ff8a93be..59ef76c5f4f4 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -197,7 +197,7 @@ static int tce_build_cell(struct iommu_table *tbl, long index, long npages,
 
 	io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
 
-	for (i = 0; i < npages; i++, uaddr += tbl->it_page_shift)
+	for (i = 0; i < npages; i++, uaddr += (1 << tbl->it_page_shift))
 		io_pte[i] = base_pte | (__pa(uaddr) & CBE_IOPTE_RPN_Mask);
 
 	mb();

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

* [PATCH 3.16.y-ckt 163/180] KVM: use slowpath for cross page cached accesses
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (161 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 162/180] powerpc/cell: Fix cell iommu after it_page_shift changes Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 164/180] powerpc: Fix missing L2 cache size in /sys/devices/system/cpu Luis Henriques
                   ` (16 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Radim Krčmář, Paolo Bonzini, Luis Henriques

3.16.7-ckt11 -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 ca3f0874723fad81d0c701b63ae3a17a408d5f25 upstream.

kvm_write_guest_cached() does not mark all written pages as dirty and
code comments in kvm_gfn_to_hva_cache_init() talk about NULL memslot
with cross page accesses.  Fix all the easy way.

The check is '<= 1' to have the same result for 'len = 0' cache anywhere
in the page.  (nr_pages_needed is 0 on page boundary.)

Fixes: 8f964525a121 ("KVM: Allow cross page reads and writes from cached translations.")
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Message-Id: <20150408121648.GA3519@potion.brq.redhat.com>
Reviewed-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 virt/kvm/kvm_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 27e140d5f073..032150ca597d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1550,8 +1550,8 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
 	ghc->generation = slots->generation;
 	ghc->len = len;
 	ghc->memslot = gfn_to_memslot(kvm, start_gfn);
-	ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail);
-	if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) {
+	ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL);
+	if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) {
 		ghc->hva += offset;
 	} else {
 		/*

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

* [PATCH 3.16.y-ckt 164/180] powerpc: Fix missing L2 cache size in /sys/devices/system/cpu
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (162 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 163/180] KVM: use slowpath for cross page cached accesses Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 165/180] i2c: core: Export bus recovery functions Luis Henriques
                   ` (15 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dave Olson, Michael Ellerman, Luis Henriques

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

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

From: Dave Olson <olson@cumulusnetworks.com>

commit f7e9e358362557c3aa2c1ec47490f29fe880a09e upstream.

This problem appears to have been introduced in 2.6.29 by commit
93197a36a9c1 "Rewrite sysfs processor cache info code".

This caused lscpu to error out on at least e500v2 devices, eg:

  error: cannot open /sys/devices/system/cpu/cpu0/cache/index2/size: No such file or directory

Some embedded powerpc systems use cache-size in DTS for the unified L2
cache size, not d-cache-size, so we need to allow for both DTS names.
Added a new CACHE_TYPE_UNIFIED_D cache_type_info structure to handle
this.

Fixes: 93197a36a9c1 ("powerpc: Rewrite sysfs processor cache info code")
Signed-off-by: Dave Olson <olson@cumulusnetworks.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/kernel/cacheinfo.c | 44 +++++++++++++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index 40198d50b4c2..8005b79ecbcf 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -61,12 +61,22 @@ struct cache_type_info {
 };
 
 /* These are used to index the cache_type_info array. */
-#define CACHE_TYPE_UNIFIED     0
-#define CACHE_TYPE_INSTRUCTION 1
-#define CACHE_TYPE_DATA        2
+#define CACHE_TYPE_UNIFIED     0 /* cache-size, cache-block-size, etc. */
+#define CACHE_TYPE_UNIFIED_D   1 /* d-cache-size, d-cache-block-size, etc */
+#define CACHE_TYPE_INSTRUCTION 2
+#define CACHE_TYPE_DATA        3
 
 static const struct cache_type_info cache_type_info[] = {
 	{
+		/* Embedded systems that use cache-size, cache-block-size,
+		 * etc. for the Unified (typically L2) cache. */
+		.name            = "Unified",
+		.size_prop       = "cache-size",
+		.line_size_props = { "cache-line-size",
+				     "cache-block-size", },
+		.nr_sets_prop    = "cache-sets",
+	},
+	{
 		/* PowerPC Processor binding says the [di]-cache-*
 		 * must be equal on unified caches, so just use
 		 * d-cache properties. */
@@ -293,7 +303,8 @@ static struct cache *cache_find_first_sibling(struct cache *cache)
 {
 	struct cache *iter;
 
-	if (cache->type == CACHE_TYPE_UNIFIED)
+	if (cache->type == CACHE_TYPE_UNIFIED ||
+	    cache->type == CACHE_TYPE_UNIFIED_D)
 		return cache;
 
 	list_for_each_entry(iter, &cache_list, list)
@@ -324,16 +335,29 @@ static bool cache_node_is_unified(const struct device_node *np)
 	return of_get_property(np, "cache-unified", NULL);
 }
 
-static struct cache *cache_do_one_devnode_unified(struct device_node *node,
-						  int level)
+/*
+ * Unified caches can have two different sets of tags.  Most embedded
+ * use cache-size, etc. for the unified cache size, but open firmware systems
+ * use d-cache-size, etc.   Check on initialization for which type we have, and
+ * return the appropriate structure type.  Assume it's embedded if it isn't
+ * open firmware.  If it's yet a 3rd type, then there will be missing entries
+ * in /sys/devices/system/cpu/cpu0/cache/index2/, and this code will need
+ * to be extended further.
+ */
+static int cache_is_unified_d(const struct device_node *np)
 {
-	struct cache *cache;
+	return of_get_property(np,
+		cache_type_info[CACHE_TYPE_UNIFIED_D].size_prop, NULL) ?
+		CACHE_TYPE_UNIFIED_D : CACHE_TYPE_UNIFIED;
+}
 
+/*
+ */
+static struct cache *cache_do_one_devnode_unified(struct device_node *node, int level)
+{
 	pr_debug("creating L%d ucache for %s\n", level, node->full_name);
 
-	cache = new_cache(CACHE_TYPE_UNIFIED, level, node);
-
-	return cache;
+	return new_cache(cache_is_unified_d(node), level, node);
 }
 
 static struct cache *cache_do_one_devnode_split(struct device_node *node,

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

* [PATCH 3.16.y-ckt 165/180] i2c: core: Export bus recovery functions
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (163 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 164/180] powerpc: Fix missing L2 cache size in /sys/devices/system/cpu Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 166/180] IB/mlx4: Fix WQE LSO segment calculation Luis Henriques
                   ` (14 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Brown, Wolfram Sang, Luis Henriques

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

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

From: Mark Brown <broonie@kernel.org>

commit c1c21f4e60ed4523292f1a89ff45a208bddd3849 upstream.

Current -next fails to link an ARM allmodconfig because drivers that use
the core recovery functions can be built as modules but those functions
are not exported:

ERROR: "i2c_generic_gpio_recovery" [drivers/i2c/busses/i2c-davinci.ko] undefined!
ERROR: "i2c_generic_scl_recovery" [drivers/i2c/busses/i2c-davinci.ko] undefined!
ERROR: "i2c_recover_bus" [drivers/i2c/busses/i2c-davinci.ko] undefined!

Add exports to fix this.

Fixes: 5f9296ba21b3c (i2c: Add bus recovery infrastructure)
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/i2c/i2c-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4c349b119642..4d835fbeba44 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -232,6 +232,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap)
 	adap->bus_recovery_info->set_scl(adap, 1);
 	return i2c_generic_recovery(adap);
 }
+EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);
 
 int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
 {
@@ -246,6 +247,7 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(i2c_generic_gpio_recovery);
 
 int i2c_recover_bus(struct i2c_adapter *adap)
 {
@@ -255,6 +257,7 @@ int i2c_recover_bus(struct i2c_adapter *adap)
 	dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
 	return adap->bus_recovery_info->recover_bus(adap);
 }
+EXPORT_SYMBOL_GPL(i2c_recover_bus);
 
 static int i2c_device_probe(struct device *dev)
 {

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

* [PATCH 3.16.y-ckt 166/180] IB/mlx4: Fix WQE LSO segment calculation
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (164 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 165/180] i2c: core: Export bus recovery functions Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 167/180] IB/iser: Fix wrong calculation of protection buffer length Luis Henriques
                   ` (13 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Erez Shitrit, Or Gerlitz, Doug Ledford, Luis Henriques

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

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

From: Erez Shitrit <erezsh@mellanox.com>

commit ca9b590caa17bcbbea119594992666e96cde9c2f upstream.

The current code decreases from the mss size (which is the gso_size
from the kernel skb) the size of the packet headers.

It shouldn't do that because the mss that comes from the stack
(e.g IPoIB) includes only the tcp payload without the headers.

The result is indication to the HW that each packet that the HW sends
is smaller than what it could be, and too many packets will be sent
for big messages.

An easy way to demonstrate one more aspect of the problem is by
configuring the ipoib mtu to be less than 2*hlen (2*56) and then
run app sending big TCP messages. This will tell the HW to send packets
with giant (negative value which under unsigned arithmetics becomes
a huge positive one) length and the QP moves to SQE state.

Fixes: b832be1e4007 ('IB/mlx4: Add IPoIB LSO support')
Reported-by: Matthew Finlay <matt@mellanox.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/hw/mlx4/qp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 67780452f0cf..6914462e4b5b 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -2535,8 +2535,7 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_send_wr *wr,
 
 	memcpy(wqe->header, wr->wr.ud.header, wr->wr.ud.hlen);
 
-	*lso_hdr_sz  = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 |
-				   wr->wr.ud.hlen);
+	*lso_hdr_sz  = cpu_to_be32(wr->wr.ud.mss << 16 | wr->wr.ud.hlen);
 	*lso_seg_len = halign;
 	return 0;
 }

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

* [PATCH 3.16.y-ckt 167/180] IB/iser: Fix wrong calculation of protection buffer length
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (165 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 166/180] IB/mlx4: Fix WQE LSO segment calculation Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 168/180] mlx5: wrong page mask if CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for 32Bit architectures Luis Henriques
                   ` (12 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sagi Grimberg, Doug Ledford, Luis Henriques

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

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

From: Sagi Grimberg <sagig@mellanox.com>

commit a065fe6aa25ba6ba93c02dc13486131bb3c64d5f upstream.

This length miss-calculation may cause a silent data corruption
in the DIX case and cause the device to reference unmapped area.

Fixes: d77e65350f2d ('libiscsi, iser: Adjust data_length to include protection information')
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/infiniband/ulp/iser/iser_initiator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 73c4ca8d2458..5a406f979be4 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -402,8 +402,8 @@ int iser_send_command(struct iscsi_conn *conn,
 	if (scsi_prot_sg_count(sc)) {
 		prot_buf->buf  = scsi_prot_sglist(sc);
 		prot_buf->size = scsi_prot_sg_count(sc);
-		prot_buf->data_len = data_buf->data_len >>
-				     ilog2(sc->device->sector_size) * 8;
+		prot_buf->data_len = (data_buf->data_len >>
+				     ilog2(sc->device->sector_size)) * 8;
 	}
 
 	if (hdr->flags & ISCSI_FLAG_CMD_READ) {

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

* [PATCH 3.16.y-ckt 168/180] mlx5: wrong page mask if CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for 32Bit architectures
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (166 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 167/180] IB/iser: Fix wrong calculation of protection buffer length Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 169/180] skbuff: Do not scrub skb mark within the same name space Luis Henriques
                   ` (11 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Honggang Li, Doug Ledford, Luis Henriques

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

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

From: Honggang LI <honli@redhat.com>

commit 59d2d18cc4e9ba30b370db18d0e02d792699da96 upstream.

If CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for x86 systems and physical
memory is more than 4GB, dma_map_page may return a valid memory
address which greater than 0xffffffff. As a result, the mlx5 device page
allocator RB tree will be initialized with valid addresses greater than
0xfffffff.

However, (addr & PAGE_MASK) set the high four bytes to zeros. So, it's
impossible for the function, free_4k, to release the pages whose
addresses greater than 4GB. Memory leaks. And mlx5_ib module can't
release the pages when user try to remove the module, as a result,
system hang.

[root@rdma05 root]# dmesg  | grep addr | head
addr             = 3fe384000
addr & PAGE_MASK =  fe384000
[root@rdma05 root]# rmmod mlx5_ib   <---- hang on

---------------------- cosnole log -----------------
mlx5_ib 0000:04:00.0: irq 138 for MSI/MSI-X
  alloc irq_desc for 139 on node -1
  alloc kstat_irqs on node -1
mlx5_ib 0000:04:00.0: irq 139 for MSI/MSI-X
0000:04:00.0:free_4k:221:(pid 1519): page not found
0000:04:00.0:free_4k:221:(pid 1519): page not found
0000:04:00.0:free_4k:221:(pid 1519): page not found
0000:04:00.0:free_4k:221:(pid 1519): page not found
---------------------- cosnole log -----------------

Fixes: bf0bf77f6519 ('mlx5: Support communicating arbitrary host page size to firmware')
Signed-off-by: Honggang Li <honli@redhat.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index c2a953ef0e67..7bd9582303e8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -211,26 +211,28 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	return 0;
 }
 
+#define MLX5_U64_4K_PAGE_MASK ((~(u64)0U) << PAGE_SHIFT)
+
 static void free_4k(struct mlx5_core_dev *dev, u64 addr)
 {
 	struct fw_page *fwp;
 	int n;
 
-	fwp = find_fw_page(dev, addr & PAGE_MASK);
+	fwp = find_fw_page(dev, addr & MLX5_U64_4K_PAGE_MASK);
 	if (!fwp) {
 		mlx5_core_warn(dev, "page not found\n");
 		return;
 	}
 
-	n = (addr & ~PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT;
+	n = (addr & ~MLX5_U64_4K_PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT;
 	fwp->free_count++;
 	set_bit(n, &fwp->bitmask);
 	if (fwp->free_count == MLX5_NUM_4K_IN_PAGE) {
 		rb_erase(&fwp->rb_node, &dev->priv.page_root);
 		if (fwp->free_count != 1)
 			list_del(&fwp->list);
-		dma_unmap_page(&dev->pdev->dev, addr & PAGE_MASK, PAGE_SIZE,
-			       DMA_BIDIRECTIONAL);
+		dma_unmap_page(&dev->pdev->dev, addr & MLX5_U64_4K_PAGE_MASK,
+			       PAGE_SIZE, DMA_BIDIRECTIONAL);
 		__free_page(fwp->page);
 		kfree(fwp);
 	} else if (fwp->free_count == 1) {

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

* [PATCH 3.16.y-ckt 169/180] skbuff: Do not scrub skb mark within the same name space
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (167 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 168/180] mlx5: wrong page mask if CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for 32Bit architectures Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 170/180] firmware/ihex2fw.c: restore missing default in switch statement Luis Henriques
                   ` (10 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Herbert Xu, David S. Miller, Luis Henriques

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

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

From: Herbert Xu <herbert@gondor.apana.org.au>

commit 213dd74aee765d4e5f3f4b9607fef0cf97faa2af upstream.

On Wed, Apr 15, 2015 at 05:41:26PM +0200, Nicolas Dichtel wrote:
> Le 15/04/2015 15:57, Herbert Xu a écrit :
> >On Wed, Apr 15, 2015 at 06:22:29PM +0800, Herbert Xu wrote:
> [snip]
> >Subject: skbuff: Do not scrub skb mark within the same name space
> >
> >The commit ea23192e8e577dfc51e0f4fc5ca113af334edff9 ("tunnels:
> Maybe add a Fixes tag?
> Fixes: ea23192e8e57 ("tunnels: harmonize cleanup done on skb on rx path")
>
> >harmonize cleanup done on skb on rx path") broke anyone trying to
> >use netfilter marking across IPv4 tunnels.  While most of the
> >fields that are cleared by skb_scrub_packet don't matter, the
> >netfilter mark must be preserved.
> >
> >This patch rearranges skb_scurb_packet to preserve the mark field.
> nit: s/scurb/scrub
>
> Else it's fine for me.

Sure.

PS I used the wrong email for James the first time around.  So
let me repeat the question here.  Should secmark be preserved
or cleared across tunnels within the same name space? In fact,
do our security models even support name spaces?

---8<---
The commit ea23192e8e577dfc51e0f4fc5ca113af334edff9 ("tunnels:
harmonize cleanup done on skb on rx path") broke anyone trying to
use netfilter marking across IPv4 tunnels.  While most of the
fields that are cleared by skb_scrub_packet don't matter, the
netfilter mark must be preserved.

This patch rearranges skb_scrub_packet to preserve the mark field.

Fixes: ea23192e8e57 ("tunnels: harmonize cleanup done on skb on rx path")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
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>
---
 net/core/skbuff.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1b89e2a52926..dc27721ece4d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3943,18 +3943,21 @@ EXPORT_SYMBOL(skb_try_coalesce);
  */
 void skb_scrub_packet(struct sk_buff *skb, bool xnet)
 {
-	if (xnet)
-		skb_orphan(skb);
 	skb->tstamp.tv64 = 0;
 	skb->pkt_type = PACKET_HOST;
 	skb->skb_iif = 0;
 	skb->ignore_df = 0;
 	skb_dst_drop(skb);
-	skb->mark = 0;
 	skb_init_secmark(skb);
 	secpath_reset(skb);
 	nf_reset(skb);
 	nf_reset_trace(skb);
+
+	if (!xnet)
+		return;
+
+	skb_orphan(skb);
+	skb->mark = 0;
 }
 EXPORT_SYMBOL_GPL(skb_scrub_packet);
 

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

* [PATCH 3.16.y-ckt 170/180] firmware/ihex2fw.c: restore missing default in switch statement
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (168 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 169/180] skbuff: Do not scrub skb mark within the same name space Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 171/180] memstick: mspro_block: add missing curly braces Luis Henriques
                   ` (9 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Iooss, Mark Brown, David Woodhouse, Andrew Morton,
	Linus Torvalds, Luis Henriques

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

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

From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

commit d43698e8abb58a6ac47d16e0f47bb55f452e4fc4 upstream.

Commit 2473238eac95 ("ihex: add support for CS:IP/EIP records") removes
the "default:" statement in the switch block, making the "return
usage();" line dead code and ihex2fw silently ignoring unknown options.
Restore this statement.

This bug was found by building with HOSTCC=clang and adding
-Wunreachable-code-return to HOSTCFLAGS.

Fixes: 2473238eac95 ("ihex: add support for CS:IP/EIP records")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: David Woodhouse <dwmw2@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>
---
 firmware/ihex2fw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/firmware/ihex2fw.c b/firmware/ihex2fw.c
index cf38e159131a..08d90e25abf0 100644
--- a/firmware/ihex2fw.c
+++ b/firmware/ihex2fw.c
@@ -86,6 +86,7 @@ int main(int argc, char **argv)
 		case 'j':
 			include_jump = 1;
 			break;
+		default:
 			return usage();
 		}
 	}

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

* [PATCH 3.16.y-ckt 171/180] memstick: mspro_block: add missing curly braces
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (169 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 170/180] firmware/ihex2fw.c: restore missing default in switch statement Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 172/180] tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in Makefile Luis Henriques
                   ` (8 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Alex Dubov, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

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

commit 13f6b191aaa11c7fd718d35a0c565f3c16bc1d99 upstream.

Using the indenting we can see the curly braces were obviously intended.
This is a static checker fix, but my guess is that we don't read enough
bytes, because we don't calculate "t_len" correctly.

Fixes: f1d82698029b ('memstick: use fully asynchronous request processing')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Alex Dubov <oakad@yahoo.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>
---
 drivers/memstick/core/mspro_block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index fc145d202c46..922a750640e8 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -758,7 +758,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)
 
 		if (error || (card->current_mrq.tpc == MSPRO_CMD_STOP)) {
 			if (msb->data_dir == READ) {
-				for (cnt = 0; cnt < msb->current_seg; cnt++)
+				for (cnt = 0; cnt < msb->current_seg; cnt++) {
 					t_len += msb->req_sg[cnt].length
 						 / msb->page_size;
 
@@ -766,6 +766,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)
 						t_len += msb->current_page - 1;
 
 					t_len *= msb->page_size;
+				}
 			}
 		} else
 			t_len = blk_rq_bytes(msb->block_req);

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

* [PATCH 3.16.y-ckt 172/180] tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in Makefile
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (170 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 171/180] memstick: mspro_block: add missing curly braces Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 173/180] cpufreq: fix a NULL pointer dereference in __cpufreq_governor() Luis Henriques
                   ` (7 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas D., Mark Asselstine, Len Brown, Luis Henriques

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

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

From: Thomas D <whissi@whissi.de>

commit f82263c6989c31ae9b94cecddffb29dcbec38710 upstream.

Since commit ee0778a30153
("tools/power: turbostat: make Makefile a bit more capable")
turbostat's Makefile is using

  [...]
  BUILD_OUTPUT    := $(PWD)
  [...]

which obviously causes trouble when building "turbostat" with

  make -C /usr/src/linux/tools/power/x86/turbostat ARCH=x86 turbostat

because GNU make does not update nor guarantee that $PWD is set.

This patch changes the Makefile to use $CURDIR instead, which GNU make
guarantees to set and update (i.e. when using "make -C ...") and also
adds support for the O= option (see "make help" in your root of your
kernel source tree for more details).

Link: https://bugs.gentoo.org/show_bug.cgi?id=533918
Fixes: ee0778a30153 ("tools/power: turbostat: make Makefile a bit more capable")
Signed-off-by: Thomas D. <whissi@whissi.de>
Cc: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 tools/power/x86/turbostat/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
index d1b3a361e526..4039854560d0 100644
--- a/tools/power/x86/turbostat/Makefile
+++ b/tools/power/x86/turbostat/Makefile
@@ -1,8 +1,12 @@
 CC		= $(CROSS_COMPILE)gcc
-BUILD_OUTPUT	:= $(PWD)
+BUILD_OUTPUT	:= $(CURDIR)
 PREFIX		:= /usr
 DESTDIR		:=
 
+ifeq ("$(origin O)", "command line")
+	BUILD_OUTPUT := $(O)
+endif
+
 turbostat : turbostat.c
 CFLAGS +=	-Wall
 CFLAGS +=	-DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"'

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

* [PATCH 3.16.y-ckt 173/180] cpufreq: fix a NULL pointer dereference in __cpufreq_governor()
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (171 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 172/180] tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in Makefile Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 174/180] Input: twl4030-pwrbutton - ensure a wakeup event is recorded Luis Henriques
                   ` (6 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ethan Zhao, Rafael J. Wysocki, Luis Henriques

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

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

From: Ethan Zhao <ethan.zhao@oracle.com>

commit cb57720bf79688d64854a0a43565aa52303c1f3f upstream.

If ACPI _PPC changed notification happens before governor was initiated
while kernel is booting, a NULL pointer dereference will be triggered:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
 IP: [<ffffffff81470453>] __cpufreq_governor+0x23/0x1e0
 PGD 0
 Oops: 0000 [#1] SMP
 ... ...
 RIP: 0010:[<ffffffff81470453>]  [<ffffffff81470453>]
 __cpufreq_governor+0x23/0x1e0
 RSP: 0018:ffff881fcfbcfbb8  EFLAGS: 00010286
 RAX: 0000000000000000 RBX: ffff881fd11b3980 RCX: ffff88407fc20000
 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff881fd11b3980
 RBP: ffff881fcfbcfbd8 R08: 0000000000000000 R09: 000000000000000f
 R10: ffffffff818068d0 R11: 0000000000000043 R12: 0000000000000004
 R13: 0000000000000000 R14: ffffffff8196cae0 R15: 0000000000000000
 FS:  0000000000000000(0000) GS:ffff881fffc00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000030 CR3: 00000000018ae000 CR4: 00000000000407f0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process kworker/0:3 (pid: 750, threadinfo ffff881fcfbce000, task
 ffff881fcf556400)
 Stack:
  ffff881fffc17d00 ffff881fcfbcfc18 ffff881fd11b3980 0000000000000000
  ffff881fcfbcfc08 ffffffff81470d08 ffff881fd11b3980 0000000000000007
  ffff881fcfbcfc18 ffff881fffc17d00 ffff881fcfbcfd28 ffffffff81472e9a
 Call Trace:
  [<ffffffff81470d08>] __cpufreq_set_policy+0x1b8/0x2e0
  [<ffffffff81472e9a>] cpufreq_update_policy+0xca/0x150
  [<ffffffff81472f20>] ? cpufreq_update_policy+0x150/0x150
  [<ffffffff81324a96>] acpi_processor_ppc_has_changed+0x71/0x7b
  [<ffffffff81320bcd>] acpi_processor_notify+0x55/0x115
  [<ffffffff812f9c29>] acpi_device_notify+0x19/0x1b
  [<ffffffff813084ca>] acpi_ev_notify_dispatch+0x41/0x5f
  [<ffffffff812f64a4>] acpi_os_execute_deferred+0x27/0x34

The root cause is a race conditon -- cpufreq core and acpi-cpufreq driver
were initiated, but cpufreq_governor wasn't and _PPC changed notification
happened, __cpufreq_governor() was called within acpi_os_execute_deferred
kernel thread context.

To fix this panic issue, add pointer checking code in __cpufreq_governor()
before pointer policy->governor is to be dereferenced.

Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/cpufreq/cpufreq.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 8afa0a96f9dd..1e1b3a894a81 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2017,6 +2017,12 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
 	/* Don't start any governor operations if we are entering suspend */
 	if (cpufreq_suspended)
 		return 0;
+	/*
+	 * Governor might not be initiated here if ACPI _PPC changed
+	 * notification happened, so check it.
+	 */
+	if (!policy->governor)
+		return -EINVAL;
 
 	if (policy->governor->max_transition_latency &&
 	    policy->cpuinfo.transition_latency >

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

* [PATCH 3.16.y-ckt 174/180] Input: twl4030-pwrbutton - ensure a wakeup event is recorded.
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (172 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 173/180] cpufreq: fix a NULL pointer dereference in __cpufreq_governor() Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 175/180] Input: elantech - fix crc_enabled for Fujitsu H730 Luis Henriques
                   ` (5 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: NeilBrown, Dmitry Torokhov, Luis Henriques

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

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

From: NeilBrown <neilb@suse.de>

commit c42bfd7f6cd26e8f712fc184460e32845d928d17 upstream.

This button is treated as a wakeup source, so we need to initialise it
correctly.

Without the device_init_wakeup() call, dev->power.wakeup will
be NULL, and pm_wakeup_event() will do nothing.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/misc/twl4030-pwrbutton.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index fb3b63b2f85c..8400a1a34d87 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -85,6 +85,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, pwr);
+	device_init_wakeup(&pdev->dev, true);
 
 	return 0;
 }

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

* [PATCH 3.16.y-ckt 175/180] Input: elantech - fix crc_enabled for Fujitsu H730
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (173 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 174/180] Input: twl4030-pwrbutton - ensure a wakeup event is recorded Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 176/180] Input: elantech - add more Fujtisu notebooks to force crc_enabled Luis Henriques
                   ` (4 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ulrik De Bie, Dmitry Torokhov, Luis Henriques

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

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

From: Ulrik De Bie <ulrik.debie-os@e2big.org>

commit 0dc1587905a50f8f61bbc29e850aa592821e4bea upstream.

The Fujitsu H730 does not work with crc_enabled = 0, even though the
crc_enabled bit in the firmware version indicated it would. When switching
this value to crc_enabled to 1, the touchpad works. This patch uses DMI to
detect H730.

Reported-by: Stefan Valouch <stefan@valouch.com>
Tested-by: Stefan Valouch <stefan@valouch.com>
Tested-by: Alfredo Gemma <alfredo.gemma@gmail.com>
Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org>
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/elantech.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 29365c60e514..687c149aa12d 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1374,6 +1374,22 @@ static int elantech_reconnect(struct psmouse *psmouse)
 }
 
 /*
+ * Some hw_version 4 models do not work with crc_disabled
+ */
+static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = {
+#if defined(CONFIG_DMI) && defined(CONFIG_X86)
+	{
+		/* Fujitsu H730 does not work with crc_enabled == 0 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
+		},
+	},
+#endif
+	{ }
+};
+
+/*
  * Some hw_version 3 models go into error state when we try to set
  * bit 3 and/or bit 1 of r10.
  */
@@ -1450,7 +1466,8 @@ static int elantech_set_properties(struct elantech_data *etd)
 	 * The signatures of v3 and v4 packets change depending on the
 	 * value of this hardware flag.
 	 */
-	etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000);
+	etd->crc_enabled = (etd->fw_version & 0x4000) == 0x4000 ||
+			   dmi_check_system(elantech_dmi_force_crc_enabled);
 
 	/* Enable real hardware resolution on hw_version 3 ? */
 	etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table);

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

* [PATCH 3.16.y-ckt 176/180] Input: elantech - add more Fujtisu notebooks to force crc_enabled
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (174 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 175/180] Input: elantech - fix crc_enabled for Fujitsu H730 Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 177/180] ext4: fix accidental flag aliasing in ext4_map_blocks flags Luis Henriques
                   ` (3 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rainer Koenig, Dmitry Torokhov, Luis Henriques

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

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

From: Rainer Koenig <Rainer.Koenig@ts.fujitsu.com>

commit 47c1ffb2b6b630894e9a16442611c056ab21c057 upstream.

Add two more Fujitsu LIFEBOOK models that also ship with the Elantech
touchpad and don't work with crc_disabled to the quirk list.

Signed-off-by: Rainer Koenig <Rainer.Koenig@ts.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/elantech.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 687c149aa12d..b865f55e4b62 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1035,6 +1035,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
  * Asus UX31               0x361f00        20, 15, 0e      clickpad
  * Asus UX32VD             0x361f02        00, 15, 0e      clickpad
  * Avatar AVIU-145A2       0x361f00        ?               clickpad
+ * Fujitsu LIFEBOOK E544   0x470f00        d0, 12, 09      2 hw buttons
+ * Fujitsu LIFEBOOK E554   0x570f01        40, 14, 0c      2 hw buttons
  * Gigabyte U2442          0x450f01        58, 17, 0c      2 hw buttons
  * Lenovo L430             0x350f02        b9, 15, 0c      2 hw buttons (*)
  * Samsung NF210           0x150b00        78, 14, 0a      2 hw buttons
@@ -1385,6 +1387,20 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"),
 		},
 	},
+	{
+		/* Fujitsu LIFEBOOK E554  does not work with crc_enabled == 0 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E554"),
+		},
+	},
+	{
+		/* Fujitsu LIFEBOOK E544  does not work with crc_enabled == 0 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"),
+		},
+	},
 #endif
 	{ }
 };

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

* [PATCH 3.16.y-ckt 177/180] ext4: fix accidental flag aliasing in ext4_map_blocks flags
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (175 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 176/180] Input: elantech - add more Fujtisu notebooks to force crc_enabled Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 178/180] ext4: fix ZERO_RANGE bug hidden by flag aliasing Luis Henriques
                   ` (2 subsequent siblings)
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Theodore Ts'o, Moritz Muehlenhoff, Luis Henriques

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

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

From: Theodore Ts'o <tytso@mit.edu>

commit bd30d702fc320085f178d22866b32fdc4736c991 upstream.

Commit b8a8684502a0f introduced an accidental flag aliasing between
EXT4_EX_NOCACHE and EXT4_GET_BLOCKS_CONVERT_UNWRITTEN.

Fortunately, this didn't introduce any untorward side effects --- we
got lucky.  Nevertheless, fix this and leave a warning to hopefully
avoid this from happening in the future.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Moritz Muehlenhoff <jmm@debian.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/ext4.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 20889da7f8a0..e00dc9772402 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -569,6 +569,7 @@ enum {
 #define EXT4_GET_BLOCKS_NO_PUT_HOLE		0x0200
 	/* Convert written extents to unwritten */
 #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN	0x0400
+/* DO NOT ASSIGN ADDITIONAL FLAG VALUES WITHOUT ADJUSTING THE FLAGS BELOW */
 
 /*
  * The bit position of these flags must not overlap with any of the
@@ -579,8 +580,8 @@ enum {
  * caching the extents when reading from the extent tree while a
  * truncate or punch hole operation is in progress.
  */
-#define EXT4_EX_NOCACHE				0x0400
-#define EXT4_EX_FORCE_CACHE			0x0800
+#define EXT4_EX_NOCACHE				0x0800
+#define EXT4_EX_FORCE_CACHE			0x1000
 
 /*
  * Flags used by ext4_free_blocks

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

* [PATCH 3.16.y-ckt 178/180] ext4: fix ZERO_RANGE bug hidden by flag aliasing
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (176 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 177/180] ext4: fix accidental flag aliasing in ext4_map_blocks flags Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 179/180] ext4: allocate entire range in zero range Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 180/180] ipv4: Missing sk_nulls_node_init() in ping_unhash() Luis Henriques
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Theodore Ts'o, Namjae Jeon, Moritz Muehlenhoff, Luis Henriques

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

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

From: Theodore Ts'o <tytso@mit.edu>

commit 713e8dde3e71e92db2d8cc8459d236ce1fb576ce upstream.

We accidently aliased EXT4_EX_NOCACHE and EXT4_GET_CONVERT_UNWRITTEN
falgs, which apparently was hiding a bug that was unmasked when this
flag aliasing issue was addressed (see the subsequent commit).  The
reproduction case was:

   fsx -N 10000 -l 500000 -r 4096 -t 4096 -w 4096 -Z -R -W /vdb/junk

... which would cause fsx to report corruption in the data file.

The fix we have is a bit of an overkill, but I'd much rather be
conservative for now, and we can optimize ZERO_RANGE_FL handling
later.  The fact that we need to zap the extent_status cache for the
inode is unfortunate, but correctness is far more important than
performance.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Namjae Jeon <namjae.jeon@samsung.com>
Cc: Moritz Muehlenhoff <jmm@debian.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/extents.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 467661264ad0..2a4b4f3b1ae2 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4796,7 +4796,8 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 		max_blocks -= lblk;
 
 	flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
-		EXT4_GET_BLOCKS_CONVERT_UNWRITTEN;
+		EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
+		EXT4_EX_NOCACHE;
 	if (mode & FALLOC_FL_KEEP_SIZE)
 		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
 
@@ -4834,15 +4835,21 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 		ext4_inode_block_unlocked_dio(inode);
 		inode_dio_wait(inode);
 
+		ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
+					     flags, mode);
+		if (ret)
+			goto out_dio;
 		/*
 		 * Remove entire range from the extent status tree.
+		 *
+		 * ext4_es_remove_extent(inode, lblk, max_blocks) is
+		 * NOT sufficient.  I'm not sure why this is the case,
+		 * but let's be conservative and remove the extent
+		 * status tree for the entire inode.  There should be
+		 * no outstanding delalloc extents thanks to the
+		 * filemap_write_and_wait_range() call above.
 		 */
-		ret = ext4_es_remove_extent(inode, lblk, max_blocks);
-		if (ret)
-			goto out_dio;
-
-		ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
-					     flags, mode);
+		ret = ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);
 		if (ret)
 			goto out_dio;
 	}

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

* [PATCH 3.16.y-ckt 179/180] ext4: allocate entire range in zero range
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (177 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 178/180] ext4: fix ZERO_RANGE bug hidden by flag aliasing Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 180/180] ipv4: Missing sk_nulls_node_init() in ping_unhash() Luis Henriques
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lukas Czerner, Theodore Ts'o, Moritz Muehlenhoff, Luis Henriques

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

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

From: Lukas Czerner <lczerner@redhat.com>

commit 0f2af21aae11972fa924374ddcf52e88347cf5a8 upstream.

Currently there is a bug in zero range code which causes zero range
calls to only allocate block aligned portion of the range, while
ignoring the rest in some cases.

In some cases, namely if the end of the range is past i_size, we do
attempt to preallocate the last nonaligned block. However this might
cause kernel to BUG() in some carefully designed zero range requests
on setups where page size > block size.

Fix this problem by first preallocating the entire range, including
the nonaligned edges and converting the written extents to unwritten
in the next step. This approach will also give us the advantage of
having the range to be as linearly contiguous as possible.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Moritz Muehlenhoff <jmm@debian.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/extents.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 2a4b4f3b1ae2..cdfe574ba3d9 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4795,12 +4795,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 	else
 		max_blocks -= lblk;
 
-	flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
-		EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
-		EXT4_EX_NOCACHE;
-	if (mode & FALLOC_FL_KEEP_SIZE)
-		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
 	mutex_lock(&inode->i_mutex);
 
 	/*
@@ -4817,15 +4811,28 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 		ret = inode_newsize_ok(inode, new_size);
 		if (ret)
 			goto out_mutex;
-		/*
-		 * If we have a partial block after EOF we have to allocate
-		 * the entire block.
-		 */
-		if (partial_end)
-			max_blocks += 1;
 	}
 
+	flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT;
+	if (mode & FALLOC_FL_KEEP_SIZE)
+		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
+
+	/* Preallocate the range including the unaligned edges */
+	if (partial_begin || partial_end) {
+		ret = ext4_alloc_file_blocks(file,
+				round_down(offset, 1 << blkbits) >> blkbits,
+				(round_up((offset + len), 1 << blkbits) -
+				 round_down(offset, 1 << blkbits)) >> blkbits,
+				new_size, flags, mode);
+		if (ret)
+			goto out_mutex;
+
+	}
+
+	/* Zero range excluding the unaligned edges */
 	if (max_blocks > 0) {
+		flags |= (EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
+			  EXT4_EX_NOCACHE);
 
 		/* Now release the pages and zero block aligned part of pages*/
 		truncate_pagecache_range(inode, start, end - 1);

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

* [PATCH 3.16.y-ckt 180/180] ipv4: Missing sk_nulls_node_init() in ping_unhash().
  2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
                   ` (178 preceding siblings ...)
  2015-05-07  9:46 ` [PATCH 3.16.y-ckt 179/180] ext4: allocate entire range in zero range Luis Henriques
@ 2015-05-07  9:46 ` Luis Henriques
  179 siblings, 0 replies; 181+ messages in thread
From: Luis Henriques @ 2015-05-07  9:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David S. Miller, Luis Henriques

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

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

From: "David S. Miller" <davem@davemloft.net>

commit a134f083e79fb4c3d0a925691e732c56911b4326 upstream.

If we don't do that, then the poison value is left in the ->pprev
backlink.

This can cause crashes if we do a disconnect, followed by a connect().

Tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Wen Xu <hotdog3645@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ping.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 45d5bc0ad86c..30d0a64be413 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -158,6 +158,7 @@ void ping_unhash(struct sock *sk)
 	if (sk_hashed(sk)) {
 		write_lock_bh(&ping_table.lock);
 		hlist_nulls_del(&sk->sk_nulls_node);
+		sk_nulls_node_init(&sk->sk_nulls_node);
 		sock_put(sk);
 		isk->inet_num = 0;
 		isk->inet_sport = 0;

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

end of thread, other threads:[~2015-05-07 10:52 UTC | newest]

Thread overview: 181+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07  9:43 [3.16.y-ckt stable] Linux 3.16.7-ckt11 stable review Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 001/180] n_tty: Fix read buffer overwrite when no newline Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 002/180] spi: spidev: fix possible arithmetic overflow for multi-transfer message Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 003/180] arm64: vdso: fix build error when switching from LE to BE Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 004/180] uas: Do not blacklist ASM1153 disk enclosures Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 005/180] KVM: x86: Fix lost interrupt on irr_pending race Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 006/180] tcp: prevent fetching dst twice in early demux code Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 007/180] ipv6: protect skb->sk accesses from recursive dereference inside the stack Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 008/180] tcp: tcp_make_synack() should clear skb->tstamp Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 009/180] usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 010/180] usbnet: Fix tx_bytes statistic running backward in cdc_ncm Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 011/180] bonding: Bonding Overriding Configuration logic restored Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 012/180] HID: add ALWAYS_POLL quirk for a Logitech 0xc007 Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 013/180] PCI/AER: Avoid info leak in __print_tlp_header() Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 014/180] PCI: cpcihp: Add missing curly braces in cpci_configure_slot() Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 015/180] [media] sh_veu: v4l2_dev wasn't set Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 016/180] [media] media: s5p-mfc: fix mmap support for 64bit arch Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 017/180] cpufreq: Schedule work for the first-online CPU on resume Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 018/180] cpuidle: remove state_count field from struct cpuidle_device Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 019/180] cpuidle: ACPI: do not overwrite name and description of C0 Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 020/180] ioctx_alloc(): fix vma (and file) leak on failure Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 021/180] drm/i915/vlv: save/restore the power context base reg Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 022/180] drm/i915/chv: Remove Wait for a previous gfx force-off Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 023/180] drm/i915/vlv: remove wait for previous GFX clk disable request Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 024/180] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 025/180] ALSA: bebob: fix to processing in big-endian machine for sending cue Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 026/180] be2iscsi: Fix kernel panic when device initialization fails Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 027/180] Defer processing of REQ_PREEMPT requests for blocked devices Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 028/180] ALSA: hda - Fix headphone pin config for Lifebook T731 Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 029/180] ocfs2: _really_ sync the right range Luis Henriques
2015-05-07  9:43 ` [PATCH 3.16.y-ckt 030/180] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 031/180] iscsi target: fix oops when adding reject pdu Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 032/180] ext4: fix indirect punch hole corruption Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 033/180] fs: take i_mutex during prepare_binprm for set[ug]id executables Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 034/180] ip_forward: Drop frames with attached skb->sk Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 035/180] net: add skb_checksum_complete_unset Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 036/180] ppp: call skb_checksum_complete_unset in ppp_receive_frame Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 037/180] tcp: fix possible deadlock in tcp_send_fin() Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 038/180] tcp: avoid looping " Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 039/180] net: do not deplete pfmemalloc reserve Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 040/180] net: fix crash in build_skb() Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 041/180] usb: serial: silence all non-critical read errors Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 042/180] usb: gadget: composite: enable BESL support Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 043/180] rtlwifi: rtl8192cu: Add new device ID Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 044/180] rtlwifi: rtl8192cu: Add new USB ID Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 045/180] Bluetooth: ath3k: Add support Atheros AR5B195 combo Mini PCIe card Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 046/180] power_supply: twl4030_madc: Check return value of power_supply_register Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 047/180] power_supply: lp8788-charger: Fix leaked power supply on probe fail Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 048/180] ARM: dts: dove: Fix uart[23] reg property Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 049/180] xtensa: xtfpga: fix hardware lockup caused by LCD driver Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 050/180] Drivers: hv: vmbus: Fix a bug in the error path in vmbus_open() Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 051/180] xtensa: provide __NR_sync_file_range2 instead of __NR_sync_file_range Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 052/180] KVM: s390: Zero out current VMDB of STSI before including level3 data Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 053/180] KVM: s390: fix handling of write errors in the tpi handler Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 054/180] KVM: s390: reinjection of irqs can fail " Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 055/180] usb: musb: core: fix TX/RX endpoint order Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 056/180] usb: gadget: printer: enqueue printer's response for setup request Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 057/180] compal-laptop: correct invalid hwmon name Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 058/180] compal-laptop: Fix leaking hwmon device Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 059/180] compal-laptop: Check return value of power_supply_register Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 060/180] sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 061/180] drm/radeon: fix doublescan modes (v2) Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 062/180] usb: phy: Find the right match in devm_usb_phy_match Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 063/180] ASoC: pcm512x: Add 'Analogue' prefix to analogue volume controls Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 064/180] mmc: sunxi: Use devm_reset_control_get_optional() for reset control Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 065/180] x86: kvm: Revert "remove sched notifier for cross-cpu migrations" Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 066/180] tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 067/180] MIPS: Loongson-3: Add IRQF_NO_SUSPEND to Cascade irqaction Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 068/180] ring-buffer: Replace this_cpu_*() with __this_cpu_*() Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 069/180] HID: add HP OEM mouse to quirk ALWAYS_POLL Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 070/180] HID: add quirk for PIXART OEM mouse used by HP Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 071/180] ASoC: wm8741: Fix rates constraints values Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 072/180] cdc-wdm: fix endianness bug in debug statements Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 073/180] staging: panel: fix lcd type Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 074/180] UBI: account for bitflips in both the VID header and data Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 075/180] UBI: fix out of bounds write Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 076/180] UBI: initialize LEB number variable Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 077/180] UBI: fix check for "too many bytes" Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 078/180] ARM: S3C64XX: Use fixed IRQ bases to avoid conflicts on Cragganmore Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 079/180] ASoC: davinci-evm: drop un-necessary remove function Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 080/180] iscsi-target: Convert iscsi_thread_set usage to kthread.h Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 081/180] Drivers: hv: vmbus: Don't wait after requesting offers Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 082/180] Btrfs: fix log tree corruption when fs mounted with -o discard Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 083/180] btrfs: don't accept bare namespace as a valid xattr Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 084/180] MIPS: KVM: Handle MSA Disabled exceptions from guest Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 085/180] ARM: 8320/1: fix integer overflow in ELF_ET_DYN_BASE Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 086/180] MIPS: Hibernate: flush TLB entries earlier Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 087/180] ASoC: cs4271: Increase delay time after reset Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 088/180] [media] stk1160: Make sure current buffer is released Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 089/180] mnt: Improve the umount_tree flags Luis Henriques
2015-05-07  9:44 ` [PATCH 3.16.y-ckt 090/180] ext4: make fsync to sync parent dir in no-journal for real this time Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 091/180] Input: elantech - fix absolute mode setting on some ASUS laptops Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 092/180] usb: define a generic USB_RESUME_TIMEOUT macro Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 093/180] usb: host: xhci: use new USB_RESUME_TIMEOUT Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 094/180] usb: host: ehci: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 095/180] usb: host: uhci: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 096/180] usb: musb: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 097/180] usb: host: isp116x: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 098/180] usb: host: fotg210: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 099/180] usb: host: fusbh200: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 100/180] usb: host: oxu210hp: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 101/180] usb: host: r8a66597: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 102/180] usb: host: sl811: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 103/180] usb: dwc2: hcd: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 104/180] usb: isp1760: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 105/180] usb: core: hub: " Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 106/180] iser-target: Fix session hang in case of an rdma read DIF error Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 107/180] iser-target: Fix possible deadlock in RDMA_CM connection error Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 108/180] x86: vdso: fix pvclock races with task migration Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 109/180] gpio: mvebu: Fix mask/unmask managment per irq chip type Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 110/180] [media] rc: img-ir: fix error in parameters passed to irq_free() Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 111/180] scsi: storvsc: Fix a bug in copy_from_bounce_buffer() Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 112/180] md/raid0: fix bug with chunksize not a power of 2 Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 113/180] ALSA: emu10k1: don't deadlock in proc-functions Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 114/180] MIPS: asm: asm-eva: Introduce kernel load/store variants Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 115/180] MIPS: Malta: Detect and fix bad memsize values Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 116/180] clk: tegra: Register the proper number of resets Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 117/180] ALSA: hda - Add dock support for ThinkPad X250 (17aa:2226) Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 118/180] clk: at91: usb: fix at91sam9x5 recalc, round and set rate Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 119/180] xtensa: ISS: fix locking in TAP network adapter Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 120/180] nosave: consolidate __nosave_{begin,end} in <asm/sections.h> Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 121/180] s390/hibernate: fix save and restore of kernel text section Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 122/180] ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450 Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 123/180] Btrfs: fix inode eviction infinite loop after extent_same ioctl Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 124/180] Btrfs: fix inode eviction infinite loop after cloning into it Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 125/180] powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 126/180] ACPICA: Tables: Don't release ACPI_MTX_TABLES in acpi_tb_install_standard_table() Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 127/180] drm/i915: Dont enable CS_PARSER_ERROR interrupts at all Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 128/180] KVM: x86: Fix MSR_IA32_BNDCFGS in msrs_to_save Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 129/180] target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 130/180] mm/hugetlb: use pmd_page() in follow_huge_pmd() Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 131/180] fs/binfmt_elf.c: fix bug in loading of PIE binaries Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 132/180] IB/core: disallow registering 0-sized memory region Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 133/180] IB/core: don't disallow registering region starting at 0x0 Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 134/180] target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 135/180] target/file: Fix SG table for prot_buf initialization Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 136/180] target/file: Fix UNMAP with DIF protection support Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 137/180] ptrace: fix race between ptrace_resume() and wait_task_stopped() Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 138/180] mvsas: fix panic on expander attached SATA devices Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 139/180] nfsd: fix nsfd startup race triggering BUG_ON Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 140/180] i2c: rk3x: report number of messages transmitted Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 141/180] i2c: Mark adapter devices with pm_runtime_no_callbacks Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 142/180] nfs: fix high load average due to callback thread sleeping Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 143/180] drm/i915: cope with large i2c transfers Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 144/180] drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 145/180] ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline() Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 146/180] RCU pathwalk breakage when running into a symlink overmounting something Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 147/180] drivers/of: Add empty ranges quirk for PA-Semi Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 148/180] e1000: add dummy allocator to fix race condition between mtu change and netpoll Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 149/180] wl18xx: show rx_frames_per_rates as an array as it really is Luis Henriques
2015-05-07  9:45 ` [PATCH 3.16.y-ckt 150/180] ARM: shmobile: r8a7790: Correct SYSCIER value Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 151/180] apple-gmux: lock iGP IO to protect from vgaarb changes Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 152/180] lib: memzero_explicit: use barrier instead of OPTIMIZER_HIDE_VAR Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 153/180] clk: qcom: fix RCG M/N counter configuration Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 154/180] arm64: head.S: ensure visibility of page tables Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 155/180] driver core: bus: Goto appropriate labels on failure in bus_add_device Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 156/180] C6x: time: Ensure consistency in __init Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 157/180] xprtrdma: Prevent infinite loop in rpcrdma_ep_create() Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 158/180] crypto: omap-aes - Fix support for unequal lengths Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 159/180] ARM: fix broken hibernation Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 160/180] jhash: Update jhash_[321]words functions to use correct initval Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 161/180] vti6: fix uninit when using x-netns Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 162/180] powerpc/cell: Fix cell iommu after it_page_shift changes Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 163/180] KVM: use slowpath for cross page cached accesses Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 164/180] powerpc: Fix missing L2 cache size in /sys/devices/system/cpu Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 165/180] i2c: core: Export bus recovery functions Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 166/180] IB/mlx4: Fix WQE LSO segment calculation Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 167/180] IB/iser: Fix wrong calculation of protection buffer length Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 168/180] mlx5: wrong page mask if CONFIG_ARCH_DMA_ADDR_T_64BIT enabled for 32Bit architectures Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 169/180] skbuff: Do not scrub skb mark within the same name space Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 170/180] firmware/ihex2fw.c: restore missing default in switch statement Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 171/180] memstick: mspro_block: add missing curly braces Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 172/180] tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in Makefile Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 173/180] cpufreq: fix a NULL pointer dereference in __cpufreq_governor() Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 174/180] Input: twl4030-pwrbutton - ensure a wakeup event is recorded Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 175/180] Input: elantech - fix crc_enabled for Fujitsu H730 Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 176/180] Input: elantech - add more Fujtisu notebooks to force crc_enabled Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 177/180] ext4: fix accidental flag aliasing in ext4_map_blocks flags Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 178/180] ext4: fix ZERO_RANGE bug hidden by flag aliasing Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 179/180] ext4: allocate entire range in zero range Luis Henriques
2015-05-07  9:46 ` [PATCH 3.16.y-ckt 180/180] ipv4: Missing sk_nulls_node_init() in ping_unhash() Luis Henriques

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.